Rerank

Rerank documents against a query using a cross-encoder reranker. Cohere-compatible API.

post/v1/rerank

Request body

modelstring required

ID of the rerank model to use.

querystring required

The search query to rank documents against.

documentsstring[] required

Array of document strings to rerank.

top_ninteger

Number of top results to return. Defaults to all documents when omitted.

return_documentsboolean

Whether to include the document text in the response. Default false.

max_chunks_per_docinteger

Maximum number of chunks per document (accepted, but not all providers support this).

Example request

{
  "model": "deepinfra/qwen3-reranker-8b",
  "query": "What is the capital of France?",
  "documents": [
    "Paris is the capital of France.",
    "Berlin is the capital of Germany.",
    "Madrid is the capital of Spain."
  ],
  "top_n": 2,
  "return_documents": true,
  "max_chunks_per_doc": 10
}

Response

Rerank response with ranked results.

idstring
modelstring required

Changes

No recorded changes to this endpoint across all 1 revision of this API.