# Create embeddings

Turns texts (or token IDs, or multimodal inputs for models that accept media) into
embedding vectors, one per input in the order of `input`. Same format as OpenRouter and
OpenAI; `usage.cost` is the EUR cost of the successful result attempt across its batches.
Confirmed paid costs of earlier failed attempts remain charged and are additionally
included in generation lookup and the durable billing receipt.

The gateway picks a European provider of the model (respecting `provider` preferences) and,
if it fails, tries the next one. The body is validated completely before any provider is
called; every problem is listed in `error.metadata.issues`. Unknown parameters are ignored
and named in `x-ignored-params`. Responses are bounded like chat responses (32 MiB, see
"Limits"): large batches of long vectors fit better with `encoding_format: base64`.

Administrative PII requirements are checked for each actual route, including fallbacks
and retries. This endpoint cannot redact its input: a matching requirement returns
`invalid_parameter` with a `not_available` issue at `$.model` before provider I/O.

`POST https://api.tokenlane.de/v1/embeddings`

## Authorizations

[
  [
    {
      "name": "Authorization",
      "description": "API key as bearer token in the `Authorization` header: `Authorization: Bearer sk-tl-v1-…`. Existing `sk-eu-` keys remain valid. Missing, unknown or expired keys get 401 `authentication`.",
      "type": "http bearer",
      "location": "",
      "scopes": []
    }
  ]
]

## curl

```curl
curl --request POST \
  --url 'https://api.tokenlane.de/v1/embeddings' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "baai/bge-m3"
}'
```

## node

```node
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY });
const response = await client.embeddings.create({
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "baai/bge-m3"
}, {});
console.log(response);
```

## python

```python
import os
import json
from openai import OpenAI

client = OpenAI(base_url="https://api.tokenlane.de/v1", api_key=os.environ["TOKENLANE_API_KEY"])
body = json.loads(r'''{
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "baai/bge-m3"
}''')
response = client.embeddings.create(
    model=body["model"],
    input=body["input"],
    encoding_format=body["encoding_format"]
)
print(response)
```

## vercel

```vercel
// This operation uses HTTP directly.
const response = await fetch("https://api.tokenlane.de/v1/embeddings", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
    "Content-Type": "application/json",
  },
  body: `{
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "baai/bge-m3"
}`,
});
console.log(await response.text());
```

## header: x-session-id (optional)

Groups the generation into a session, immediately available from GET /v1/sessions/{id}. Use 1 to 256 ASCII letters, digits, '-', '_', '.' or ':'; an ID cannot consist only of dots. A non-null session_id in the body takes precedence. Never sent to the provider.

### s0: string | null

{}

## header: Idempotency-Key (optional)

Explicit opt-in to encrypted response replay across gateway nodes. One 1..=255 printable ASCII value per logical operation, scoped to this API key ID. Reuse the same method, path and normalized body. Completed responses are retained for at most 10 minutes; replay is free and creates no generation. Conflicting content or unavailable replay returns 409. A successful replay carries Idempotent-Replayed: true and preserves the original request and generation IDs. See /docs/guides/idempotency.

## Body: application/json

```json
{
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "baai/bge-m3"
}
```

### s14: object

Texts (or token IDs, or multimodal inputs) to turn into embedding vectors, in OpenRouter's
format; OpenAI and OpenRouter clients work by changing the base URL and the API key.

The body is validated before any provider is called, and every problem is listed in
`error.metadata.issues`. Limits: at most 2048 inputs, each within the model's context
length (estimated at 4 bytes of text per token, 400 `context_length_exceeded` above it), and
the 50 MiB body with its structure limit (see "Limits" in the introduction). Unknown
parameters are ignored and named in `x-ignored-params`.

{}

```json
{
  "encoding_format": "float",
  "input": [
    "Lisbon is the capital of Portugal.",
    "Porto lies on the Douro."
  ],
  "model": "mistralai/mistral-embed"
}
```

- dimensions (optional): s291

### s291: integer

Length of the vectors, for models that can shorten them.

{"minimum":"1"}

```json
1024
```

- encoding_format (optional): s292

### s292: string

`float` (default) returns arrays of numbers, `base64` the little-endian 32-bit floats
as base64 strings, about a quarter of the size; use it for large batches.

"float", "base64"

{}

```json
"float"
```

- input (required): s293

### s293: anyOf

Text, token, or multimodal input(s) to embed

