/v1/rerank and receive them back ordered from most to least relevant — ready to pass directly to your language model as context.
Endpoint
Bearer sk-mel-<KEY> via Authorization header.
Parameters
string
required
The reranking model ID to use. Cross-encoder models are listed under
GET /v1/models with capability rerank. Routing flavor suffixes are supported.string
required
The search query to rank documents against. The reranker scores each document by its relevance to this text.
array
required
The candidate documents to rerank. Each element can be:
- A plain string — the document text itself
- An object with a
textfield — useful when you need to pass structured metadata alongside the text
integer
Return only the top N results by relevance score. If omitted, all documents are returned sorted by score.
boolean
When
true, the original document text is echoed back in each result object. Default: false. Set to true to avoid maintaining a separate lookup by index.Example
Response
array
Array of result objects sorted from most to least relevant. Each contains:
index— position of the document in the original input arrayrelevance_score— float in[0, 1], higher is more relevantdocument— present only whenreturn_documents: true; object with atextfield
object
Token count for the reranking pass:
total_tokens.object
Per-request environmental footprint. Fields:
energy_kwh, carbon_g_co2, water_liters, renewable_percent, pue, provider_id, location.object
Itemised cost:
energy (EUR), credits deducted, and paid_with.All reranking runs on GDPR-compliant European infrastructure. Document content never leaves the EU.