> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routerbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> OpenAI-compatible embeddings endpoint. Returns dense vectors for search, clustering, and RAG.

## Endpoint

```
POST https://routerbase.com/v1/embeddings
```

Drop-in compatible with the OpenAI [Embeddings API](https://platform.openai.com/docs/api-reference/embeddings). Point your existing OpenAI client at `https://routerbase.com/v1` with your RouterBase API key.

## Request Headers

| Header          | Value                       |
| --------------- | --------------------------- |
| `Authorization` | `Bearer sk-rb-xxxxxxxxxxxx` |
| `Content-Type`  | `application/json`          |

## Request Body

<ParamField body="model" type="string" required>
  Embedding model ID, e.g. `openai/text-embedding-3-large`. See the live [Models API](/api-reference/models) for the full list.
</ParamField>

<ParamField body="input" type="string | array" required>
  Text to embed. A single string, or an array of strings to embed in one request.
</ParamField>

<ParamField body="dimensions" type="integer">
  Truncate the output vector to this many dimensions (supported by `text-embedding-3-*`). Defaults to the model's native size.
</ParamField>

<ParamField body="encoding_format" type="string">
  `"float"` (default) returns an array of numbers; `"base64"` returns a base64-encoded vector.
</ParamField>

## Response

```json theme={null}
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0023, -0.0091, "..."] }
  ],
  "model": "openai/text-embedding-3-large",
  "usage": { "prompt_tokens": 11, "total_tokens": 11 }
}
```

<ResponseField name="data" type="array">
  One `embedding` object per input, in request order. `index` matches the position in the `input` array.
</ResponseField>

<ResponseField name="usage" type="object">
  `prompt_tokens` and `total_tokens` for the request. Embeddings have no output tokens; billing is on input tokens only.
</ResponseField>

## Billing

Charged per input token at the model's input rate (no output tokens). See the [pricing page](https://routerbase.com/pricing) or the [Models API](/api-reference/models) for current rates.
