Text Embedding is a multilingual, unified text embedding model developed by Tongyi Lab based on large language models (LLMs). It supports multiple mainstream languages and provides efficient embedding services for text data. This model is suitable for natural language processing tasks, such as retrieval-augmented generation (RAG), text classification, and sentiment analysis.
Model overview
Singapore
Model | Vector dimension | Maximum rows | Maximum tokens per row (Note) | Unit price (Million input tokens) | Supported languages | Free quota(Note) |
text-embedding-v3 | 1,024 (default), 768, 512 | 10 | 8,192 | $0.07 | More than 50 mainstream languages, such as Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian | 1 million tokens Validity period: 180 days after Model Studio is activated |
China (Beijing)
Model | Vector dimension | Maximum rows | Maximum tokens per row | Unit price (Million input tokens) | Supported languages |
text-embedding-v4 Qwen3-Embedding series | 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | $0.072 | More than 100 mainstream languages, such as Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian, and multiple programming languages |
For information about model rate limits, see Rate limits.
Prerequisites
You must have obtained an API key and set the API key as an environment variable. If you want to call through SDK, you must also install the DashScope SDK.
OpenAI compatible
base_url for SDK:
Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
China (Beijing): https://dashscope.aliyuncs.com/compatible-mode/v1
Endpoint for HTTP:
Singapore: POST https://dashscope-intl.aliyuncs.com/compatible-mode/v1/embeddings
China (Beijing): POST https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings
Request body | StringPython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings.
String listPython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings.
FilePython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings. Make sure that you replace 'texts_to_embedding.txt' with your file name or path.
|
model The model to call. You can select | |
input The input text. The value can be a string, a list of strings, or a file. Each line in the file represents a piece of content to be embedded. Text limits:
| |
dimension The dimension of the output vector. This parameter applies only to text-embedding-v3 and text-embedding-v4. You can set this parameter to one of the following values: 2048 (for text-embedding-v4 only), 1536 (for text-embedding-v4 only), 1024, 768, 512, 256 (for text-embedding-v4 only), 128 (for text-embedding-v4 only), or 64 (for text-embedding-v4 only). The default value is 1024. | |
encoding_format The format of the returned embedding. Currently, only the |
Response object | Successful response
Error response
|
data The output of the task. | |
model The name of the model that was called. | |
object string The type of the returned data. The default value is list. | |
usage | |
id string The unique ID of the request. You can use this ID to trace request details and troubleshoot issues. |
DashScope
base_url for SDK:
Singapore: https://dashscope-intl.aliyuncs.com/api/v1
China (Beijing): https://dashscope.aliyuncs.com/api/v1
Endpoint for HTTP:
Singapore: POST https://dashscope-intl.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
China (Beijing): POST https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
Request body | StringPython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding.
String listPython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding.
FilePython
Java
curlIf you use a model in the China (Beijing) region, you must use the API key of the China (Beijing) region, set the model to text-embedding-v4, and replace the URL with https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding. Make sure that you replace 'texts_to_embedding.txt' with your file name or path.
|
model The model to call. You can select | |
input The input text. The value can be a string, a list of strings, or a file. Each line in the file represents a piece of content to be embedded. Text limits:
| |
text_type After text is converted into vectors, it can be used for downstream tasks such as retrieval, clustering, and classification. For asymmetric tasks, such as retrieval, we recommend that you distinguish between query text (query) and document text (document) to achieve better results. For symmetric tasks such as clustering and classification, you do not need to specify this parameter. The default value is | |
dimension The dimension of the output vector. This parameter applies only to text-embedding-v3 and text-embedding-v4. You can set this parameter to one of the following values: 2048 (for text-embedding-v4 only), 1536 (for text-embedding-v4 only), 1024, 768, 512, 256 (for text-embedding-v4 only), 128 (for text-embedding-v4 only), or 64 (for text-embedding-v4 only). The default value is 1024. | |
output_type The discrete vector representation of the output. This parameter applies only to text_embedding_v3 and text_embedding_v4. Valid values are dense, sparse, and dense&sparse. The default value is dense, which means that only continuous vectors are output. | |
instruct Custom task instructions. This parameter takes effect only when you use the |
Response object | Successful response
Error response
|
status_code The status code, which indicates the execution result of the request. For example, a value of 200 indicates that the request was successful. | |
request_id The unique ID of the request. You can use this ID to trace request details and troubleshoot issues. | |
code An error code that is returned if the request fails. If the request is successful, this parameter is empty. | |
message Detailed information that is returned if the request fails. If the request is successful, this parameter is empty. | |
output The output of the task. | |
usage | |
request_id The unique ID of the request. You can use this ID to trace request details and troubleshoot issues. |
Error codes
If a model call failed and an error message is returned, see Error messages for troubleshooting.