Embeddings
Create vector embeddings through the OpenAI-compatible endpoint.
https://onerouter.com/v1/embeddingsTroubleshooting
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
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string · required | required | Bearer token, formatted as `Bearer YOUR_API_KEY`. |
| Content-Type | string · required | required | Must be `application/json`. |
Request body
| Parameter | Type | Required | Description | Values |
|---|---|---|---|---|
| model | string | required | Embedding model ID, e.g. `openai/text-embedding-3-large`. | |
| input | string | array | required | Text or list of texts to embed. Arrays return one vector per item, in order. | |
| encoding_format | string | optional | Vector encoding: `float` (default) or `base64` for compact transport. | floatbase64 |
| dimensions | integer | optional | Reduce the output vector to this many dimensions on models that support it. | |
| user | string | optional | Stable 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).