Alibaba Cloud logo
Alibaba Cloud

Qwen3-Rerank

Alibaba Qwen 3.0 text rerank model for relevance scoring and search result reordering

Category Rerank Model ID qwen3-rerank
Model TypeRerank Model
InputText
Use CasesSearch / vector retrieval reranking

Pricing & Specs

💰 Pricing

Input$0.5 / M tokens
Input (Text)$0.5 / M tokens

⚙️ Specs

Model TypeRerank Model
InputText
Use CasesSearch / vector retrieval reranking
OutputRelevance scores and ordering

API Examples

Python

import requests

api_key = "your-api-key"

# DashScope native endpoint (proxied by XAI Router)
url = "https://api.xairouter.com/api/v1/services/rerank/text-rerank/text-rerank"

payload = {
    "model": "qwen3-rerank",
    "input": {
        "query": "What is a text reranking model?",
        "documents": [
            "Text reranking models are widely used in search engines and recommender systems to sort candidates by relevance.",
            "Quantum computing is a frontier field of computer science.",
            "The rise of pretrained language models has brought new advances to text reranking.",
        ],
    },
    "parameters": {
        "return_documents": True,
        "top_n": 5,
    },
}

resp = requests.post(
    url,
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json=payload,
    timeout=60,
)
resp.raise_for_status()
print(resp.json())

cURL

# DashScope native endpoint (proxied by XAI Router)
curl --location 'https://api.xairouter.com/api/v1/services/rerank/text-rerank/text-rerank' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data '{
    "model": "qwen3-rerank",
    "input": {
      "query": "What is a text reranking model?",
      "documents": [
        "Text reranking models are widely used in search engines and recommender systems to sort candidates by relevance.",
        "Quantum computing is a frontier field of computer science.",
        "The rise of pretrained language models has brought new advances to text reranking."
      ]
    },
    "parameters": {
      "return_documents": true,
      "top_n": 5
    }
  }'

# OpenAI-compatible rerank endpoint
curl --request POST --url https://api.xairouter.com/compatible-api/v1/reranks --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data '{
    "model": "qwen3-rerank",
    "documents": [
      "Text reranking models are widely used in search engines and recommender systems to sort candidates by relevance.",
      "Quantum computing is a frontier field of computer science.",
      "The rise of pretrained language models has brought new advances to text reranking."
    ],
    "query": "What is a text reranking model?",
    "top_n": 2,
    "instruct": "Given a web search query, retrieve relevant passages that answer the query."
  }'