Embeddings

Create vector embeddings through the OpenAI-compatible endpoint.

POSThttps://onerouter.com/v1/embeddings

Troubleshooting

Errors carry an HTTP status and a JSON error body. See Errors & Retries for the full list.

Model availability

Pass any embedding model ID supported by the upstream in the model field, e.g. openai/text-embedding-3-large. Embedding models are not listed on the website model catalog (which focuses on chat, image, and audio), so confirm the exact ID with your provider or by calling GET /v1/models.

Overview

The Embeddings endpoint is compatible with OpenAI's embeddings API. It turns text into a fixed-length vector of floats that captures meaning, so you can power semantic search, clustering, classification, deduplication, and retrieval-augmented generation. Pass a single string or an array of strings; arrays return one vector per item, in order.

Request headers

ParameterTypeRequiredDescription
Authorizationstring · requiredrequiredBearer token, formatted as `Bearer YOUR_API_KEY`.
Content-Typestring · requiredrequiredMust be `application/json`.

Request body

ParameterTypeRequiredDescriptionValues
modelstringrequiredEmbedding model ID, e.g. `openai/text-embedding-3-large`.
inputstring | arrayrequiredText or list of texts to embed. Arrays return one vector per item, in order.
encoding_formatstringoptionalVector encoding: `float` (default) or `base64` for compact transport.
floatbase64
dimensionsintegeroptionalReduce the output vector to this many dimensions on models that support it.
userstringoptionalStable end-user identifier for abuse monitoring.

The response

Returns a list of embedding objects (see the panel on the right). Each data[i].embedding is the vector for the matching input, and usage reports the input token count. Vector length depends on the model (and the dimensions parameter if set).