Synchronous API
The general-purpose text embedding model converts text data into numerical vectors for downstream tasks like semantic search, recommendation, clustering, and classification.
Model overview
Beijing
| Model | Embedding dimensions | Max rows | Maxtokensper line | Price (per 1K 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 | CNY 0.0005 Batch call: CNY 0.00025 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 200 other major languages and dialects | 1 million tokens Validity: 90 days after you activate Model Studio |
qwen3.7-text-embedding-flash | 1,024 (default), 768, 512, 256 | 20 | 128,000 | CNY 0.000125 Batch call: CNY 0.000063 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 200 other major languages and dialects | 1 million tokens Validity: 90 days after you activate Model Studio |
text-embedding-v4
| 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 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 | No free quota | |||
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 | No free quota |
text-embedding-v1 | Chinese, English, Spanish, French, Portuguese, Indonesian |
Singapore
| Model | Embedding dimensions | Max rows | MaxTokenper line | Price (per 1K input tokens) | Supported languages | Free quota |
|---|---|---|---|---|---|---|
qwen3.7-text-embedding | 2,560, 2,048, 1,536, 1,024 (default), 768, 512, 256 | 20 | 128,000 | CNY 0.000525 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 200 other major languages and dialects | No free quota |
text-embedding-v4
| 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64 | 10 | 8,192 | CNY 0.000514 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 100 other major languages, plus multiple programming languages | No free quota |
text-embedding-v3 | 1,024 (default), 768, 512 | Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, Russian, and over 50 other major languages | No free quota |
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. Choose the one that suits your needs.
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 when calling with the SDK:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
The endpoint to configure when calling over HTTP:POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/embeddings
Replace {WorkspaceId} with your actual workspace ID.
Request bodymodel 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: encoding_format Controls the format of the returned embeddings. The input parameter supports
| Input stringImportantThe SDK Expert interactive assistant can accomplish the same development and troubleshooting in natural language. See DashScope SDK Expert.Input string listInput filePythonJavacurl
|
Response objectdata A list of the resulting embedding objects. model The name of the model used for this call. objectstring The type of the data returned by this call. The default value is list. usage Token usage. idstring A unique request identifier, used for tracing and troubleshooting. | |
DashScope
Public cloud
The base_url to configure when calling with the SDK:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1
Endpoint for HTTP calls: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/embeddings/text-embedding/text-embedding
Replace {WorkspaceId} with your actual workspace ID.
Request bodymodel The model to use. For a list of available models, see the Model overview table. 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:
text_type
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
The dimension of the output embedding vectors. Must be one of the following values: output_type
Specifying discrete vector output 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%. This parameter takes effect only when | Input stringInput string listInput filePythonJavacurl
|
Response object
request_id A unique request identifier, used for tracing and troubleshooting. embeddings The model's output for the request. This is an array of objects, with each object corresponding to an input text. Property sparse_embedding The sparse vector representation of the corresponding string. This applies only to Property index The index of the token in the vocabulary. value Indicates the weight or importance score of the token The text of the token. embedding The dense vector representation for the corresponding string. index The index of the corresponding input text in the input array. usage Token usage. When a call fails, the SDK raises DashScopeError; you can obtain the failure details via | |
Error codes
If a model call fails, see Error Messages.