A rerank model re-scores documents returned by initial retrieval, surfacing the most relevant results at the top.
Model overview
Model | Max documents | Max input tokens per item | Max input tokens per request | Supported languages | Scenarios |
|---|---|---|---|---|---|
qwen3.7-text-rerank | 500 | 30,000 | 120,000 (recommended) | 201 major languages and dialects, including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian |
|
qwen3-vl-rerank | Text: 100 Image: 40 Video: 4 | 8,000 | 120,000 | 33 major languages, such as Chinese, English, Japanese, Korean, French, and German |
|
qwen3-rerank | 500 | 4,000 | Over 100 major languages, such as Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian |
| |
gte-rerank-v2 | 30,000 | Over 50 languages, such as Chinese, English, Japanese, Korean, Thai, Spanish, French, Portuguese, German, Indonesian, and Arabic |
- Max input tokens per item: Maximum tokens 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 documents per request. For qwen3-vl-rerank, the limit varies by document type (text, image, video, or mixed).
- Max input tokens per request: Calculated as
Query Tokens × Number of documents + Total document tokens. Must not exceed the per-request limit.
Input limitations
Model | Image | Video |
|---|---|---|
qwen3-vl-rerank | JPEG, PNG, WEBP, BMP, TIFF, ICO, DIB, ICNS, and SGI (URL or Base64 supported) | MP4, AVI, and MOV (URL only) |
Prerequisites
Obtain an API key and set the API key as an environment variable. To use the SDK: install the DashScope SDK.
HTTP
Replace {WorkspaceId} with your actual workspace ID.
This section describes the DashScope HTTP API.
RequestRequest headersContent-Typestring (Required)The content type of the request. Must be application/json.Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.Request bodymodelstring (Required)The model name. Supported values: qwen3.7-text-rerank, qwen3-rerank, gte-rerank-v2, qwen3-vl-rerank.input object (Required)Input content.Nest
Properties query string | object (Required)Query text (max 4,000 tokens).qwen3-vl-rerank supports two query formats:
array (Required)Candidate documents to sort. Each element is a string.qwen3-vl-rerank accepts a dictionary or string per element: {"modality type": "text/image URL/video URL"}. Supported types: text, image, video.
object (Optional)Optional parameters.Nest
Properties top_n int (Optional)Number of top-ranked documents to return. Default: all documents. Values exceeding total documents return all.return_documents bool (Optional)Whether to include document text in results. Default: false. Supported models: gte-rerank-v2, qwen3-vl-rerank, qwen3-rerank.instruct string (Optional)Custom sorting instruction. Applies to qwen3.7-text-rerank, qwen3-rerank, and qwen3-vl-rerank. Guides the model to apply different sorting policies. Examples:
float (Optional)qwen3-vl-rerank only. Controls video frame extraction count. Smaller values = fewer frames. Range: 0-1 (default: 1.0). |
|
Responserequest_idstringUnique request identifier for tracing and troubleshooting.output objectTask output.
Properties results arraySorting results, ordered by relevance_score descending.
Properties document dictOriginal document object. Returned only when return_documents is true. Format: {"text": "Original document text"}.index intDocument index in the input documents array.relevance_score doubleSemantic relevance between document and query. Range: 0.0-1.0 (higher = more relevant).Scores are relative to the current request and cannot be compared across requests. objectToken usage statistics.
Properties prompt_tokens intReturned only by qwen3.7-text-rerank. The total number of tokens in the request input.total_tokens intThe total tokens consumed by the request, used for billing and audit.stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes. |
|
Use the SDK
Example
Call the rerank model API.
SDK parameter names match the HTTP API, but the structure differs. HTTP uses nestedinputandparametersobjects; the SDK uses a flat structure.
qwen3-vl-rerank for multimodal reranking with an image query.
Sample output
code and message are always empty strings.