The general-purpose text embedding model converts text data into numerical vectors for downstream tasks like semantic search, recommendation, clustering, and classification.
Model overview
- Singapore
- China (Beijing)
- China (Hong Kong)
| Model | Embedding dimensions | Max rows | Max tokens per line(Note) | Price (per 1M 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 | $0.07 | 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-v4Part of the Qwen3-Embedding series | 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | $0.07 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 100 other major languages | 1 million tokensValidity: 90 days after you activate Model Studio |
| text-embedding-v3 | 1,024 (default), 768, 512 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 50 other major languages | 500,000 tokensValidity: 90 days after you activate Model Studio |
Prerequisites
Users familiar with the OpenAI ecosystem can use the OpenAI-compatible API for a quick migration. The DashScope API provides more unique features.
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
Thebase_urlto configure for SDK calls:
- Singapore: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. Replace
WorkspaceIdwith your actual workspace ID. - China (Beijing): https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
- China (Hong Kong): https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1. Replace
WorkspaceIdwith your actual workspace ID.
endpointto configure for HTTP calls:
- Singapore: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/embeddings. Replace
WorkspaceIdwith your actual workspace ID. - China (Beijing): POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/embeddings
- China (Hong Kong): POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1/embeddings. Replace
WorkspaceIdwith your actual workspace ID.
{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 optionalThe returned embedding format. Currently, only float is supported. |
|
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. The value is always embedding.stringThe name of the model used for this call.objectstringThe object type. The value is always list.usageobject
Property prompt_tokensintegerThe number of tokens in the input text.total_tokens integerThe total number of tokens in the input. This count is determined by how the model's tokenizer parses the input string. |
DashScope
base_urlfor SDK calls:
- Singapore: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1. Replace
WorkspaceIdwith your actual workspace ID. - China (Beijing): https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1
- China (Hong Kong): https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1. Replace
WorkspaceIdwith your actual workspace ID.
- Singapore: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding. Replace
WorkspaceIdwith your actual workspace ID. - China (Beijing): POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
- China (Hong Kong): POST https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding. Replace
WorkspaceIdwith your actual workspace ID.
{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 text to process. The input can be a string, an array of strings, or a file. The supported text length and batch size vary by model version.
stringoptional
When making an HTTP call, place text_typein the 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 optional
When making an HTTP call, place dimensionin the Specifies the embedding dimension for the output vector. Valid values are 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. Defaults to 1024.output_type string optional
When making an HTTP call, place output_typein the Specifies the output vector type. This parameter applies only to the qwen3.7-text-embedding,``text-embedding-v3, and text-embedding-v4 models. Valid values are dense, sparse, and dense&sparse. Defaults to dense, which returns only the dense vector representation.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%. |
|
Response objectstatus_codestringThe HTTP status code. A value of 200 indicates success.request_id stringA unique identifier for the request. Use this ID to trace and troubleshoot the request.code stringThe error code returned if the request fails. This field is empty for successful requests.message stringA detailed error message if the request fails. This field is empty for successful requests.outputobjectThe result of the task.
Properties embeddings arrayThe model's output for the request. This is an array of objects, with each object corresponding to an input text.
Properties sparse_embedding arrayThe sparse vector representation of the corresponding string. This applies only to text-embedding-v3 and text-embedding-v4.
Properties 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.text_index integerThe index of the corresponding text in the input array.object
Properties total_tokens integerThe number of tokens in the input, as calculated by the model's tokenizer. |