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
| 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 each 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 | |
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 | |
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
Thebase_urlto configure for SDK calls:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
Theendpointto configure for HTTP calls: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 The returned embedding format. Currently, only | 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 object type. The value is always usage Token usage. idstring A unique request identifier, used for tracing and troubleshooting. | |
DashScope
Public cloud
base_urlfor SDK calls: 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 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
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
Specifies the embedding dimension for the output vector. Valid values are output_type
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%. | Input stringInput string listInput filePythonJavacurl
|
Response objectstatus_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 Token usage. | |
Error codes
If a model call fails, see Error Messages.