> ## Documentation Index
> Fetch the complete documentation index at: https://mixroute.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rerank v5.0 Pro

> Cohere's quality-focused multilingual reranker for complex queries and long documents, with MixRoute request examples and response fields.

Rerank v5.0 Pro sorts retrieved documents by relevance to a query. Use it for quality-critical retrieval and complex queries before passing selected passages to an LLM.

Retrieve candidate documents first, then rerank them. The response contains relevance scores and original document indexes, not generated answers or embedding vectors. Send requests to `/v1/rerank` on MixRoute.

## Model information

| Field | Description |
| - | - |
| `model` | rerank-v5.0-pro |
| `endpoint` | [POST /v1/rerank](https://mixroute.ai/docs/api-reference/endpoint/rerank.md) |
| `context` | 32,768 tokens |

The provider context window is 32,768 tokens for each query/document pair, not for the whole document list. Effective request limits depend on the MixRoute route.

## Request fields

| Field | Description |
| - | - |
| `model` | Required. Use the exact model ID shown above. |
| `query` | Required query string. |
| `documents` | Required array of document strings. Keep the original array so results can be matched by index. |
| `top_n` | Optional positive integer. Select no more results than the number of candidate documents. |
| `return_documents` | Optional boolean. Set true to include the original text in `results[].document.text`. |

## Request examples

Set `MIXROUTE_API_KEY`. The Python example uses the requests package.

> [tab] cURL
>
> ```bash theme={null}
> curl --request POST "https://api.mixroute.ai/v1/rerank" \
>   --header "Authorization: Bearer $MIXROUTE_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{
>   "model": "rerank-v5.0-pro",
>   "query": "What is the capital of France?",
>   "documents": [
>     "Paris is the capital of France.",
>     "A triangle has three sides."
>   ],
>   "top_n": 1,
>   "return_documents": true
> }'
> ```

> [tab] Python
>
> ```python theme={null}
> import os
> import requests
>
> documents = ["Paris is the capital of France.", "A triangle has three sides."]
> response = requests.post(
>     "https://api.mixroute.ai/v1/rerank",
>     headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
>     json={
>         "model": "rerank-v5.0-pro",
>         "query": "What is the capital of France?",
>         "documents": documents,
>         "top_n": 1,
>         "return_documents": True,
>     },
>     timeout=60,
>     allow_redirects=False,
> )
> response.raise_for_status()
> result = response.json()
> if "error" in result:
>     raise RuntimeError(result["error"])
> for item in result["results"]:
>     print(item["relevance_score"], documents[item["index"]])
> print(result.get("usage", {}))
> ```

## Response fields

`results[].index` is the zero-based position in your original documents array. `results[].relevance_score` is the relevance score; larger values indicate a stronger match. Read `results[].document.text` only when document text is returned.

```json theme={null}
{
  "results": [
    {
      "document": {
        "text": "Paris is the capital of France."
      },
      "index": 0,
      "relevance_score": 0.8398325
    }
  ],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 0,
    "total_tokens": 27
  }
}
```

## Usage and billing

Use `usage.prompt_tokens` and `usage.total_tokens` for the reported token usage. Reranking does not generate answer text, so `usage.completion_tokens` can be 0. Other generic token fields are not a substitute for these fields.

Prices and available routes are listed in the [Model Marketplace](https://console.mixroute.ai/models). The console Usage Logs show the charge for each request; use those records for billing reconciliation rather than treating the usage object as a dollar amount.

[Complete request format](https://mixroute.ai/docs/api-reference/endpoint/rerank.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.