Open Model Gatewaydocs

Rerank

POST /v1/rerank scores documents against a query, on OpenRouter routes.

POST /v1/rerank
{"model": "example/rerank", "query": "laboratory safety rules", "documents": ["Wear goggles in the lab.", "The café opens at 8.", "No food near fume hoods."], "top_n": 2}

A Cohere v2 and Jina style subset. Served on OpenRouter routes.

FieldSupported
model, query, documentsRequired. Documents are non-blank strings: up to 1,000, each up to 64 KiB; the query up to 32 KiB; 1 MiB of text in total.
top_n1 or more; clamped to the number of documents.

Other fields, including return_documents and object documents, are refused.

Response

{"object": "list", "id": "…", "model": "example/rerank", "results": [{"index": 0, "relevance_score": 0.91}, {"index": 2, "relevance_score": 0.77}], "usage": {"total_tokens": 31}}

Results keep the provider's order, with unique indices into your documents. Documents are never echoed back. usage includes only counts the provider reported (total_tokens, search_units).

Cost

Rerank is input-only: tokens count as input, and each call is one request. If the provider bills per search, price search_units with a per-request maximum, or the cost is unbounded under a budget. OpenRouter's catalog has no rerank prices, so enter them by hand.

On this page