General text embedding models convert text data into numerical vectors for downstream tasks such as semantic search, recommendation, clustering, and classification.
Model overview
- Singapore
- Beijing
- Hong Kong (China)
- dashscope CLI
| Model | Vector dimensions | Maximum rows | Maximum tokens processed per row (Note) | Unit price (per million input tokens) | Supported languages | Free quota(Note) |
|---|---|---|---|---|---|---|
| qwen3.7-text-embedding | 2560, 2,048, 1,536, 1,024 (default), 768, 512, 256 | 20 | 128,000 | $0.07 | 201 mainstream languages and dialects, including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian | 1 million tokensValidity: within 90 days after Model Studio activation |
text-embedding-v4Part of the Qwen3-Embedding series | 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | $0.07 | 100+ mainstream languages, including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian | 1 million tokensValidity: within 90 days after Model Studio activation |
| text-embedding-v3 | 1,024 (default), 768, 512 | 50+ mainstream languages, including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian | 500,000 tokensValidity: within 90 days after Model Studio activation |
Prerequisites
If you are familiar with the OpenAI ecosystem, you can use the compatible API for quick migration; the DashScope API offers richer exclusive features. Choose based on your needs.
You need to have obtained and configured an API Key and configured the API Key in environment variables. If you call through the SDK, you also need to install the DashScope SDK.
OpenAI compatibility
base_url to configure when calling with the SDK:
- Singapore: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
- China (Beijing): https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
- Hong Kong (China): https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1
- Singapore: POSThttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/embeddings
- China (Beijing): POSThttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/embeddings
- Hong Kong (China): POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1/embeddings
{WorkspaceId} with your actual workspace ID when calling.
Request bodymodelstringRequiredThe model name to call. Select from the model names in the Model overview table.inputarray<string> or string or fileRequiredThe input text to process. It can be a string, an array of strings, or a file. Different model versions support different text lengths and batch sizes, as follows:
integer OptionalThe specified vector dimensions, which must be one of the following values: 2560 (only applies to qwen3.7-text-embedding), 2048 (only applies to text-embedding-v4), 1536 (only applies to text-embedding-v4) 1024, 768, 512, 256, 128, or 64. The default value is 1024.encoding_format string OptionalControls the returned embedding format. The input supports float and base64, and the returned embedding data also supports both float and base64 formats. The actual returned format depends on the gateway the request is routed to:
|
|
Response objectdataarrayTask output information.
Property embedding listThe value of the object returned by this call, which is an array of float elements containing the specific embedding vectors.indexintegerThe index of the input text in the input array that corresponds to the algorithm result in this structure.objectstringThe type of the object returned by this call. The default value is embedding.stringThe name of the model called.objectstringThe type of data returned by this call. The default value is list.usageobjectThe Token usage of this request. Embedding models only have input and no output, so prompt_tokens and total_tokens always have the same value.
Property prompt_tokensintegerThe number of Tokens corresponding to the input content of this request. The value is the same as total_tokens.total_tokens integerThe total number of Tokens consumed by this request, used for metering and billing. The Token count is based on the result of the input string parsed by the model Tokenizer, which may differ from the character or word count you estimate on your own. |
DashScope
base_url to configure when calling with the SDK:
- Singapore: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
- China (Beijing): https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1
- Hong Kong (China): https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1
- Singapore: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
- China (Beijing): POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
- Hong Kong (China): POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
{WorkspaceId} with your actual workspace ID when calling.
Request bodymodelstringRequiredThe model to call. Select one from the model names in the table in Model overview.inputstringorarray<string>RequiredThe input text to process. It can be a string, an array of strings, or a file. Different model versions support different text lengths and batch sizes, as follows:
stringOptionalWhen calling over HTTP, put text_type into the parameters object.After text is converted into vectors, it can be applied to downstream tasks such as retrieval, clustering, and classification. For asymmetric tasks such as retrieval, to achieve better retrieval performance, it is recommended to distinguish between the query text (query) type and the corpus text (document) type. For symmetric tasks such as ingestion, clustering, and classification, you do not need to specify this explicitly; the system default value document is used.dimension integer OptionalWhen calling over HTTP, put dimension into the parameters object.The specified vector dimensions, which must be one of the following values: 2560 (only applies to qwen3.7-text-embedding), 2048 (only applies to text-embedding-v4), 1536 (only applies to text-embedding-v4) 1024, 768, 512, 256, 128, or 64. The default value is 1024.output_type string OptionalWhen calling over HTTP, put output_type into the parameters object.The user-specified discrete vector output only applies to the qwen3.7-text-embedding、``text-embedding-v3 and text-embedding-v4 models. The value can be dense, sparse, or dense&sparse, and the default is dense, which outputs only continuous vectors. Sparse vector output (sparse and dense&sparse) is only supported when called through the DashScope API.instruct string OptionalAdd a custom task description to guide the model in understanding the query intent. It is recommended to write it in English, which typically brings about a 1%–5% performance improvement.This parameter only takes effect when text_type is set to query, and the Token usage is counted 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. |
|
Response objectIn Python SDK 2.0, the fields of the response object returned byrequest_id stringThe unique identifier of the request. It can be used for tracing request details and troubleshooting.embeddingsarrayThe algorithm output of this request, which is an array of structures, each containing the algorithm output for the corresponding input text.
Property sparse_embedding arrayThe discrete vector representation of the algorithm output for the corresponding string (sparse embedding only applies to text-embedding-v3 and text-embedding-v4).
Property index integerThe position index of the word or character in the vocabulary.value floatIndicates the weight or importance score of the Token. A higher value indicates that the Token is more important or relevant in the context of the current text.token stringThe actual text unit or word in the vocabulary.arrayThe continuous vector representation of the algorithm output for the corresponding string (dense embedding).index integerThe index of the input text in the input array that corresponds to the algorithm result in this structure.objectThe token usage of this request. Embedding models only have input and no output, so the values of the fields in this object are always the same.
Property input_tokens integerThe number of Tokens corresponding to the input content of this request. The value is the same as total_tokens.Only qwen3.7-text-embedding returns this parameter. text-embedding-v4, text-embedding-v3, text-embedding-v2, and text-embedding-v1 do not return this parameter.total_tokens integerThe total number of Tokens consumed by this request, used for metering and billing. The Token count is based on the result of the input string parsed by the model Tokenizer, which may differ from the character or word count you estimate on your own.When instruct is set and text_type is set to query, instruct is counted repeatedly in token usage based on the number of input texts.e.status_code (HTTP return code), e.code (error code), e.message (error message), and e.request_id (unique request identifier). For more information, see Error codes. |