Rerank
POST /v1/rerank (and /v2/rerank) take Cohere's request and answer results[].
The model is <provider>/<model>, for example cohere/rerank-v3.5 or
openrouter/cohere/rerank-4-fast.
1curl https://api.aile.sh/v1/rerank \2-H "Authorization: Bearer $AILE_KEY" \3-H "Content-Type: application/json" \4-d '{5 "model": "cohere/rerank-v3.5",6 "query": "capital of France",7 "documents": ["Paris is in France.", "Berlin is in Germany."],8 "top_n": 19}'
Billing
- One search is one query over up to 100 documents:
ceil(documents / 100)searches. - The count is known before the call, so the hold is the bill.
- Documents are text: strings, or objects ranked on their
textfield. An object withouttextis ranked on its JSON, or on just itsrank_fieldswhen you send them. Image documents are a400. Each model's document limit applies. - Each result carries
document: {text}unless you sendreturn_documents: false. The response also hasobject: "list"and a Voyage-shapeddata[]whosedocumentis the plain string. - A response with no ranking, or one that does not match the documents sent, is a
502and is not charged. - A provider refusal you can fix (
400,404,413,422…) passes through. One about the lender's account is a502saying you were not charged. A502or504arrives as503with the real code inx-aile-status. - A key's pins and the routing headers choose the lender here too.
x-aile-providermust match the model's prefix, andx-aile-max-pricedoes not apply to a per-search price. - Where the deployment enables it, rerank also takes keyless x402.