Rerank
Rerank documents by relevance to a query.
Billing: a model priced per request (unit: request) is charged per search unit the provider reports, or for one unit when it reports none. A model priced per token is charged on the input tokens the provider reports.
usage carries what the gateway metered: the provider's tokens, the search units billed when the model is priced per request, and, when the request was priced, cost_usd and pricing_source as a completion's usage does. meta is the provider's own billing report, unchanged.
Authentication modes:
Master key + user field: Use specified user (must exist)
API key + user field: Use specified user (must exist)
API key without user field: Use the shared "default" user
Enter your API key here (sent as Otari-Key header).
Rerank request.
List of document strings to rerank
Per-document truncation limit
Provider-prefixed model ID, e.g. 'cohere:rerank-v3.5'
The search query to rerank documents against
Maximum number of results to return
User ID for usage attribution
Successful Response
Documents ordered by relevance, with the gateway's metered usage.
Provider-assigned response ID
The model that served the request
Validation Error
POST /api/v1/rerank HTTP/1.1
Otari-Key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 99
{
"documents": [
"text"
],
"max_tokens_per_doc": 1,
"model": "text",
"query": "text",
"top_n": 1,
"user": "text"
}{
"id": "text",
"meta": {
"billed_units": {
"ANY_ADDITIONAL_PROPERTY": 1
},
"tokens": {
"ANY_ADDITIONAL_PROPERTY": 1
}
},
"model": "text",
"results": [
{
"index": 1,
"relevance_score": 1
}
],
"usage": {
"cost_usd": "text",
"pricing_source": "text",
"search_units": 1,
"total_tokens": 1
}
}Last updated
Was this helpful?
