The general-purpose text embedding model converts text data into numerical vectors for downstream tasks like semantic search, recommendation, clustering, and classification.
Model overview
- Beijing
- Singapore
| Model | Embedding dimensions | Max rows | Maxtokensper line | Price (per 1K input tokens) | Supported languages | Free quota(Note) |
|---|---|---|---|---|---|---|
| qwen3.7-text-embedding | 2,560, 2,048, 1,536, 1,024 (default), 768, 512, 256 | 20 | 128,000 | CNY 0.0005Batch call: CNY 0.00025 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 200 other major languages and dialects | 1 million tokensValidity: 90 days after you activate Model Studio |
| qwen3.7-text-embedding-flash | 1,024 (default), 768, 512, 256 | 20 | 128,000 | CNY 0.000125Batch call: CNY 0.000063 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 200 other major languages and dialects | 1 million tokensValidity: 90 days after you activate Model Studio |
text-embedding-v4Belongs to the Qwen3-Embedding series | 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | CNY 0.0005Batch call: CNY 0.00025 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 100 other major languages, plus multiple programming languages | 1 million tokensValidity: 90 days after you activate Model Studio |
| text-embedding-v3 | 1,024 (default), 768, 512, 256, 128, or 64 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 50 other major languages | No free quota | |||
| text-embedding-v2 | 1,536 | 25 | 2,048 | CNY 0.0007Batch call: CNY 0.00035 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian | No free quota |
| text-embedding-v1 | Chinese, English, Spanish, French, Portuguese, Indonesian |
Prerequisites
Users familiar with the OpenAI ecosystem can use the OpenAI-compatible API for a quick migration. The DashScope API provides more unique features. Choose the one that suits your needs.
Obtain an API key and export the API key as an environment variable. If you use an SDK to make calls, install the DashScope SDK.
OpenAI compatibility
- Public cloud
The base_url to configure when calling with the SDK:
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1The endpoint to configure when calling over HTTP:POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/embeddingsReplace {WorkspaceId} with your actual workspace ID.Request bodymodelstringrequiredThe name of the model to call. See the Model overview table for model names.inputarray<string> or string or filerequiredThe input text to process. The input can be a string, an array of strings, or a file. Limits on text length and batch size vary by model version:
integer optionalThe dimension of the output embedding vectors. Must be one of the following values: 2560 (for qwen3.7-text-embedding only),2048 (for text-embedding-v4 only), 1536 (for text-embedding-v4 only), 1024, 768, 512, 256, 128, or 64. The default value is 1024.encoding_format string optionalControls the format of the returned embeddings. The input parameter supports float and base64, and the embedding data in the output also supports both float and base64 formats. The format actually returned depends on the gateway that the request is routed to:
|
Python |
Response objectdataarrayA list of the resulting embedding objects.
Property embedding listThe embedding vector, returned as an array of floating-point numbers.indexintegerThe index of the corresponding input text in the input array.objectstringThe object type returned by this call. The default value is embedding.stringThe name of the model used for this call.objectstringThe type of the data returned by this call. The default value is list.usageobjectToken usage. qwen3.7-text-embedding-flash returns prompt_tokens and total_tokens; other existing text embedding models return only total_tokens.
Property prompt_tokensintegerReturned only by qwen3.7-text-embedding-flash. The total number of tokens in the request input. Its value is the same as total_tokens.total_tokens integerThe total number of tokens in the request, used for billing and audit. The token count is based on how the model's tokenizer parses the input string, and may differ from your own estimates based on character or word counts. |
DashScope
- Public cloud
The base_url to configure when calling with the SDK:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1Endpoint for HTTP calls: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embeddingReplace
{WorkspaceId} with your actual workspace ID.Request bodymodelstringrequiredThe model to use. For a list of available models, see the Model overview table.inputstringorarray<string>requiredThe input text to process. The input can be a string, an array of strings, or a file. Limits on text length and batch size vary by model version:
stringoptionalWhen calling over HTTP, put text_type in the parameters object.Text converted to embeddings can be applied to downstream tasks such as retrieval, clustering, and classification. For asymmetric tasks such as retrieval, it is recommended to differentiate between query text (query) and document text (document) to achieve better retrieval performance. For symmetric tasks such as indexing, clustering, and classification, you can simply use the system default value of document.dimension integer optionalWhen calling over HTTP, put dimension in the parameters object.The dimension of the output embedding vectors. Must be one of the following values: 2560 (for qwen3.7-text-embedding only),2048 (for text-embedding-v4 only), 1536 (for text-embedding-v4 only), 1024, 768, 512, 256, 128, or 64. The default value is 1024.output_type string optionalWhen calling over HTTP, put output_type in the parameters object.Specifying discrete vector output applies only to the qwen3.7-text-embedding、``text-embedding-v3 and text-embedding-v4 models. Valid values are dense, sparse, and dense&sparse. The default is dense, which outputs continuous vectors only. Sparse vector output (sparse and dense&sparse) is supported only when the model is called through the DashScope API.instruct string optionalProvides custom instructions to guide the model in understanding the query intent. English instructions are recommended, as they typically improve performance by 1% to 5%.This parameter takes effect only when text_type is set to query, and it is counted in token usage based on the number of input texts. When text_type is set to document or text_type is not set, this parameter does not take effect and is not counted in token usage. |
Python |
Response objectIn DashScope Python SDK 2.0, the response object returned byrequest_id stringA unique request identifier, used for tracing and troubleshooting.embeddingsarrayThe model's output for the request. This is an array of objects, with each object corresponding to an input text.
Property sparse_embedding arrayThe sparse vector representation of the corresponding string. This applies only to text-embedding-v3 and text-embedding-v4.
Property index integerThe index of the token in the vocabulary.value floatIndicates the weight or importance score of the Token. The higher the value, the greater the importance or relevance of the Token in the current text context.token stringThe text of the token.arrayThe dense vector representation for the corresponding string.index integerThe index of the corresponding input text in the input array.objectToken usage. qwen3.7-text-embedding-flash returns prompt_tokens and total_tokens; other existing text embedding models return only total_tokens.
Property prompt_tokens integerReturned only by qwen3.7-text-embedding-flash. The total number of tokens in the request input. Its value is the same as total_tokens.total_tokens integerThe total number of tokens in the request, used for billing and audit. The token count is based on how the model's tokenizer parses the input string, and may differ from your own estimates based on character or word counts.When instruct is set and text_type is set to query, instruct is counted in token usage repeatedly, once for each input text.e.status_code (HTTP status code), e.code (error code), e.message (error message), and e.request_id (unique request ID). For more information, see Error codes. |