Skip to content
中文

POST /v1/embeddings

Method: POSTEndpoint: /v1/embeddings

Get a vector representation of the given input that can be used easily by machine-learning models and algorithms.

Related Guide: Embeddings

Create an embedding vector representing the input text.

Request Parameters

Header Parameters

text
Authorization
string
Optional
Default Value:
Bearer {{YOUR_API_KEY}}

Body Parameters application/json

text
model
string
Required
The ID of the model to use. You can use
List models
the API to view all available models, or review our
model overview
to understand their descriptions.
input
array
[object]
Required
Input text for embeddings, encoded either as a string or as an array of tokens. To request embeddings for multiple inputs in one call, pass an array of strings or an array of token arrays. Each input must not exceed 8192 tokens.
text
string
Required
image
string
Required
normalized
boolean
Required
embedding_type
string
Required
Example
{
"model"
:
"string"
,
"input"
:
[
{
"text"
:
"string"
,
"image"
:
"string"
}
]
,
"normalized"
:
true
,
"embedding_type"
:
"string"
}

Example Request

Shell

bash
curl --location --request POST '/v1/embeddings' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "string",
    "input": [
        {
            "text": "string",
            "image": "string"
        }
    ],
    "normalized": true,
    "embedding_type": "string"
}'

Response

🟢 200 Create embeddings

Content Type: application/json

Response Schema

text
object
string
Required
data
array
[object]
Required
object
string
Optional
embedding
array
[number]
Optional
index
integer
Optional
model
string
Required
usage
object
Required
prompt_tokens
integer
Required
total_tokens
integer
Required