Submit a rerank request
Changed onSubmits a rerank request to the rerank router
Request
- Base URLhttps://openrouter.ai/api/v1
- AuthHTTP bearer
Request body
Rerank request input
The list of documents to rerank. Documents may be plain strings, or structured objects with text and/or image for multimodal models.
The rerank model to use
Provider routing preferences for the request.
The search query to rerank documents against
A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
Number of most relevant documents to return
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.
Example request
{
"documents": [
"Paris is the capital of France.",
"Berlin is the capital of Germany."
],
"model": "cohere/rerank-v3.5",
"query": "What is the capital of France?",
"top_n": 3
}Response
Rerank response
Rerank response containing ranked results
Unique identifier for the rerank response (ORID format)
The model used for reranking
The provider that served the rerank request
List of rerank results sorted by relevance
Usage statistics
Example response
{
"id": "gen-rerank-1234567890-abc",
"model": "cohere/rerank-v3.5",
"results": [
{
"document": {
"text": "Paris is the capital of France."
},
"index": 0,
"relevance_score": 0.98
}
],
"usage": {
"search_units": 1,
"total_tokens": 150
}
}Changes
- info
added the new optional request property
provider/allOf[#/components/schemas/ProviderPreferences]/options/celeris - info
added the new
Celerisenum value to the request propertyprovider/allOf[#/components/schemas/ProviderPreferences]/ignore/items/anyOf[#/components/schemas/ProviderName] - info
added the new
Celerisenum value to the request propertyprovider/allOf[#/components/schemas/ProviderPreferences]/only/items/anyOf[#/components/schemas/ProviderName]
1 more change in this revision
- info