DocsAPI reference
Rerank
Order passages by relevance to a query with POST /v1/rerank, Cohere's request shape, served by Jev or any other decision model on your own provider connection.
INFRO is in private early access. Running these examples requires an early-access account, an active trial or subscription entitlement, and your own provider connection. Self-serve purchasing is not generally open. See Early access.
Send a query and up to 200 passages; get them back ordered by relevance. The request and response follow Cohere's rerank shape, so most rerank clients need only the base URL changed. Today the endpoint is served by a decision model — Jev, or any other one you connect: each passage is judged alone against the query ("does this passage address the query and contain something usable to answer it?"), and the probability of yes is relevance_score.
Every Jev call runs on your own TypeSafe connection and your TypeSafe account bills it; every other decision model runs on your own account with its provider. INFRO charges nothing per decision; the estimated provider cost of each call is on its row in the request log, separate from your INFRO subscription.
curl https://api.infro.io/v1/rerank \
-H "Authorization: Bearer $INFRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "typesafe/jev-1.13",
"query": "How long until a refresh token expires?",
"documents": [
"Refresh tokens expire after 30 days of inactivity.",
"Our offices are closed on public holidays."
],
"top_n": 1,
"return_documents": true
}'modelstringrequired- A decision model (
typesafe/jev-1.13, or any other decision model) or a route that serves one. querystringrequired- At most 8 KB.
documentsstring[] | {text}[]required- 1 to 200 passages, each at most 64 KB.
top_ninteger- Return only the best N. Default: all of them.
return_documentsboolean- Include each passage's text in the results. Default false.
instructionsstring- Replaces the relevance question for your domain, for example "Could this passage be the precedent the query cites?".
concurrencyinteger- How many passages are judged at once on your connection, 1–16. Default 8.
{
"id": "req_…",
"object": "rerank",
"model": "typesafe/jev-1.13",
"results": [
{ "index": 0, "relevance_score": 0.94, "document": { "text": "Refresh tokens expire after 30 days of inactivity." } }
],
"usage": { "input_tokens": 96, "output_tokens": 0, "total_tokens": 96, "cost": 0.000004, "price_source": "list" },
"route": "primary",
"route_name": null,
"provider": "typesafe",
"connection": "conn_…"
}Cost and recording
Each passage is one call to the decision model with the query, billed by your account with that model's provider per input token; the reservation against your budgets is the passages' size plus the query's once per passage. The request is one row in the request log with the passage count and the top score. The query and the passages are not stored.