Embeddings
Create vector embeddings through the OpenAI-compatible endpoint.
Use POST /v1/embeddings to create one or more vector embeddings. The endpoint is synchronous and accepts the same request shapes as OpenAI's Embeddings API.
Model IDs
Use the public model ID shown on the Models page, such as
openai/text-embedding-3-small. The gateway keeps upstream model IDs private.
Request
POST /v1/embeddings
Authorization: Bearer $API_KEY
Content-Type: application/json| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Public embedding model ID. |
input | string, string[], number[], or number[][] | Yes | Text, a batch of texts, token IDs, or a batch of token-ID arrays. Values cannot be empty. |
dimensions | number | No | Requested output dimensions. Support depends on the selected model. |
encoding_format | float or base64 | No | Output vector encoding. |
user | string | No | Your stable end-user identifier for abuse monitoring. |
For OpenAI embedding models, each input can contain up to 8,192 tokens, a batch can contain up to 2,048 inputs, and all inputs together can contain up to 300,000 tokens. The selected upstream model remains authoritative for limits and support for dimensions.
Client-supplied provider, routing, and route fields are rejected. Routing and failover are managed by the platform.
Examples
The examples call http://127.0.0.1:11113/v1/embeddings directly.
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 jumped 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": 8,
"total_tokens": 8
}
}With encoding_format: "base64", embedding is a base64-encoded float vector instead. Batch results preserve input order through the index field.
Usage and billing
Embedding models are billed by input tokens. The gateway records usage.prompt_tokens as input-token usage, applies the model price configured on the Models page, and exposes the final usage and amount in request logs. Embedding values themselves are returned to you but omitted from stored request logs.
Help us improve this page
Found something unclear, outdated, or incorrect?
Last updated on