{}

```json
"Lisbon is the capital of Portugal."
```

anyOf: s1057

### s1057: string

{"minLength":"1"}

anyOf: s1058

### s1058: array

{}

anyOf: s1059

### s1059: array

{}

### s1251: number

{}

anyOf: s1060

### s1060: array

{}

### s1252: array

{}

anyOf: s1061

### s1061: array

{}

### s1253: object

One multimodal input, for models that accept its media (`architecture.input_modalities`
in `GET /v1/models`).

{}

```json
{
  "content": [
    {
      "text": "A cat",
      "type": "text"
    },
    {
      "image_url": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
      },
      "type": "image_url"
    }
  ]
}
```

- content (required): s1335

### s1335: array

{"minItems":"1"}

### s1349: oneOf

{}

oneOf: s1351

### s1351: object

{}

- text (required): s1057

- type (required): s1089

### s1089: string

"text"

{}

oneOf: s1352

### s1352: object

{}

- image_url (required): s1353

### s1353: object

{}

- url (required): s7

### s7: string

{}

- type (required): s1229

### s1229: string

"image_url"

{}

oneOf: s94

### s94: object

Audio of a multimodal embeddings input.

{}

```json
{
  "input_audio": {
    "data": "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAA=",
    "format": "wav"
  },
  "type": "input_audio"
}
```

- input_audio (required): s566

### s566: object

Audio of a multimodal embeddings input.

{}

```json
{
  "data": "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAA=",
  "format": "wav"
}
```

- data (required): s907

### s907: string

The media as a base64 data URL (`data:<media type>;base64,<data>`) or as plain base64.

{}

- format (optional): s908

### s908: string

Format of the media, for example `wav`, `mp4` or `pdf`.

{}

```json
"wav"
```

- type (required): s567

### s567: string

Kind of the part; names the field that carries the media.

"input_audio"

{}

```json
"input_audio"
```

oneOf: s96

### s96: object

A video of a multimodal embeddings input.

{}

```json
{
  "input_video": {
    "data": "data:video/mp4;base64,AAAAGGZ0eXBtcDQyAAAAAGlzb20=",
    "format": "mp4"
  },
  "type": "input_video"
}
```

- input_video (required): s570

### s570: object

A video of a multimodal embeddings input.

{}

```json
{
  "data": "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAA=",
  "format": "wav"
}
```

- data (required): s907

The media as a base64 data URL (`data:<media type>;base64,<data>`) or as plain base64.

- format (optional): s908

Format of the media, for example `wav`, `mp4` or `pdf`.

- type (required): s571

### s571: string

Kind of the part; names the field that carries the media.

"input_video"

{}

```json
"input_video"
```

oneOf: s95

### s95: object

A document of a multimodal embeddings input.

{}

```json
{
  "input_file": {
    "data": "data:application/pdf;base64,JVBERi0xLjQK",
    "format": "pdf"
  },
  "type": "input_file"
}
```

- input_file (required): s568

### s568: object

A document of a multimodal embeddings input.

{}

```json
{
  "data": "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAA=",
  "format": "wav"
}
```

- data (required): s907

The media as a base64 data URL (`data:<media type>;base64,<data>`) or as plain base64.

- format (optional): s908

Format of the media, for example `wav`, `mp4` or `pdf`.

- type (required): s569

### s569: string

Kind of the part; names the field that carries the media.

"input_file"

{}

```json
"input_file"
```

- input_type (optional): s294

### s294: string

How the input will be used, for models that embed queries and documents differently,
for example `search_query` or `search_document`. Passed to the provider as sent.

{}

```json
"search_document"
```

- metadata (optional): s295

### s295: any

Local metadata: at most 16 string pairs, keys 1..64 and values 0..512 characters.

{}

- model (required): s296

### s296: string

Embedding model, with the same ID as on OpenRouter, or an alias of the gateway. Chat
models cannot embed: their ID fails with 404 `no_endpoint`. An unknown ID fails with
400 `model_not_found` and a suggestion in `remedy_hint`.

{}

```json
"mistralai/mistral-embed"
```

- provider (optional): s297

### s297: object

Routing preferences, as for chat completions: `only`, `ignore`, `order`,
`allow_fallbacks`, `require_parameters`, `sort` and `max_price` (EUR per million
tokens). If a provider fails, the next one is tried.

{}

- session_id (optional): s249

### s249: string | null

