The AI Search Open Platform supports calling text embedding services via API. You can use these services to convert text data into dense vector representations, suitable for scenarios such as information retrieval, text classification, and similarity comparison.
Service name | Service ID | Service description | QPS limit for API calls (Alibaba Cloud account and RAM users) |
OpenSearch text vectorization service -001 | ops-text-embedding-001 |
| 50 Note To apply for higher QPS, submit a ticket. |
OpenSearch Text Embedding Service-Chinese-001 | ops-text-embedding-zh-001 |
| |
OpenSearch Text Embedding Service-English-001 | ops-text-embedding-en-001 |
| |
OpenSearch General Text Embedding Service-002 | ops-text-embedding-002 | This model offers enhanced language support and improved performance in retrieval tasks compared to the 001 model.
| |
GTE Text Embedding-Multilingual-Base | ops-gte-sentence-embedding-multilingual-base |
| |
Qwen3 Text Embedding-0.6B | ops-qwen3-embedding-0.6b | Qwen3 series multilingual (100+) text embedding service.
|
Prerequisites
The authentication information is obtained.
When you call an AI Search Open Platform service by using an API, you need to authenticate the caller's identity.
The service access address is obtained.
You can call a service over the Internet or a virtual private cloud (VPC). For more information, see Get service registration address.
Request description
General description
The maximum request body size must not exceed 8 MB.
Request method
POST
URL
{host}/v3/openapi/workspaces/{workspace_name}/text-embedding/{service_id} host: The service endpoint, which supports API calls over the Internet and through a VPC. For more information, see Obtain a service endpoint.
workspace_name: The name of the workspace, such as 'default'.
service_id: The system built-in service ID, such as 'ops-text-embedding-001'.
Request parameters
Header parameters
API-KEY authentication
Parameter | Type | Required | Description | Example value |
Content-Type | String | Yes | Request type: application/json | application/json |
Authorization | String | Yes | API-Key | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Description | Example value |
input | Array/String | Yes | The content to be processed. It supports multiple text inputs, with a maximum of 32 per request. The length of each input is model-dependent. Empty strings are not accepted. | ["Science and technology are the primary productive forces","opensearch product documentation"] |
input_type | String | No | The data type of the input
| document |
Response parameters
Parameter | Type | Description | Example value |
request_id | String | The request ID. | B4AB89C8-B135-****-A6F8-2BAB801A2CE4 |
latency | Float/Int | The request duration in milliseconds. | 10 |
usage | Object | Metering information generated by this call. | "usage": { "token_count": 3072 } |
usage.token_count | Int | The number of tokens. | 3072 |
result.embeddings | List | The output embedding content, an array of results. | [{ "index": 0, "embedding": [0.003143,0.009750,...,-0.017395] }, {}] |
result.embeddings[].index | Int | The ordinal number corresponding to the input text. | 0 |
result.embeddings[].embedding | List(Float) | The vectorized result. | [0.003143,0.009750,...,-0.017395] |
Curl request example
curl -XPOST -H"Content-Type: application/json"
"http://****-hangzhou.opensearch.aliyuncs.com/v3/openapi/workspaces/default/text-embedding/ops-text-embedding-001"
-H "Authorization: Bearer your API-KEY"
-d "{
\"input\": [
\"Science and technology are the primary productive forces\",
\"opensearch product documentation\"
],
\"input_type\": \"query\"
}"Response example
Normal response example
{
"request_id": "B4AB89C8-B135-****-A6F8-2BAB801A2CE4",
"latency": 38,
"usage": {
"token_count": 3072
},
"result": {
"embeddings": [
{
"index": 0,
"embedding": [
-0.02868066355586052,
0.022033605724573135,
-0.0417383536696434,
-0.044081952422857285,
0.02141784131526947,
-8.240503375418484E-4,
-0.01309406291693449,
-0.02169642224907875,
-0.03996409475803375,
0.008053945377469063,
...
-0.05131729692220688,
-0.016595875844359398
]
}
]
}
}Abnormal response example
If the request encounters an error, the response will detail the cause with a specific code and message.
{
"request_id": "651B3087-8A07-****-B931-9C4E7B60F52D",
"latency": 0,
"code": "InvalidParameter",
"message": "JSON parse error: Cannot deserialize value of type `InputType` from String \"xxx\""
}Status code description
For more information, see Status codes.