Embeddings
Create embeddings through the gateway with routing, fallback, budgets and usage tracking
OpenAI-compatible embeddings. Calls to this endpoint go through the same API keys, budgets, usage limits and usage reporting as chat requests, so agents and apps that embed text show up in your usage data instead of bypassing it.
The request body is forwarded to the provider as raw JSON and the provider's response comes back unchanged. That keeps encoding_format: "base64" (each data[].embedding is then a base64 string, not an array) and token-array input working as the OpenAI API defines them.
Choosing a model
Use a model from GET /v1/models whose output is embedding, in author/model format, for example openai/text-embedding-3-large. Embedding models appear in the console with an Embedding badge.
The two kinds of model are not interchangeable: an embedding model sent to a chat endpoint, or a chat model sent to /v1/embeddings, is rejected with a 400 and the code model_not_supported.
Vector size
Pass dimensions to choose the vector size on models that support it, such as the OpenAI text-embedding-3 models. There is no fixed-size model id: text-embedding-3-large with dimensions: 1536 is the way to get 1536-dimension vectors.
Gemini embedding models do not accept dimensions through the gateway. A request that includes it returns a 400 rather than a vector of a different size than the one you asked for.
Fallback
If a provider fails, the gateway retries and then falls back to another provider of the same model. It never falls back to a different model, and routing strategies do not reroute this endpoint, because vectors from different models are not comparable. The X-Edgee-Provider response header names the provider that served the request, and X-Edgee-Fallback-Used is present when a fallback served it.
Usage and cost
Usage is recorded from the provider's usage.prompt_tokens. Gemini's embeddings endpoint reports no usage, so for Gemini the gateway counts the input tokens with Gemini's countTokens and returns that count in usage. Embeddings are billed on input tokens only, so output, cached and reasoning cost are always zero. Requests count against the same organization budgets and usage limits as chat requests.
Debug logs
When debug logging is enabled for a request, the vectors in the response are replaced by a size marker such as [redacted: 1536 floats] before the log is stored. The request input is kept.
Create embeddings for one or more inputs, OpenAI-compatible. The request body is forwarded as raw JSON and the provider's response is returned unchanged, apart from `usage` being filled in when the provider reports none (Gemini), so `encoding_format: base64` (the vector comes back as a base64 string) and token-array inputs keep working. Only models whose output is `embedding` are accepted here, and embedding models are rejected on the chat endpoints. Fallback only crosses providers of the same model, never to a different model, because vectors from different models are not comparable. Usage and cost are recorded on input tokens only. `dimensions` is honored by OpenAI `text-embedding-3` models; Gemini embedding models reject it with a 400.
https://edgee.io/v1/embeddingsTry this endpoint
Configure your request, then run the curl command in your terminal or send it from this page.
Run in your terminal
Set EDGEE_API_KEY to your Gateway API key in your terminal, then copy and run this command. Gateway requests may consume credits.
curl --include --no-buffer --globoff --request POST 'https://edgee.io/v1/embeddings' \
--header "Authorization: Bearer $EDGEE_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "openai/text-embedding-3-large",
"input": "The quick brown fox",
"dimensions": 1536
}'Send from browser
Your request is relayed through the Edgee documentation server to the Gateway. Your key is used only for this request and is not stored.
Authentication
Use an Edgee Gateway API key. Send it as Authorization: Bearer <key>.
Request body
modelstringrequiredEmbedding model identifier from GET /v1/models, in author/model format, or a configured global alias. Append :provider to request a specific provider route.
inputunionrequiredText to embed: a string, an array of strings, or (OpenAI only) a token array or array of token arrays. At most 2048 items; each input is limited by the model's context size.
Show schema
stringstringintegerintegerencoding_formatstringFormat of each returned vector. With `base64`, `data[].embedding` is a base64 string of little-endian float32 values.
dimensionsintegerOutput vector size. Supported by OpenAI `text-embedding-3` models; Gemini embedding models reject it with a 400.
userstringOptional end-user identifier forwarded to the provider.
tagsarrayGateway extension: tags recorded on the usage row. Removed before the request reaches the provider.
Show schema
string{
"model": "openai/text-embedding-3-large",
"input": "The quick brown fox",
"dimensions": 1536
}Responses
200Embeddings created successfully. The body is the provider's response, with `usage` filled in when the provider reports none.
application/json
objectstringmodelstringModel name as reported by the provider.
dataarrayShow schema
objectstringindexintegerembeddingunionThe vector: an array of floats, or a base64 string when `encoding_format` is `base64`.
Show schema
numberstringusageobjectInput tokens only; embeddings have no output tokens and are billed on input. Counted by the gateway when the provider reports none (Gemini).
Show schema
prompt_tokensintegertotal_tokensinteger{
"object": "list",
"model": "text-embedding-3-large",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.0023064255,
-0.009327292
]
}
],
"usage": {
"prompt_tokens": 4,
"total_tokens": 4
}
}400Malformed request, a model that does not produce embeddings, an invalid/disabled model or provider, or a parameter the provider rejects (for example `dimensions` on a Gemini embedding model).
application/json
OpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category, including billing_error for exhausted Edgee credits (HTTP 402).
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, credit_balance_exhausted, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
401Missing or invalid API credentials.
application/json
OpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category, including billing_error for exhausted Edgee credits (HTTP 402).
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, credit_balance_exhausted, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
403Key inactive, expired, model restriction or other permission failure.
application/json
OpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category, including billing_error for exhausted Edgee credits (HTTP 402).
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, credit_balance_exhausted, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
429Usage limit or routing-strategy budget exhausted, or provider rate limit.
application/json
OpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category, including billing_error for exhausted Edgee credits (HTTP 402).
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, credit_balance_exhausted, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.
502Upstream provider failure, or no provider is available for the model.
application/json
OpenAI-shaped Gateway error. Native upstream errors can retain provider-specific details.
errorobjectrequiredShow schema
messagestringrequiredA human-readable error message.
typestringrequiredHigh-level error category, including billing_error for exhausted Edgee credits (HTTP 402).
codestringMachine-readable error code, for example unauthorized, invalid_json, bad_model_id, model_disabled, provider_disabled, credit_balance_exhausted, usage_limit_exceeded, usage_unavailable, provider_error or internal_error. Not an exhaustive enum.
paramstringName of the request parameter that caused the error, when applicable.