All Products
Search
Document Center

OpenSearch:Text embedding

Last Updated:Aug 21, 2026

This document describes the API parameter configuration for the OpenAI compatible text embedding service.

URL

{host}/compatible-mode/v1/embeddings

host: The endpoint for calling the service. You can call the API service through the Internet or VPC. For more information, see Obtain a service endpoint.

In the left-side navigation pane of the AI Search Open Platform console, click API Keys. Select a target workspace to view the public API endpoint and private API endpoint in the service endpoint section.

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 Text embedding.

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/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "ops-text-embedding-001",
    "input": "AI Search Open 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.