General text embedding models convert text data into numerical vectors for downstream tasks such as semantic search, recommendation, clustering, and classification.
Model overview
Singapore
| 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 tokens Validity: within 90 days after Model Studio activation |
text-embedding-v4
| 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 tokens Validity: 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 tokens Validity: within 90 days after Model Studio activation |
Beijing
| Model | Vector dimensions | Maximum rows | Maximum tokens per row | Unit price (per million input tokens) | Supported languages |
|---|---|---|---|---|---|
text-embedding-v4
| 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | $0.072 | 100+ mainstream languages including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian, as well as multiple programming languages |
Hong Kong (China)
| Model | Vector dimensions | Maximum rows | Maximum tokens per row | Unit price (per million input tokens) | Supported languages |
|---|---|---|---|---|---|
text-embedding-v4
| 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, as well as multiple programming languages |
dashscope CLI
Called through the dashscope command line.
export DASHSCOPE_API_KEY="your-api-key"
# Replace {WorkspaceId} with your workspace ID, ap-southeast-1 with your region (e.g., us-east-1, eu-central-1)
export DASHSCOPE_HTTP_BASE_URL="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1"
dashscope embeddings create -m text-embedding-v3 -i "你好世界"
ImportantThe SDK Expert interactive assistant can accomplish the same development and troubleshooting tasks in natural language. See
DashScope SDK Expert.For the complete region list, see Base URL overview.
For model rate limiting, see Rate limiting.
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
Replace {WorkspaceId} with your actual workspace ID when calling.
Request bodymodel The model name to call. Select from the model names in the Model overview table. input The 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:
dimensions The specified vector dimensions, which must be one of the following values: encoding_format Controls the returned embedding format. The input supports
| Input stringPythonJavacurl
Input string listPythonJavacurl
Input filePythonJavacurl
|
Response objectdata Task output information. model The name of the model called. objectstring The type of data returned by this call. The default value is list. usage The Token usage of this request. Embedding models only have input and no output, so idstring The unique identifier of the request. It can be used for tracing request details and troubleshooting. | |
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
Replace {WorkspaceId} with your actual workspace ID when calling.
Request bodymodel The model to call. Select one from the model names in the table in Model overview. input The 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:
text_type
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 dimension
The specified vector dimensions, which must be one of the following values: output_type
The user-specified discrete vector output only applies to the instruct Add 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 | Input stringPythonJavacurl
Input string listPythonJavacurl
Input filePythonJavacurl
|
Response object
request_id The unique identifier of the request. It can be used for tracing request details and troubleshooting. embeddings The algorithm output of this request, which is an array of structures, each containing the algorithm output for the corresponding input text. Property sparse_embedding The discrete vector representation of the algorithm output for the corresponding string (sparse embedding only applies to Property index The position index of the word or character in the vocabulary. value Indicates the weight or importance score of the token The actual text unit or word in the vocabulary. embedding The continuous vector representation of the algorithm output for the corresponding string (dense embedding). index The index of the input text in the input array that corresponds to the algorithm result in this structure. usage The 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. Call FailedWhen a call fails, the SDK throws DashScopeError. You can obtain failure details through | |
Error codes
If a model call fails and returns an error message, see Error codes for troubleshooting.