Embeddings
Create one or more OpenAI-compatible vector embeddings.
POST /v1/embeddings
Creates embeddings synchronously. The selected model must expose an OpenAI-compatible embedding endpoint.
POST /v1/embeddings
Authorization: Bearer $API_KEY
Content-Type: application/jsonRequest body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Complete public embedding model ID. |
input | string, string[], integer[], or integer[][] | Yes | One input, a batch, token IDs, or a batch of token-ID arrays. Empty values are rejected. |
dimensions | integer | No | Requested output dimension when supported by the model. |
encoding_format | float or base64 | No | Vector representation. |
user | string | No | Stable end-user identifier supported by compatible providers. |
The gateway validates only the non-empty input shape. Per-input token limits, batch limits, total-token limits, dimension support, and additional compatible fields are validated by the selected upstream model.
For current OpenAI embedding models, each input is limited to 8,192 tokens, a request can contain at most 2,048 inputs, and all inputs together can contain at most 300,000 tokens. Other compatible models can impose different limits.
Client routing fields and paid service-tier selections are rejected. Embeddings do not support streaming.
Examples
curl "http://127.0.0.1:11113/v1/embeddings" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog",
"encoding_format": "float"
}'Response
With encoding_format: "float", each embedding is an array of numbers:
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.0023064255, -0.009327292],
"index": 0
}
],
"model": "openai/text-embedding-3-small",
"usage": {
"prompt_tokens": 9,
"total_tokens": 9
}
}With encoding_format: "base64", embedding is a base64-encoded float vector. Batch results preserve input order through index. The response model is rewritten to the public model ID.
Vector values are returned in full but replaced with placeholders in stored request bodies. Billing uses input-token usage; if a compatible upstream omits usage, the gateway falls back to its admission estimate rather than recording a zero-token call.
Help us improve this page
Found something unclear, outdated, or incorrect?
Last updated on