The general-purpose text embedding model converts text data into numerical vectors for downstream tasks like semantic search, recommendation, clustering, and classification.
Model overview
|
Model |
Embedding dimensions |
Max rows |
Max tokens per line |
Price (per 1K input tokens) |
Supported languages |
Free quota (Note) |
|
text-embedding-v4 Part of the Qwen3-Embedding series |
2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 |
10 |
8,192 |
CNY 0.0005 Batch 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 tokens each Validity: 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 |
||||
|
text-embedding-v2 |
1,536 |
25 |
2,048 |
CNY 0.0007 Batch call: CNY 0.00035 |
Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian |
500,000 tokens each Validity: 90 days after you activate Model Studio |
|
text-embedding-v1 |
Chinese, English, Spanish, French, Portuguese, Indonesian |
For model rate limits, see Rate limiting.
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
Public cloud
The base_url to configure for SDK calls:https://dashscope.aliyuncs.com/compatible-mode/v1
The endpoint to configure for HTTP calls:POSThttps://dashscope.aliyuncs.com/compatible-mode/v1/embeddings
Request body |
Input stringPython
Java
curl
Input string listPython
Java
curl
Input filePython
Java
curlReplace 'texts_to_embedding.txt' with your file name or path.
|
|
model The name of the model to call. See the Model overview table for model names. |
|
|
input The 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:
|
|
|
dimensions The dimension of the output embedding vectors. Must be one of the following values: 2048 (for |
|
|
encoding_format The returned embedding format. Currently, only |
Response object |
Successful response
Error response
|
|
data A list of the resulting embedding objects. |
|
|
model The name of the model used for this call. |
|
|
object string The object type. The value is always |
|
|
usage |
|
|
id string A unique request identifier, used for tracing and troubleshooting. |
DashScope
Public cloud
base_url for SDK calls: https://dashscope.aliyuncs.com/api/v1
Endpoint for HTTP calls: POST https://dashscope.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
Request body |
Input stringPython
Java
curl
Input string listPython
Java
curl
Input filePython
Java
curlReplace 'texts_to_embedding.txt' with your file name or path.
|
|
model The model to use. For a list of available models, see the Model overview table. |
|
|
input The 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.
|
|
|
text_type When making an HTTP call, place text_type in 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 |
|
|
dimension When making an HTTP call, place dimension in the
Specifies the embedding dimension for the output vector. Valid values are 2048 (for |
|
|
output_type When making an HTTP call, place output_type in the
Specifies the output vector type. This parameter applies only to the |
|
|
instruct Provides 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 object |
Successful response
Error response
|
|
status_code The HTTP status code. A value of 200 indicates success. |
|
|
request_id A unique identifier for the request. Use this ID to trace and troubleshoot the request. |
|
|
code The error code returned if the request fails. This field is empty for successful requests. |
|
|
message A detailed error message if the request fails. This field is empty for successful requests. |
|
|
output The result of the task. |
|
|
usage |
Error codes
If a model call fails, see Error Messages.