Skip to main content
POST
/
api
/
ai
/
embeddings
Generate embeddings
curl --request POST \
  --url https://api.example.com/api/ai/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "google/gemini-embedding-001",
  "input": "Hello world",
  "encoding_format": "float",
  "dimensions": 1
}
'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        123
      ],
      "index": 123
    }
  ],
  "metadata": {
    "model": "text-embedding-ada-002",
    "usage": {
      "promptTokens": 123,
      "completionTokens": 123,
      "totalTokens": 123
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

Embedding model identifier

Example:

"google/gemini-embedding-001"

input
required

Single text input to embed

Example:

"Hello world"

encoding_format
enum<string>
default:float

The format to return the embeddings in. Can be either float or base64.

Available options:
float,
base64
dimensions
integer

The number of dimensions the resulting output embeddings should have. Only supported in certain models.

Required range: x >= 0

Response

Embeddings generated successfully

object
enum<string>

Object type, always "list"

Available options:
list
data
object[]
metadata
object