This document describes the API parameter configuration for the OpenAI compatible text embedding service.
URL
{host}/compatible-mode/v1/embeddingshost: The endpoint for calling the service. You can call the API service through the Internet or VPC. For more information, see Query service endpoint.

Request parameters
Parameter | Type | Required | Description | Example value |
model | String | Yes | The specified service ID. System service ID starts with 'ops-'. For a list of supported service IDs, see List of supported services. | ops-text-embedding-001 |
input | Array/String | Yes | Supports multiple text inputs, with a maximum of 32 per request; the 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 value |
data | List | Provides the data information. | - |
data.embedding | Array[float] | The embedding processing result, returning an array of vectors. | [ 0.003143, 0.009750, ... (1536 floats in total for ops-text-embedding-001), -0.017395 ] |
data.index | Int | The ordinal number corresponding to the index in the request input, starting from 0. | 0 |
data.object | String | The static value 'embedding'. | embedding |
object | String | The response type, static value 'list'. | list |
model | String | The service ID specified in the request. | ops-text-embedding-001 |
usage | Object | Statistics on token usage for this model invocation. | - |
usage.prompt_tokens | Int | The number of tokens generated from the user's request input. | 5 |
usage.total_tokens | Int | The total number of tokens used, which is the sum of usage.prompt_tokens and usage.completion_tokens. | 5 |
CURL example
curl http://xxxx-shanghai.opensearch.aliyuncs.com/compatible-mode/v1/chat/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Your-API-Key" \
-d '{
"model": "ops-text-embedding-001",
"input": "Search development platform"
}'Response example
{
"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 more information, see Status code description in AI Search Open Platform.