Generates vector embeddings for one or more text inputs using the OpenSearch compatible mode embedding service.
Endpoint
POST {host}/compatible-mode/v1/embeddingshost: The endpoint for the service. The service is accessible over the Internet or a Virtual Private Cloud (VPC). To get your endpoint, see Query service endpoint.

Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
model | String | Yes | The service ID to use. System service IDs start with ops-. For supported service IDs, see List of supported services. | ops-text-embedding-001 |
input | Array/String | Yes | The text to embed. Accepts a single string or an array of strings. Maximum 32 inputs per request. The maximum length of each input depends on the selected model. Empty strings are not accepted. | ["Science and technology are the primary productive forces", "OpenSearch product documentation"] |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
data | List | The embedding results. | — |
data.embedding | Array[float] | The embedding vector for the input at the corresponding index. ops-text-embedding-001 returns 1536 floats. | [0.003143, 0.009750, ..., -0.017395] |
data.index | Int | The position of this result in the request input array, starting from 0. | 0 |
data.object | String | The object type. Always embedding. | embedding |
object | String | The response type. Always list. | list |
model | String | The service ID specified in the request. | ops-text-embedding-001 |
usage | Object | Token usage statistics for this request. | — |
usage.prompt_tokens | Int | The number of tokens in the request input. | 5 |
usage.total_tokens | Int | The total number of tokens used (usage.prompt_tokens + usage.completion_tokens). | 5 |
Example
Request
curl http://xxxx-shanghai.opensearch.aliyuncs.com/compatible-mode/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-api-key>" \
-d '{
"model": "ops-text-embedding-001",
"input": "Search development platform"
}'Response
{
"id": "9085118afe14bee71d59c4a609fcf7c0",
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0021381378173828125,
0.12109375,
...,
-0.0389404296875
],
"index": 0
}
],
"model": "ops-text-embedding-001",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}Status codes
For status code descriptions, see Status code description.