Skip to main content
Reranking

DashScope reranking

DashScope reranking API

POST
https://ap-southeast-1.maas.qwencloudapi.com/compatible-api/v1/services/rerank/text-rerank/text-rerank
# Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
curl --request POST \
  --url https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/rerank/text-rerank/text-rerank \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "qwen3-rerank",
  "input": {
    "query": "What is a rerank model?",
    "documents": [
      "Rerank models are widely used in search engines and recommendation systems. They sort candidate documents based on text relevance.",
      "Quantum computing is a cutting-edge field of computer science.",
      "The development of pre-trained language models has brought new advancements to rerank models."
    ]
  },
  "parameters": {
    "return_documents": true,
    "top_n": 2
  }
}'
{
  "output": {
    "results": [
      {
        "document": {
          "text": "<string>"
        },
        "index": 0,
        "relevance_score": 0.9334521178273196
      }
    ]
  },
  "usage": {
    "total_tokens": 0
  },
  "request_id": "85ba5752-1900-47d2-8896-23f99b13f6e1"
}
Rerank documents by semantic relevance to a query using qwen3-rerank (text) or qwen3-vl-rerank (text, images, and videos). Uses a nested request structure with input and parameters wrappers.
The gte-rerank model was discontinued on May 30, 2026. Switch to qwen3-rerank. This does not apply to gte-rerank-v2, which remains available in China North 2 (Beijing).

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/api/v1/services/rerank/text-rerank/text-rerank
  • SDK base_http_api_url: https://ap-southeast-1.maas.qwencloudapi.com/api/v1

Model overview

ModelRegionsMax DocumentsMax Tokens/DocMax Request TokensLanguagesUse Cases
qwen3-rerankSingapore, China North 2 (Beijing)5004,000120,000100+ languagesText semantic search, RAG
gte-rerank-v2China North 2 (Beijing) only5004,00030,00050+ languagesText semantic search, RAG
qwen3-vl-rerankChina North 2 (Beijing) onlyText: 100; image: 40; video: 48,000120,00033 languagesMultimodal search result reranking (text, image, video)
For pricing, see the Model Marketplace. Parameter definitions:
  • 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. For qwen3-vl-rerank, the limit depends on the document modalities in the request.
  • Max Request Tokens: Calculated as Query Tokens x Document Count + Total Document Tokens. Must not exceed the limit.

Authorizations

string
header
required

QwenCloud API Key. Create one in the console.

Body

application/json
enum<string>
required

Model name. qwen3-rerank and gte-rerank-v2 rerank text. qwen3-vl-rerank reranks text, images, and videos. gte-rerank-v2 and qwen3-vl-rerank are available only in China North 2 (Beijing).

qwen3-rerank,gte-rerank-v2,qwen3-vl-rerank
qwen3-rerank
object
required

Input data containing the query and documents to rank.

object

Parameters for the reranking request. Must be wrapped inside this parameters object.

Response

200-application/json
object

Output wrapper containing ranked results.

object

Token usage statistics.

string

Unique request identifier.

85ba5752-1900-47d2-8896-23f99b13f6e1