OP Inference

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

FieldNotes
modelRequired. An embedding model id
inputRequired. A string, an array of strings, an array of token ids, or an array of token-id arrays. Not empty
encoding_formatfloat (default) or base64. With base64 each embedding is a string
dimensionsA positive integer, for models that can shorten their vectors. A model that cannot answers with an error
modelsOther models that may answer. See Fallbacks. Vectors from different models are not comparable, so only list models you will not mix in one index
providerRouting preferences. See Provider preferences
opRetention 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

StatuscodeWhen
400invalid_requestmodel or input is missing or empty, encoding_format is not float or base64, or dimensions is not a positive integer. param names the field
404model_not_found, no_endpoint_availableThe model is unknown, or no provider can serve the request
502provider_empty_responseEvery provider answered with no vectors
502, 504provider_unavailable, upstream_timeoutEvery provider failed

Authentication, budget, rate-limit and idempotency errors are the same as for chat completions. See Errors.

On this page