Skip to content

Embeddings API

OpenAI-compatible embedding endpoint for generating vector representations of text.

Endpoint

POST /api/client/v1/embeddings

Request

json
{
  "model": "text-embedding-ada-002",
  "input": "Hello world",
  "request_id": "optional-correlation-id"
}

Parameters

FieldTypeRequiredDescription
modelstringYesEmbedding model key
inputstring | string[]YesText to embed (single or batch)
request_idstringNoClient-provided correlation ID

Response

json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0092, 0.0156, ...]
    }
  ],
  "model": "text-embedding-ada-002",
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2
  },
  "request_id": "req_abc123"
}

Batch Input

json
{
  "model": "text-embedding-ada-002",
  "input": ["Hello world", "How are you?", "Embedding example"]
}

Returns multiple embedding objects indexed by position.

Errors

StatusDescription
400Missing model or input
401Invalid API token
500Model not found
500Model is not configured for embeddings
429Rate limit or quota exceeded
500Provider error (circuit breaker / upstream)

Example

bash
curl -X POST https://gateway.example.com/api/client/v1/embeddings \
  -H "Authorization: Bearer cpeer_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-ada-002",
    "input": "Hello world"
  }'

Community edition is AGPL-3.0. Commercial licensing and support are available separately.