Groups related requests in generation records and `GET /v1/sessions/{id}`. Use 1 to
256 ASCII letters, digits, `-`, `_`, `.` or `:`; not only dots. A non-null body value
takes precedence over `x-session-id`. Never sent to the provider.

{"minLength":"1","maxLength":"256"}

```json
"session-1234"
```

- trace (optional): s252

### s252: object

Trace metadata for observability; never sent to the provider.

{}

- user (optional): s298

### s298: string

An identifier of the end user, retained locally; sent only as a tenant-scoped hash when the route explicitly supports user.

{}

```json
"user-1234"
```

## Response 200: application/json

One vector per input, with token counts and the cost in EUR in `usage`. Always JSON: embeddings are never streamed (`text/event-stream` is listed only for compatibility with OpenRouter's description).

```json
{
  "data": [
    {
      "embedding": [
        0.0023064255,
        -0.009327292,
        0.015797347
      ],
      "index": 0,
      "object": "embedding"
    }
  ],
  "id": "gen-01k7tm9qz3f5c8x2v6b4n0m7hd",
  "model": "mistralai/mistral-embed",
  "object": "list",
  "provider": "mistral",
  "usage": {
    "cost": 8e-7,
    "cost_details": {
      "currency": "EUR",
      "upstream_inference_completions_cost": 0,
      "upstream_inference_cost": 8e-7,
      "upstream_inference_prompt_cost": 8e-7
    },
    "currency": "EUR",
    "is_byok": false,
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
```

### s15: object

The embedding vectors, in OpenRouter's format, with the cost in EUR.

{}

```json
{
  "data": [
    {
      "embedding": [
        0.0023064255,
        -0.009327292,
        0.015797347
      ],
      "index": 0,
      "object": "embedding"
    }
  ],
  "id": "gen-01k7tm9qz3f5c8x2v6b4n0m7hd",
  "model": "mistralai/mistral-embed",
  "object": "list",
  "provider": "mistral",
  "usage": {
    "cost": 8e-7,
    "cost_details": {
      "currency": "EUR",
      "upstream_inference_completions_cost": 0,
      "upstream_inference_cost": 8e-7,
      "upstream_inference_prompt_cost": 8e-7
    },
    "currency": "EUR",
    "is_byok": false,
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
```

- data (required): s299

### s299: array

One vector per input, in the order of the inputs (`index`).

{}

### s117: object

The vector of one input.

{}

```json
{
  "embedding": [
    0.0023064255,
    -0.009327292,
    0.015797347
  ],
  "index": 0,
  "object": "embedding"
}
```

- embedding (required): s624

### s624: anyOf

The vector: numbers, or a base64 string with `encoding_format: base64`

{}

```json
[
  0.0023064255,
  -0.009327292,
  0.015797347
]
```

anyOf: s1157

### s1157: array

{}

anyOf: s7

- index (required): s625

### s625: integer

Position of the input in `input`.

int32

{"minimum":"0"}

```json
0
```

- object (required): s626

### s626: string

Always `embedding`.

"embedding"

{}

```json
"embedding"
```

- id (required): s300

### s300: string

ID of this generation; `GET /v1/generation?id=` shows its tokens, cost and timing.

{}

```json
"gen-01k7tm9qz3f5c8x2v6b4n0m7hd"
```

- model (required): s301

### s301: string

The model that embedded, as a public model ID.

{}

```json
"mistralai/mistral-embed"
```

- object (required): s302

### s302: string

Always `list`.

"list"

{}

```json
"list"
```

- usage (optional): s303

### s303: object

Token counts and EUR cost of the successful result attempt, including all its batches,
if the provider reported input tokens. Earlier paid attempts that failed before a
successful fallback remain charged and are included in `GET /v1/generation` and the
durable billing receipt, not this result's usage. Without confirmed input tokens,
`cost` is missing rather than zero.

{}

```json
{
  "cost": 8e-7,
  "currency": "EUR",
  "is_byok": false,
  "prompt_tokens": 8,
  "total_tokens": 8
}
```

- cost (optional): s627

### s627: number

EUR cost of the successful result attempt across all its batches. Generation lookup
and the durable receipt additionally include confirmed costs of earlier failed attempts.

double

{}

```json
8e-7
```

- currency (optional): s628

### s628: string

Always `EUR`.

{}

```json
"EUR"
```

- is_byok (optional): s629

### s629: boolean

Whether the client's own provider key was used. Always false: the gateway has no BYOK.

{}

- prompt_tokens (required): s630

### s630: integer

Input tokens, as the provider counted them.

int64

{"minimum":"0"}

```json
8
```

- total_tokens (required): s631

### s631: integer

All tokens; the same as `prompt_tokens`.

int64

{"minimum":"0"}

```json
8
```

- * (optional): s632

### s632: any

Public `cost_details` split input/output costs in EUR, with original-currency
and FX details when applicable. Unknown provider usage fields are removed.

{}

- * (optional): s304

### s304: any

Public extension `provider`; unknown provider envelope fields are removed.

{}

## Response 200: text/event-stream

One vector per input, with token counts and the cost in EUR in `usage`. Always JSON: embeddings are never streamed (`text/event-stream` is listed only for compatibility with OpenRouter's description).

```text
YOUR_VALUE
```

## Response 400: application/json

Recognized upstream 400/422 request rejections return non-retryable client errors with safe public field paths. Invalid request: broken JSON (`invalid_request`), invalid fields such as an empty or missing `input` or more than 2048 inputs, with every problem in `issues` (`invalid_parameter`), an unknown model ID with a suggestion in `remedy_hint` (`model_not_found`), or an input too long for the model (`context_length_exceeded`)

```json
{
  "error": {
    "code": 400,
    "message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
    "metadata": {
      "docs_url": "/docs#description/model-not-found",
      "issues": [
        {
          "code": "unknown_model",
          "message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
          "path": "$.model"
        }
      ],
      "remedy_hint": "Did you mean deepseek/deepseek-v4.1-flash?",
      "request_id": "req_01k7tm9qz3f5c8x2v6b4n0m7hd",
      "retryable": false,
      "type": "model_not_found"
    }
  },
  "user_id": "org_01k7tm2c4e6g8j0k2m4p6r8t0v"
}
```

### s3: object

Every response with an HTTP status of 400 or higher has this shape, OpenRouter's error
format. Everything the gateway adds is inside `error.metadata`, so OpenRouter clients see
nothing unfamiliar. See "Errors" in the introduction for all error types.

{}

```json
{
  "error": {
    "code": 400,
    "message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
    "metadata": {
      "docs_url": "/docs#description/model-not-found",
      "issues": [
        {
          "code": "unknown_model",
          "message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
          "path": "$.model"
        }
      ],
      "remedy_hint": "Did you mean deepseek/deepseek-v4.1-flash?",
      "request_id": "req_01k7tm9qz3f5c8x2v6b4n0m7hd",
      "retryable": false,
      "type": "model_not_found"
    }
  },
  "user_id": "org_01k7tm2c4e6g8j0k2m4p6r8t0v"
}
```

- error (required): s238

### s238: object

What went wrong.

{}

```json
{
  "code": 400,
  "message": "temperature must be at most 2, got 5 (and 1 more)",
  "metadata": {
    "docs_url": "/docs#description/invalid-parameter",
    "issues": [
      {
        "code": "out_of_range",
        "message": "temperature must be at most 2, got 5",
        "path": "$.temperature"
      },
      {
        "code": "invalid_value",
        "message": "messages[1].role must be one of system, developer, user, assistant, tool, got \"bot\"",
        "path": "$.messages[1].role"
      }
    ],
    "request_id": "req_01k7tm9qz3f5c8x2v6b4n0m7hd",
    "retryable": false,
    "type": "invalid_parameter"
  }
}
```

- code (required): s633

### s633: integer

The HTTP status of the response, as a number.

int32

{"minimum":"0"}

```json
400
```

- message (required): s634

### s634: string

What went wrong, in English. With several problems: the first one and how many more
follow; all of them are in `metadata.issues`. The text may change; match on
`metadata.type` instead.

{}

```json
"temperature must be at most 2, got 5"
```

- metadata (optional): s635

### s635: object

Details for programs: error type, request ID, every problem, a suggested fix and, for
provider errors, which provider failed. Always present on gateway errors.

{}

```json
{
  "docs_url": "/docs#description/rate-limited",
  "provider_error": {
    "category": "rate_limited",
    "provider_name": "deepinfra",
    "retry_after": 2,
    "retryable": true,
    "status": 429
  },
  "provider_name": "deepinfra",
  "remedy_hint": "Retry after the Retry-After interval, or allow fallbacks to other providers (provider.allow_fallbacks).",
  "request_id": "req_01k7tm9qz3f5c8x2v6b4n0m7hd",
  "retry_after": 2,
  "retryable": true,
  "type": "rate_limited"
}
```

- available_providers (optional): s639

### s639: array

Providers that serve the model (when `provider.only` excluded all of them).

{}

```json
[
  "deepinfra",
  "open-inference"
]
```

- docs_url (required): s640

### s640: string

Link to the section of this error type in the documentation.

{}

```json
"/docs#description/model-not-found"
```

- failed_routing_step (optional): s641

### s641: string

The routing step that left no route (routing errors only).

{}

```json
"Filter by Max Price"
```

- issues (optional): s642

### s642: array

Every problem found in the request, so all can be fixed at once (at most 20); for
routing errors one entry per excluded route, for `no_provider_available` one per failed
attempt.

{}

### s123: object

One problem in the request, one reason a route was excluded, or one failed attempt.

{}

```json
{
  "code": "invalid_url",
  "message": "messages[2].content[0].image_url.url must be an http(s) URL or a base64 data URL",
  "path": "$.messages[2].content[0].image_url.url"
}
```

- code (required): s636

### s636: string

Kind of problem, stable for programs.

"required", "invalid_type", "invalid_value", "out_of_range", "empty", "invalid_url", "invalid_base64", "unsupported_media_type", "media_type_mismatch", "media_too_large", "too_many_media", "unsupported_media_transport", "media_fetch_failed", "unknown_tool", "unknown_model", "not_available", "not_allowed", "route_excluded", "bridge_failed", "provider_failed"

{}

```json
"out_of_range"
```

- message (required): s637

### s637: string

The problem in English, naming the field and, if short, the value sent.

{}

```json
"temperature must be at most 2, got 5"
```

- path (required): s638

### s638: string

Where the problem is: JSONPath of the field in the request body, for example
`$.messages[2].content[0].image_url.url`, or `query.<name>` for a query parameter.

{}

```json
"$.temperature"
```

- provider_error (optional): s643

### s643: oneOf

Safe provider diagnostics, identical for HTTP errors and terminal stream events.

{}

oneOf: s1158

### s1158: object

Provider diagnostics without provider-authored text. HTTP and terminal SSE errors use
this same structure; arbitrary upstream messages and metadata are discarded.

{}

```json
{
  "category": "rate_limited",
  "provider_name": "deepinfra",
  "retry_after": 2,
  "retryable": true,
  "status": 429
}
```

- category (required): s1299

### s1299: string

Gateway classification from HTTP status and recognized dialect identifiers.

"rate_limited", "overloaded", "invalid_request", "context_length", "content_filtered", "authentication", "billing", "timeout", "unavailable", "unknown"

{}

```json
"rate_limited"
```

- code (optional): s1300

### s1300: string

Exact identifier from the configured dialect's fixed list; arbitrary values vanish.

{}

```json
"rate_limit_exceeded"
```

- provider_name (required): s1301

### s1301: string

Configured provider name, never a name supplied by the upstream body.

{}

```json
"deepinfra"
```

- retry_after (optional): s1302

### s1302: integer

Bounded seconds from the upstream Retry-After header, when present and numeric.

int64

{"minimum":"0"}

```json
2
```

- retryable (required): s1303

### s1303: boolean

Whether the classified failure can be transient. Unknown failures are not promised retryable.

{}

- status (optional): s1304

### s1304: integer

Actual HTTP status received from the upstream, including 200 for native errors.
Absent when no HTTP status is available.

int32

{"minimum":"0"}

```json
429
```

oneOf: s588

### s588: null

{}

- provider_name (optional): s644

### s644: string

The provider that failed, as in the response field `provider` (provider errors only).

{}

```json
"deepinfra"
```

- raw (optional): s645

### s645: string

Reserved OpenRouter compatibility field. The gateway never fills it: provider
free text is deliberately withheld. Use provider_error instead.

{}

```json
""
```

- remedy_hint (optional): s646

### s646: string

A concrete fix, for example the closest model ID to a mistyped one.

{}

```json
"Did you mean deepseek/deepseek-v4.1-flash?"
```

- request_id (required): s647

### s647: string

ID of the request, the same as the `x-request-id` response header. Quote it when
contacting support.

{}

```json
"req_01k7tm9qz3f5c8x2v6b4n0m7hd"
```

- requested_providers (optional): s648

### s648: array

Providers named in `provider.only` (when it excluded all routes).

{}

```json
[
  "scaleway"
]
```

- retry_after (optional): s649

### s649: integer

Seconds to wait before retrying; also sent as the `Retry-After` header (429 and 503).

int64

{"minimum":"0"}

```json
2
```

- retryable (required): s650

### s650: boolean

Whether sending the identical request again can succeed (for example after a timeout
or rate limit), as opposed to errors that need a changed request.

{}

- routing_funnel (optional): s651

### s651: array

How routing narrowed down the providers: each step with the number of routes left
(routing errors only, same format as OpenRouter).

{}

### s200: object

One routing step, as in OpenRouter's `routing_funnel`.

{}

```json
{
  "endpoint_count": 0,
  "reason": "provider.max_price",
  "step": "Filter by Max Price"
}
```

- endpoint_count (required): s979

### s979: integer

Number of routes (providers of the model) left after the step.

{"minimum":"0"}

```json
2
```

- reason (optional): s980

### s980: string

The request field the step filtered on.

{}

```json
"provider.only"
```

- step (required): s981

### s981: string

Name of the step, as at OpenRouter.

{}

```json
"Initial Endpoints"
```

- type (required): s652

### s652: string

Stable error type to match on in code; see "Errors" in the introduction. Messages may
change, the type does not.

"invalid_request", "invalid_parameter", "unsupported_parameter", "context_length_exceeded", "authentication", "insufficient_credits", "workspace_budget_exceeded", "permission_denied", "moderation", "model_not_found", "no_endpoint", "not_found", "method_not_allowed", "timeout", "payload_too_large", "media_fetch_failed", "rate_limited", "provider_error", "idempotency_conflict", "idempotency_in_progress", "idempotency_unavailable", "provider_invalid_response", "no_provider_available", "byok_invalid_credential", "byok_rate_limited", "byok_unavailable", "feature_unavailable", "internal"

{}

```json
"invalid_parameter"
```

- user_id (optional): s239

### s239: string | null

Organization of the API key, if the key was recognized.

{}

```json
"org_01k7tm2c4e6g8j0k2m4p6r8t0v"
```

## Response 401: application/json

Missing, invalid or expired API key (`authentication`)

## Response 402: application/json

The API key spending limit, the workspace budget (`workspace_budget_exceeded`) or the organization prepaid balance cannot cover the estimated request reservation, including fees, media and concurrent reservations (`insufficient_credits` for key and organization). No paid upstream call starts without a reservation.

## Response 403: application/json

The organization, workspace or key policy does not allow the model (`permission_denied`); `remedy_hint` names the models it may use

## Response 404: application/json

The model exists, but none of its providers fits the request: it is not an embedding model, or `provider` filters, `max_price` or media exclude every provider. `issues` names the reason per provider (`no_endpoint`)

## Response 408: application/json

The provider did not connect or did not finish its response within the time limit, or the request body stopped arriving (`timeout`)

## Response 409: application/json

idempotency_conflict: this key has different request content; use a new key. idempotency_in_progress: the original is running; respect Retry-After. idempotency_unavailable: no safe replay is possible; do not silently recompute. See remedy_hint.

## Response 413: application/json

The request body is larger than 50 MiB, or its parsed JSON structure excluding JSON string values would need more than 20 MiB (`payload_too_large`)

## Response 429: application/json

Customer quota or upstream rate limit exhausted (`rate_limited`)

## Response 500: application/json

Unexpected gateway error (`internal`)

## Response 501: application/json

feature_unavailable: A required feature is permanently unconfigured on this gateway, for example encrypted idempotency replay without its encryption key, PII redaction without a detector, or BYOK import without import keys. Ask the operator to configure it or remove the optional feature from the request. Retrying the identical request cannot enable the feature: retryable is false and no Retry-After header is sent. Temporary cache, database, detector or provider outages, pending imports and missing or revoked individual customer credentials retain their existing error types.

## Response 502: application/json

The only provider tried failed (`provider_error`, with `provider_name` and structured `provider_error` diagnostics; provider text is withheld) or sent a response that is not a list of embeddings, larger than 32 MiB or too complex to parse (`provider_invalid_response`)

## Response 503: application/json

Every provider failed, the gateway is busy with other large request bodies, or this gateway instance is shutting down (`no_provider_available`)
