Skip to main content
POST
Rerank documents: bge-reranker-v2-m3
Use the playground on the right to call the endpoint directly: put Bearer sk-your-api-key in Authorization, then hit send — the example body is already filled in.
Model capabilities, pricing, measured data and the three gotchas are in the overview. Recall sizing, chunking and threshold strategy are in RAG tuning in practice.

Parameter reference

Unrecognised parameters (max_chunks_per_doc, rank_fields, truncate, …) are silently ignored rather than rejected.

Response notes

  • index — the document’s original position in the documents array you sent. Use it to look up your own document object; don’t match on the returned text.
  • relevance_score — range 0–1. Comparable only within a single request. Not comparable across queries, and systematically lower in cross-lingual cases. See the threshold discussion in the overview.
  • results is always sorted by relevance_score descending; index values are complete and unique.
  • Read usage from prompt_tokens (query counted once + all documents) and total_tokens (query counted per pair); input_tokens / output_tokens are always 0 on this channel. This round could not confirm from billing which field is charged — treat the console invoice as authoritative.

Error codes

Suspect the model name first on a 503. If the request body fails to parse (for example Content-Type: text/plain), the gateway never reads the model field and returns this same 503 with an empty model name — which reads like a channel outage but is not one.
A wrong path does not give you a 404. Both /rerank and /v2/rerank (the Cohere v2 SDK’s default) return HTTP 200 with the website’s HTML homepage, which surfaces client-side as an unparseable response. https://api.apiyi.com/v1/rerank is the only valid path.

Debugging notes

With very few candidates the score gaps are extreme (0.97 for first, 0.12 for second) and tell you nothing about where the model’s decision boundary sits. Use 10–20 documents including 2–3 deliberate distractors — topically close but not answering the question. That’s what shows you the score range on your corpus, which is what any threshold has to be based on.
A Chinese query against English documents may score correct answers at just 0.003–0.3, but the ordering is right. That’s inherent to the model, not a broken call. Judge by ordering, not absolute value.
Even a single candidate measures around 2 s at P50 — that’s fixed gateway and upstream overhead. Going from 1 to 100 candidates only moves P50 from 2.0 s to 3.8 s. So don’t shrink your candidate set to save latency; the payoff is far smaller than expected.
Upstream TPM is only 20,000. Iterating with 100 candidates burns the whole minute’s budget in about 15 calls and starts returning 429. Debug with 10–20 candidates instead — enough to see the score distribution, without the quota interrupting you. See the quota section in RAG tuning.

Authorizations

Authorization
string
header
required

Add the Authorization: Bearer YOUR_API_KEY request header

Body

application/json
model
string
required

Always bge-reranker-v2-m3 (case-sensitive; a wrong name returns 503)

Example:

"bge-reranker-v2-m3"

query
string
required

The search query. An empty string returns 400

documents
string[]
required

Candidate documents. Plain string array only — passing Cohere-style [{"text": "..."}] objects returns 400. Cannot be empty. Keep to 100 or fewer.

top_n
integer

Return the top N results. Omitting it, or passing 0 or a negative number, returns all. Must be an integer — a string returns 400. Does not affect usage: every candidate is scored regardless.

Example:

2

return_documents
boolean

Whether to echo the document text in results. Note: this parameter currently has no effect on this channeldocument.text is always echoed. If response size matters, map results back by index yourself rather than relying on this flag to trim the payload.

Example:

true

Response

Rerank succeeded

results
object[]

Sorted by relevance_score, descending

usage
object

Token usage. This model consumes input tokens only