API reference · Embeddings
Create embeddings
POST
https://api.stav.ai/v1/embeddingsGenerates vector embeddings for one or more inputs. Drop-in for the OpenAI SDK.
Request body
modelstringrequiredinputstring | array of stringrequiredencoding_formatenumfloatbase64dimensionsintegerTruncate to this many dimensions (Matryoshka-style). Only honoured by models that support truncation.
userstring
Notes
POST https://api.stav.ai/v1/embeddings takes the same request as OpenAI's embeddings endpoint.
Request
| Field | Type | Notes |
|---|---|---|
model | string | Required. An embedding model from the catalogue. |
input | string or array of strings | Required. Must not be empty. |
encoding_format | float or base64 | Default float. |
dimensions | integer | Passed to the provider, for models that support shortening. |
user | string | Accepted. |
Response
{
"object": "list",
"data": [{ "object": "embedding", "index": 0, "embedding": [0.012, -0.034, "..."] }],
"model": "mistral/mistral-embed",
"usage": { "prompt_tokens": 9, "total_tokens": 9 }
}
How it differs from chat
- Name the model.
autoand Routers do not apply; Routers serve the chat surfaces only. - Commercial Inference Providers only. Embeddings are served through provider connectors. A model with no priced Provider Endpoint is refused.
- Your key needs the
inference:embeddingsscope. Without it:403 insufficient_scope. - Billing is the same, plus a per-request price where the endpoint has one. Input tokens are charged at catalogue price. Some embedding endpoints are priced per request instead of, or as well as, per token; that amount is shown on the model page ("€0.001 / request") and charged once per call, from the same tariff, as its own line in your usage. An empty balance blocks paid requests. See Credits and billing.
Errors
| Status | When |
|---|---|
400 | input is empty |
403 | The key lacks inference:embeddings |
404 model_not_found | The model is not an embedding model, or has no priced Provider Endpoint. The message lists the embedding models available. |
402 | Not enough credits, or a spend limit was reached |
| Provider status | The provider refused the request; its message is passed through as provider_error |
Full catalogue: Errors.
Response headers
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Per-minute request cap on this key. |
X-RateLimit-Remaining | Requests remaining in the current window. |
X-RateLimit-Reset | Unix timestamp (seconds) when the current window rolls over. |
Errors
| Status | When |
|---|---|
| 400 | Invalid request — malformed JSON, missing required fields, or invalid parameter values. |
| 401 | Missing or invalid API key. |
| 404 | Model id is not in the catalogue, or the caller's key doesn't have access to it. |
| 429 | Per-key or per-IP rate limit exceeded. |
Every error code, what it means and what to do: Errors.