Rerank documents
POST/rerank
Scores how relevant each document is to a query, in the format of the rerank APIs of Cohere and Jina, with qwen3-reranker-0.6b (alias qwen/qwen3-reranker-0.6b). At most 1000 documents per request, a query of at most 4096 characters and about 300,000 tokens (the estimate below); the model reads each document with the query up to 8,192 tokens.
The model reports no usage, so the request is billed on an estimate that the API writes into usage: for each document, ceil((characters(query) + characters(document)) / 4) tokens, added up, with characters counted as Unicode code points. Every document is scored and billed, also when top_n returns fewer. Output is not billed. Only Serenity Edge API keys can use this route. See the Embeddings, rerank and redaction guide.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 413
- 429
- 500
- 503
The most relevant documents with their scores, the model id and the estimated tokens the request is billed on. The scores of the example are illustrative; its usage is the estimate for the example request (21 + 25 + 21 tokens).
The request was refused: a body that is not a JSON object, a missing or invalid model, query, documents, top_n or return_documents, more than 1000 documents, a query over 4096 characters, more than about 300,000 tokens, a model served on another route, or a request the model server could not process (The model server rejected the request. Check the input sizes and parameters.). param names the field at fault when there is one.
Missing or invalid API key.
The key is valid but cannot use this route: only Serenity Edge API keys can. Any other key, such as a key from a Serenity Star account, gets permission_denied with a message that names the route's API (embeddings, rerank or redact).
The model id is unknown, or it is a chat or decision model, which cannot be used on this route (model_not_found).
The request body is larger than this route accepts (4 MB, request_too_large).
Rate limit exceeded, or the service is temporarily at capacity for this model. Wait for the number of seconds in the Retry-After header before retrying.
Response Headers
Seconds to wait before retrying.
Unexpected server error: the model service returned an unexpected response (upstream_error), the request got no answer within 600 seconds (timeout), or an error in the gateway. Retry with backoff.
The model service is temporarily unavailable (upstream_unavailable). Retry later and check the status page at https://status.serenityedge.ai.