POST
/
v1
/
embeddings
curl -X POST https://api.example.com/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-large",
    "input": "The quick brown fox jumps over the lazy dog."
  }'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        0.0023064255,
        -0.009327292,
        0.015797347,
        -0.0028842222
      ],
      "index": 0
    }
  ],
  "model": "text-embedding-3-large",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
Related guide: Embeddings
Creates an embedding vector representing the input text.

Request Parameters

model
string
required
ID of the model to use. You can use the List models API to see all available models.
input
string | array
required
Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed 8192 tokens per input.
encoding_format
string
default:"float"
The format to return the embeddings in. Can be either float or base64.
dimensions
integer
The number of dimensions the resulting output embeddings should have. Only supported in certain models.

Response

object
string
The object type, always list.
data
array
List of embedding objects.Each object contains:
  • object (string): The object type, which is embedding
  • embedding (array): The embedding vector
  • index (integer): The index of the embedding in the list
model
string
The model used for embedding.
usage
object
Usage statistics for the embedding request.
curl -X POST https://api.example.com/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-large",
    "input": "The quick brown fox jumps over the lazy dog."
  }'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        0.0023064255,
        -0.009327292,
        0.015797347,
        -0.0028842222
      ],
      "index": 0
    }
  ],
  "model": "text-embedding-3-large",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}