Skip to main content
A reranker scores each document against a query, so you can put the most relevant ones first. Use it after retrieval to sharpen what you pass to a model, or to choose between candidates a model has generated. One call scores every document, and there is no prompt to tune. The serverless reranker is Qwen3-Reranker-8B. The body is the Cohere-style rerank shape. The OpenAI SDKs have no rerank method, so call the endpoint directly.

Example

Request

return_documents and rank_fields are accepted and have no effect.

Response

index points into your documents list, so documents[r["index"]] is the scored text. Each result also echoes the document’s text in document.text. A higher relevance_score means a closer match to the query. Sort by relevance_score when order matters to you. To pick the single best document, continuing the example above:
Python

Billing

A rerank call bills on input tokens only: the query plus every document. It generates nothing, so output is free. usage.prompt_tokens is the count you are billed for. Rates are on the model page and in GET /v1/models.

See also