qwen3-rerank
Rerank documents by semantic relevance to a query using qwen3-rerank.
Supported model: qwen3-rerank only.
The following uses the Singapore (ap-southeast-1) endpoint. To use China North 2 (Beijing), replace ap-southeast-1 with cn-beijing and use an API key from that region. Reranking is not available in other regions. See Regions and endpoints.
For pricing, see the Model Marketplace.
Parameter definitions:
The gte-rerank model was discontinued on May 30, 2026. Switch to qwen3-rerank.
Before you call the API, get an API key and set it as an environment variable. If you use the OpenAI SDK, install it first.
Endpoint
The following uses the Singapore (ap-southeast-1) endpoint. To use China North 2 (Beijing), replace ap-southeast-1 with cn-beijing and use an API key from that region. Reranking is not available in other regions. See Regions and endpoints.
- HTTP:
POST https://ap-southeast-1.maas.qwencloudapi.com/compatible-api/v1/reranks - SDK
base_url:https://ap-southeast-1.maas.qwencloudapi.com/compatible-api/v1
Model overview
| Model | Max Documents | Max Tokens/Doc | Max Request Tokens | Languages | Use Cases |
|---|---|---|---|---|---|
| qwen3-rerank | 500 | 4,000 | 120,000 | 100+ languages | Text semantic search, RAG |
- Max Tokens/Doc: Maximum token count per query or document. If a query or document exceeds this limit, the API returns an HTTP 400 error and does not truncate the input.
- Max Documents: Maximum number of documents per request.
- Max Request Tokens: Calculated as
Query Tokens x Document Count + Total Document Tokens. Must not exceed the limit.
Body
application/jsonenum<string>
required
Model name. Must be qwen3-rerank for the text reranking endpoint.
qwen3-rerank
qwen3-rerank
string
required
Query text. Max 4,000 tokens.
What is a reranking model
string[]
required
Documents to rank. An array of strings. Max 500 documents.
integer
Return only the top N results. Defaults to returning all documents.
2
x >= 1
string
Custom ranking task instruction. English recommended. Default behavior is QA retrieval: "Given a web search query, retrieve relevant passages that answer the query."
Given a web search query, retrieve relevant passages that answer the query.