v45

latestOpenAPI 3.0.1raw.githubusercontent.com2026-06-2223106188.8 KB
Reranking

Reranks documents based on their relevance to a query.

Given a query and a list of documents, returns the documents ranked by their relevance to the query. The documents are scored and sorted in descending order of relevance.

post/openai/v1/reranking

Request body

modelstring required

ID of the reranking model to use.

querystring required

The search query to rank documents against.

docsstring[] required

An array of documents to rank. Each document is a string containing the text content. Maximum of 100 documents per request.

instructionstring nullable

Optional instruction to guide the reranking process. If not provided, a default instruction will be used.

Example request

{
  "model": "qwen3-reranker-4b",
  "query": "artificial intelligence research",
  "docs": [
    "Machine learning is a subset of artificial intelligence",
    "The weather forecast predicts rain tomorrow",
    "Deep learning uses neural networks with multiple layers"
  ],
  "instruction": "Find the most relevant document about AI research"
}

Response

OK

Example response

{
  "results": [
    {
      "doc": "Machine learning is a subset of artificial intelligence",
      "score": 0.92
    }
  ]
}