Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rerank documents

Rerank a set of documents against a query by relevance, following the rerank format common to OpenAI-compatible APIs.

post
Authorizations
AuthorizationstringRequired

Please provide header value as 'Bearer ' and don't forget to add 'Bearer' HTTP Authorization Scheme before the token.

Body

Request payload for reranking a set of documents against a query.

modelstring · min: 1Required

ID of the model to use.

Example: Qwen/Qwen3-VL-Reranker-8B
queryone ofRequired

The search query to rank documents against. Either a plain string, or an array of content parts, for example to rank against an image. Content parts are kept as separate parts in the order given, even when all of them are text. Whether a model accepts content parts, and how it combines several of them, is model-specific.

Example: What is the capital of France?
string · min: 1Optional
or
top_nintegerOptional

Number of highest-scoring documents to return. When omitted or 0, all documents are returned. A value above the number of documents returns all of them.

return_documentsbooleanOptional

If true, each result includes the document it ranks, in the form you sent it: a plain-string document as an object with a text field, a content-part document as an object with its content parts.

Default: false
Responses
200

Successful operation.

application/json
post/v1/rerank
POST /v1/rerank HTTP/1.1
Host: openai.inference.de-txl.ionos.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 217

{
  "model": "Qwen/Qwen3-VL-Reranker-8B",
  "query": "What is the capital of France?",
  "documents": [
    "The capital of France is Paris.",
    "The capital of Brazil is Brasilia.",
    "Lyon is the third-largest city in France."
  ],
  "top_n": 2
}
{
  "model": "Qwen/Qwen3-VL-Reranker-8B",
  "results": [
    {
      "index": 0,
      "relevance_score": 0.98
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "total_tokens": 20
  }
}

Last updated

Was this helpful?