Embeddings
Turn text into vectors for search, clustering and retrieval.
POST /v1/embeddings takes the OpenAI embeddings request and returns the OpenAI response shape.
The OpenAI SDK's embeddings.create works by pointing it at https://api.opinference.com/v1.
curl https://api.opinference.com/v1/embeddings \
-H "Authorization: Bearer $OP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-embedding-8b",
"input": ["The food was delicious", "The service was slow"]
}'{
"id": "gen_01J...",
"object": "list",
"model": "qwen/qwen3-embedding-8b",
"provider": "Nebius",
"data": [
{"object": "embedding", "index": 0, "embedding": [0.0023, -0.0091, ...]},
{"object": "embedding", "index": 1, "embedding": [0.0114, 0.0042, ...]}
],
"usage": {"prompt_tokens": 10, "total_tokens": 10}
}Find embedding models in GET /v1/models: their modality is
embeddings. They are priced per input token; there are no output tokens.
Request
| Field | Notes |
|---|---|
model | Required. An embedding model id |
input | Required. A string, an array of strings, an array of token ids, or an array of token-id arrays. Not empty |
encoding_format | float (default) or base64. With base64 each embedding is a string |
dimensions | A positive integer, for models that can shorten their vectors. A model that cannot answers with an error |
models | Other models that may answer. See Fallbacks. Vectors from different models are not comparable, so only list models you will not mix in one index |
provider | Routing preferences. See Provider preferences |
op | Retention and tags. See Data retention |
Other fields, including user and provider-specific fields such as input_type, are not sent to
the provider. The route never streams.
A fallback provider always serves the same model you asked for, so a vector never comes from a
different model unless you listed it in models.
Errors
| Status | code | When |
|---|---|---|
| 400 | invalid_request | model or input is missing or empty, encoding_format is not float or base64, or dimensions is not a positive integer. param names the field |
| 404 | model_not_found, no_endpoint_available | The model is unknown, or no provider can serve the request |
| 502 | provider_empty_response | Every provider answered with no vectors |
| 502, 504 | provider_unavailable, upstream_timeout | Every provider failed |
Authentication, budget, rate-limit and idempotency errors are the same as for chat completions. See Errors.