Create embeddings

curl https://your-gateway/v1/embeddings \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The quick brown fox jumps over the lazy dog"
  }'

Request body

FieldTypeRequiredDescription
modelstringYesLogical model name (must be an embedding model)
inputstring or arrayYesText or array of texts to embed
encoding_formatstringNofloat (default) or base64

Response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [0.0023, -0.0091, 0.0156, ...],
      "index": 0
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 9,
    "total_tokens": 9
  }
}

Provider support

The gateway automatically translates embedding requests for providers that use a different wire format:
ProviderNotes
openai, mistral, groq, fireworks, ollama, togetherNo translation needed (OpenAI-compatible)
gemini, vertexTranslated to/from batchEmbedContents
cohereTranslated to/from /v2/embed
anthropic, bedrock, deepseek, perplexity, xaiEmbeddings not supported

Batch embedding

Embed multiple texts in a single request by passing an array:
{
  "model": "text-embedding-3-small",
  "input": [
    "First text to embed",
    "Second text to embed",
    "Third text to embed"
  ]
}