Browse docs ▾
API reference

Rerank

Sort search results by how well they answer a query - the usual second step in search and RAG, after a fast first pass with embeddings or keywords. The request and response follow Cohere's and Jina's rerank APIs, so clients written for either work with a changed base URL.

POST/v1/rerank

Request

FieldTypeDescription
model*stringA rerank model id from the table below, e.g. qwen/qwen3-rerank.
query*stringWhat the documents are ranked against.
documents*array1 to 500 texts, as strings or objects with a text field. Qwen3 Rerank takes up to 4,000 tokens per document; Cohere Rerank 5 up to 32,000.
top_nintegerReturn only the best N. Defaults to all documents.
return_documentsbooleanInclude each document's text in its result as document.text. Default false.

Example

bash
curl https://boldrouter.com/v1/rerank \
  -H "Authorization: Bearer $BOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen/qwen3-rerank",
    "query": "How do I reset my password?",
    "documents": [
      "Our office is open Monday to Friday.",
      "To reset your password, open Settings and choose Security.",
      "Passwords must be at least 12 characters."
    ],
    "top_n": 2
  }'

Results come back best first, with the position of each document in your list:

json
{
  "id": "req_...",
  "object": "list",
  "model": "qwen/qwen3-rerank",
  "results": [
    { "index": 1, "relevance_score": 0.93 },
    { "index": 2, "relevance_score": 0.41 }
  ],
  "usage": { "prompt_tokens": 62, "total_tokens": 62 }
}

relevance_score runs from 0 to 1. Compare scores within one request only - they aren't calibrated across requests or models.

Models & pricing

Billed on input tokens only: the documents, plus the query counted once per document. BYOK keys work here too.

Model idIn / 1M
qwen/qwen3-rerank
Alibaba's multilingual reranker for search and RAG: up to 500 documents of 4,000 tokens each per request.
$0.10
cohere/rerank-v5.0-pro
Cohere's most accurate reranker, 100+ languages, documents up to 32K tokens.
$0.05
cohere/rerank-v5.0-fast
Faster, lower-cost Cohere reranker for high-volume search, documents up to 32K tokens.
$0.02
Rerank models are single-provider: scores from different models aren't comparable, so the router never fails over between them.