# Creates an Anthropic-format message using a European model

Set `ANTHROPIC_BASE_URL` to the gateway origin (without `/v1`) and use a Tokenlane
key through `x-api-key` or `Authorization: Bearer`. This is a wire adapter, not a US
provider route. Routing, policies, synchronous spending reservations, capture opt-in,
usage receipts and client cancellation are identical to Chat Completions.

Supports system text at top level or in system-role turns, text/image content,
client tools (`tool_use`/`tool_result`), stop sequences and thinking mapped to the
selected route's reasoning capability. `max_tokens` is optional; shared route limits
apply when it is omitted.
User and tool-result base64 `document` blocks with `media_type: "application/pdf"`
use the shared file-parser/OCR lifecycle and its routing, policy and cost receipts.
Document URLs, citations, title and context are not supported by this bounded adapter.
Cache hints (`cache_control`) are ignored without cache execution and their original
field paths are named in `x-ignored-params` (at most 20). A true tool_result.is_error
appends a text block, "[tool_result.is_error=true] The tool reported an error.", after
the unchanged tool content; Chat has no native tool-error flag. False preserves content.
Other unsupported server-side features fail with collected field issues, never silently
execute or disappear. Unknown parameters are named in `x-ignored-params`.
This is a bounded EU-model adapter, not full Anthropic or Claude Code compatibility.
Routes configured to estimate missing usage are excluded before paid admission.
Final usage requires genuine cumulative input and output counts; unexpected missing or
partial measurements fail rather than fabricating usage. EUR costs retain Chat semantics.
`message_start` initializes numeric usage to 0/0 with event metadata
`usage_status: "pending"`; those wire placeholders are never billing, storage or
telemetry measurements. The final `message_delta` replaces them with actual counters.
Unsigned EU thinking uses an empty `signature` and final empty `signature_delta` as
an explicit unsigned sentinel, NOT an Anthropic integrity attestation. Nonempty input
signatures and redacted thinking are rejected; unsigned history is untrusted assistant
input. No interoperability with Anthropic's signed-history replay is promised.
Stop sequences are forwarded; when Chat does not report the matched sequence,
`stop_sequence` stays null rather than inventing a match.

Streams use named `message_start`, `content_block_start`, `content_block_delta`,
`content_block_stop`, `message_delta` and `message_stop` events. A terminal `error`
event replaces success on failure; Messages never emits Chat's `[DONE]` sentinel.
The terminal event is withheld until the shared generation recorder confirms it.
Errors retain catalog diagnostics in `error.metadata`, including `issues` and
`remedy_hint`, inside an Anthropic-compatible error envelope.

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

## Authentifizierung

[
  [
    {
      "name": "Authorization",
      "description": "API-Key als Bearer-Token im Header `Authorization`: `Authorization: Bearer sk-tl-v1-…`. Bestehende `sk-eu-`-Keys bleiben gültig. Fehlende, unbekannte oder abgelaufene Keys erhalten 401 `authentication`.",
      "type": "http bearer",
      "location": "",
      "scopes": []
    }
  ]
]

## curl

```curl
curl --request POST \
  --url 'https://api.tokenlane.de/v1/messages' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "stream": false,
  "system": "Answer briefly."
}'
```

## node

```node
const response = await fetch("https://api.tokenlane.de/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
    "Content-Type": "application/json",
  },
  body: `{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "stream": false,
  "system": "Answer briefly."
}`,
});
console.log(await response.text());
```

## python

```python
import os
import urllib.request

body = (r'''{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "stream": false,
  "system": "Answer briefly."
}''').encode("utf-8")

request = urllib.request.Request(
    "https://api.tokenlane.de/v1/messages",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["TOKENLANE_API_KEY"],
        "Content-Type": "application/json",
    },
    data=body,
)

with urllib.request.urlopen(request) as response:
    print(response.read().decode("utf-8"))
```

## vercel

```vercel
// This operation uses HTTP directly.
const response = await fetch("https://api.tokenlane.de/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
    "Content-Type": "application/json",
  },
  body: `{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "stream": false,
  "system": "Answer briefly."
}`,
});
console.log(await response.text());
```

## Header: x-api-key (optional)

Tokenlane API key. Alternatively use Authorization: Bearer. Duplicate or conflicting credentials are rejected.

### s0: string | null

{}

## Header: anthropic-version (optional)

Messages wire version; the supported baseline is 2023-06-01. Omitting it selects that baseline.

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

Optional session grouping, identical to Chat Completions.

## Header: Idempotency-Key (optional)

Explicit opt-in to encrypted exact replay; identical retries preserve IDs without a new charge. Reusing a key for different content returns 409.

## Anfrageinhalt: application/json

```json
{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "stream": false,
  "system": "Answer briefly."
}
```

### s20: object

A stateless Anthropic Messages invocation using gateway model IDs or aliases.
Send the complete conversation, including tool_use and tool_result blocks. Authentication
accepts x-api-key; anthropic-version identifies the client protocol, not a model provider.
Routing, key policies, cancellation, generation tracking and EUR billing are shared with Chat.
Known fields are validated and unsupported features are rejected with catalog metadata.
Cache hints are no-ops reported by original field path in x-ignored-params, never cache
execution. Routes configured to estimate missing token usage are excluded before paid work.

{}

```json
{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Hello from Europe.",
      "role": "user"
    }
  ],
  "model": "mock/echo",
  "stream": false,
  "system": "Answer briefly."
}
```

- max_tokens (optional): s309

### s309: integer

Optional positive output-token limit. Omission uses shared route limits; zero and invalid values remain rejected.

{"minimum":"1"}

- messages (Pflichtfeld): s310

### s310: array

Nonempty ordered user, assistant and system conversation. The top-level system field is also accepted.

{"minItems":"1"}

### s47: object

A user, assistant or system turn. Tool results are user blocks, not a separate tool role.

{}

```json
{
  "content": [
    {
      "content": "12 degrees Celsius",
      "tool_use_id": "call_eu_weather",
      "type": "tool_result"
    }
  ],
  "role": "user"
}
```

- content (Pflichtfeld): s434

### s434: anyOf

Text shorthand or an array of Messages content blocks. Block objects preserve source,
tool_use_id, is_error and input. A true tool_result.is_error appends a text block,
"[tool_result.is_error=true] The tool reported an error.", after unchanged tool content;
Chat has no native error bit. False or absent leaves content unchanged; other types fail.
Block cache_control hints are ignored and reported in x-ignored-params.
Thinking history may carry only an empty signature:
this is unsigned, untrusted text for a bounded roundtrip, not authenticated reasoning.
Nonempty signatures and redacted_thinking are rejected with precise NotAvailable issues.

{}

anyOf: s7

### s7: string

{}

anyOf: s1104

### s1104: array

{}

### s46: oneOf

Input blocks translated by this adapter. Role constraints are enforced before I/O:
system accepts text; user accepts text, image, base64 PDF and leading tool results;
assistant accepts text, client tool requests and unsigned thinking. Cache hints are no-ops.

{}

oneOf: s428

### s428: object

Text in any supported role; citations are unavailable.

{}

- text (Pflichtfeld): s1088

### s1088: string

Original text, not a provider instruction inferred from metadata.

{}

- type (Pflichtfeld): s1089

### s1089: string

"text"

{}

oneOf: s429

### s429: object

User image, subject to the existing protected media validation and route capabilities.

{}

- source (Pflichtfeld): s1090

### s1090: oneOf

URL or inline base64 image, never fetched without the shared egress policy.

{}

oneOf: s426

### s426: object

Remote image subject to the shared protected URL loader.

{}

- type (Pflichtfeld): s1083

### s1083: string

"url"

{}

- url (Pflichtfeld): s1084

### s1084: string

Original URL; existing scheme, network and size policies apply.

{}

oneOf: s427

### s427: object

Inline image, subject to the same media and memory limits as Chat input.

{}

- data (Pflichtfeld): s1085

### s1085: string

Encoded image bytes, validated by the common media path.

{}

- media_type (Pflichtfeld): s1086

### s1086: string

An allowed image MIME type.

"image/jpeg", "image/png", "image/gif", "image/webp"

{}

- type (Pflichtfeld): s1087

### s1087: string

"base64"

{}

- type (Pflichtfeld): s1091

### s1091: string

"image"

{}

oneOf: s430

### s430: object

User base64 PDF; shared file-parser/OCR admission, policy and charges still apply.

{}

- source (Pflichtfeld): s1092

### s1092: oneOf

Only inline base64 application/pdf is translated; URL/title/context/citations are unavailable.

{}

oneOf: s441

### s441: object

Inline PDF; remote documents and other document media types are unavailable.

{}

- data (Pflichtfeld): s1105

### s1105: string

Base64 PDF bytes; validity, size, OCR policy and charges are checked by the shared path.

{}

- media_type (Pflichtfeld): s1106

### s1106: string

Exactly application/pdf.

"application/pdf"

{}

- type (Pflichtfeld): s1087

- type (Pflichtfeld): s1093

### s1093: string

"document"

{}

oneOf: s431

### s431: object

Previous assistant request for client execution, never gateway execution.

{}

- id (Pflichtfeld): s1094

### s1094: string

Tool call correlation identifier.

{}

- input (Pflichtfeld): s1095

### s1095: object

Function argument object, not arbitrary message content.

{}

- name (Pflichtfeld): s470

### s470: string

Client function name.

{}

- type (Pflichtfeld): s1096

### s1096: string

"tool_use"

{}

oneOf: s432

### s432: object

Leading user tool result; never accepted as an assistant or system tool execution.

{}

- content (optional): s1097

### s1097: oneOf

Original tool output; omission is an empty result.

{}

oneOf: s465

### s465: string

Original text output.

{}

oneOf: s466

### s466: array

Text, images or inline PDFs subject to shared validation and policy.

{}

### s61: oneOf

Media and text translated within a user tool result; no recursive arbitrary blocks.

{}

oneOf: s462

### s462: object

Original tool text.

{}

- text (Pflichtfeld): s1116

### s1116: string

Tool output text.

{}

- type (Pflichtfeld): s1089

oneOf: s463

### s463: object

Protected image input.

{}

- source (Pflichtfeld): s1117

### s1117: oneOf

Existing URL/base64 image forms.

{}

oneOf: s426

oneOf: s427

- type (Pflichtfeld): s1091

oneOf: s464

### s464: object

Inline PDF through the shared file-parser/OCR lifecycle.

{}

- source (Pflichtfeld): s1118

### s1118: oneOf

Existing base64 PDF form only.

{}

oneOf: s441

- type (Pflichtfeld): s1093

- is_error (optional): s1098

### s1098: boolean

True appends an explicit error note without changing the original tool output.

{}

- tool_use_id (Pflichtfeld): s1099

### s1099: string

Identifier of the corresponding assistant client-tool request.

{}

- type (Pflichtfeld): s1100

### s1100: string

"tool_result"

{}

oneOf: s433

### s433: object

Previous assistant reasoning, accepted only as unsigned, untrusted text.

{}

- signature (Pflichtfeld): s1101

### s1101: string

Required; only the empty unsigned sentinel is usable, nonempty signatures fail not_available.

{}

- thinking (Pflichtfeld): s1102

### s1102: string

Visible reasoning history, not authenticated provider state.

{}

- type (Pflichtfeld): s1103

### s1103: string

"thinking"

{}

- role (Pflichtfeld): s435

### s435: string

Conversation role: user, assistant or system.

"user", "assistant", "system"

{}

- metadata (optional): s311

### s311: object | null

Caller metadata: at most 16 pairs, keys of 1 to 64 characters and string values of at most 512 characters. Never include secrets.

{"additionalProperties":"true"}

- model (Pflichtfeld): s312

### s312: string

Public EU model ID or gateway alias, not an Anthropic-hosted model name.

{}

```json
"mock/echo"
```

- stop_sequences (optional): s313

### s313: array | null

Sequences forwarded to the Chat provider to end generation. The matched sequence
stays unknown (null) when the provider does not report it; no match is invented.

{}

- stream (optional): s314

### s314: boolean | null

Return named Messages SSE events when true. No Chat [DONE] sentinel is emitted.

{}

- system (optional): s315

### s315: anyOf

System instructions as text or text blocks; null and omission add no system turn.

{}

anyOf: s7

anyOf: s1062

### s1062: array

{}

### s83: object

Ein Textabschnitt.

{}

```json
{
  "text": "What is shown in this picture?",
  "type": "text"
}
```

- text (Pflichtfeld): s531

### s531: string

Ein Textabschnitt.

{}

- type (Pflichtfeld): s532

### s532: string

Typ des Teils. Benennt das Feld mit dem Inhalt.

"text"

{}

```json
"text"
```

- * (optional): s533

### s533: any

Weitere Felder, beispielsweise `cache_control`. Sie werden unverändert an den Provider weitergegeben.

{}

anyOf: s1063

### s1063: null

No top-level system instructions supplied.

{}

- temperature (optional): s316

### s316: number | null

Sampling temperature in the Messages range from zero through one.

double

{}

- thinking (optional): s317

### s317: oneOf

Supported thinking controls: enabled with a required budget, disabled, or adaptive. Null leaves control unset. Display omitted uses local trace exclusion without changing usage or billing; other display values, non-null block_binding and between_tools fail not_available.

{}

```json
{
  "budget_tokens": 1024,
  "type": "enabled"
}
```

oneOf: s1064

### s1064: object

{}

- budget_tokens (Pflichtfeld): s1254

### s1254: integer

Required reasoning-token budget, normalized to reasoning.max_tokens for the selected model. Claude-specific minimum or relative-output-limit rules are not imposed on European Chat models. Shared output, context, memory and financial admission still apply.

{}

- display (optional): s1255

### s1255: string

Visible trace presentation; only omitted is supported, the others fail not_available.

"summarized", "omitted", "updates"

{}

- type (Pflichtfeld): s1256

### s1256: string

"enabled"

{}

oneOf: s1065

### s1065: object

{}

- type (Pflichtfeld): s1257

### s1257: string

"disabled"

{}

oneOf: s1066

### s1066: object

{}

- display (optional): s1255

Visible trace presentation; only omitted is supported, the others fail not_available.

- type (Pflichtfeld): s1258

### s1258: string

"adaptive"

{}

oneOf: s1067

### s1067: object

{}

- type (Pflichtfeld): s1259

### s1259: string

"between_tools"

{}

oneOf: s1068

### s1068: null

No explicit selection supplied.

{}

- tool_choice (optional): s318

### s318: oneOf

Client-tool selection: auto, any, none or a required named function; null leaves selection unset. Native server execution is not offered.

{}

```json
{
  "disable_parallel_tool_use": true,
  "name": "get_weather",
  "type": "tool"
}
```

oneOf: s1069

### s1069: object

{}

- disable_parallel_tool_use (optional): s1260

### s1260: boolean

{}

- type (Pflichtfeld): s1261

### s1261: string

"auto"

{}

oneOf: s1070

### s1070: object

{}

- disable_parallel_tool_use (optional): s1260

- type (Pflichtfeld): s1262

### s1262: string

"any"

{}

oneOf: s1071

### s1071: object

{}

- disable_parallel_tool_use (optional): s1260

- type (Pflichtfeld): s1263

### s1263: string

"none"

{}

oneOf: s1072

### s1072: object

{}

- disable_parallel_tool_use (optional): s1260

- name (Pflichtfeld): s7

- type (Pflichtfeld): s1264

### s1264: string

"tool"

{}

oneOf: s588

### s588: null

{}

- tools (optional): s319

### s319: array | null

Client functions require name and input_schema. Any other tool type (server or native
tools) is rejected with not_available at its type before provider I/O.

{}

### s55: oneOf

Recognized tool syntax, not a promise to execute native tools.

{}

oneOf: s442

### s442: object

Client function with mandatory name and input schema, unchanged execution contract.

{}

```json
{
  "description": "Get weather in a European city.",
  "input_schema": {
    "properties": {
      "city": {
        "type": "string"
      }
    },
    "required": [
      "city"
    ],
    "type": "object"
  },
  "name": "get_weather"
}
```

- description (optional): s458

### s458: string | null

Description for the model, if supplied.

{}

- input_schema (Pflichtfeld): s459

### s459: any

JSON Schema object describing the tool input.

{}

- name (Pflichtfeld): s460

### s460: string

Function name used by tool_use blocks.

{}

- * (optional): s461

### s461: any

Optional protocol fields. Unsupported server tools are explicitly rejected.

{}

oneOf: s443

### s443: object

Known native tool discriminator; always rejected as not_available before I/O.

{}

- type (Pflichtfeld): s472

### s472: string

Native tool family; no client-function input_schema requirement applies.

"bash_20250124", "text_editor_20250124", "web_search_20250305", "web_search_20260209", "advisor_20260301", "openrouter:bash", "openrouter:datetime", "openrouter:image_generation", "openrouter:experimental__search_models", "openrouter:web_fetch", "openrouter:web_search", "tool_search_tool_bm25_20251119", "tool_search_tool_bm25", "tool_search_tool_regex_20251119", "tool_search_tool_regex", "openrouter:shell", "openrouter:tool_search"

{}

- top_k (optional): s320

### s320: integer | null

Highest-probability token count considered while sampling; null or omission leaves this optional control unset.

{"minimum":"0"}

- top_p (optional): s321

### s321: number | null

Nucleus sampling probability from zero through one.

double

{}

- * (optional): s322

### s322: any

Gateway routing, session and policy-compatible extensions. Unknown fields are not
silently interpreted as supported Anthropic server features.

{}

## Antwort 200: application/json

Anthropic message or named event stream; usage and cost reflect the shared Chat generation.

```json
{
  "container": null,
  "content": [
    {
      "citations": null,
      "text": "Hello.",
      "type": "text"
    }
  ],
  "id": "gen-eu-example",
  "model": "mock/echo",
  "role": "assistant",
  "stop_details": null,
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "cache_creation": null,
    "cache_creation_input_tokens": null,
    "cache_read_input_tokens": null,
    "inference_geo": null,
    "input_tokens": 5,
    "output_tokens": 2,
    "output_tokens_details": null,
    "server_tool_use": null,
    "service_tier": null
  }
}
```

### s21: object

A completed Messages result. id is also the gateway generation lookup ID.

{}

```json
{
  "container": null,
  "content": [
    {
      "citations": null,
      "text": "Hello.",
      "type": "text"
    }
  ],
  "id": "gen-eu-example",
  "model": "mock/echo",
  "role": "assistant",
  "stop_details": null,
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "cache_creation": null,
    "cache_creation_input_tokens": null,
    "cache_read_input_tokens": null,
    "inference_geo": null,
    "input_tokens": 5,
    "output_tokens": 2,
    "output_tokens_details": null,
    "server_tool_use": null,
    "service_tier": null
  }
}
```

- container (Pflichtfeld): s323

### s323: null

No provider execution container is created by this Chat-backed adapter.

{}

- content (Pflichtfeld): s324

### s324: array

Ordered text, tool_use or unsigned thinking blocks. Thinking signatures are empty
sentinels only; redacted_thinking and authenticated Anthropic reasoning are unsupported.

{}

### s52: oneOf

Output blocks actually produced by the bounded Chat-backed adapter.

{}

oneOf: s438

### s438: object

Generated text without inferred citations.

{}

- citations (Pflichtfeld): s452

### s452: null

Citations are unavailable; ordinary generated text is not converted to citations.

{}

- text (Pflichtfeld): s453

### s453: string

Generated text.

{}

- type (Pflichtfeld): s454

### s454: string

Generated text; this adapter does not infer citations.

"text"

{}

```json
"text"
```

oneOf: s439

### s439: object

Client function request, not native execution.

{}

- caller (Pflichtfeld): s467

### s467: object

Only direct client calls are produced.

{}

- type (Pflichtfeld): s422

### s422: string

Direct client-function caller, without server execution or a container context.

"direct"

{}

```json
"direct"
```

- id (Pflichtfeld): s468

### s468: string

Correlation identifier preserved on tool_result.

{}

- input (Pflichtfeld): s469

### s469: object

Function argument object; dynamic client arguments are not arbitrary message blocks.

{}

- name (Pflichtfeld): s470

Client function name.

- type (Pflichtfeld): s471

### s471: string

A client function request, never server-side execution.

"tool_use"

{}

```json
"tool_use"
```

oneOf: s440

### s440: object

Unsigned reasoning text, not authenticated state.

{}

- signature (Pflichtfeld): s455

### s455: string

Runtime emits only the empty unsigned sentinel; the wire type is a string, not an integrity proof.

{}

- thinking (Pflichtfeld): s456

### s456: string

Reasoning text from the EU Chat model.

{}

- type (Pflichtfeld): s457

### s457: string

Visible unsigned reasoning; no cryptographic integrity or native signed-history replay is claimed.

"thinking"

{}

```json
"thinking"
```

- id (Pflichtfeld): s325

### s325: string

Gateway generation ID, also available in x-generation-id.

{}

- model (Pflichtfeld): s326

### s326: string

Actual EU model after alias resolution and routing.

{}

- role (Pflichtfeld): s327

### s327: string

Always assistant.

"assistant"

{}

- stop_details (Pflichtfeld): s328

### s328: null

No structured refusal classification is inferred from Chat output.

{}

- stop_reason (Pflichtfeld): s329

### s329: string

Measured final completion reason; provisional message_start has a separate schema.

"end_turn", "max_tokens", "stop_sequence", "tool_use", "refusal"

{}

- stop_sequence (Pflichtfeld): s330

### s330: string | null

Reported matched sequence, otherwise null. Chat-backed routes generally do not report it.

{}

- type (Pflichtfeld): s331

### s331: string

Always message.

"message"

{}

- usage (Pflichtfeld): s332

### s332: object

Both cumulative counters are required on a successful final message. Missing,
partial or invalid final usage produces a catalog invalid-response error instead.
Provisional message_start counters have their own schema and are never accounting.

{}

```json
{
  "cache_creation": null,
  "cache_creation_input_tokens": null,
  "cache_read_input_tokens": null,
  "inference_geo": null,
  "input_tokens": 5,
  "output_tokens": 2,
  "output_tokens_details": null,
  "server_tool_use": null,
  "service_tier": null
}
```

- cache_creation (Pflichtfeld): s473

### s473: object | null

Provider-reported cache-write counts by TTL, or null when unavailable; no cache execution or measured zero is inferred.

{}

- ephemeral_1h_input_tokens (Pflichtfeld): s1119

### s1119: integer

Cache writes with one-hour TTL.

int64

{"minimum":"0"}

- ephemeral_5m_input_tokens (Pflichtfeld): s1120

### s1120: integer

Cache writes with five-minute TTL.

int64

{"minimum":"0"}

- cache_creation_input_tokens (Pflichtfeld): s474

### s474: integer | null

Reported cache-write count, null when unavailable; never invented as zero.

int64

{"minimum":"0"}

- cache_read_input_tokens (Pflichtfeld): s475

### s475: integer | null

Reported cache-read count, null when unavailable; never invented as zero.

int64

{"minimum":"0"}

- inference_geo (Pflichtfeld): s476

### s476: string | null

Reported inference geography, null when unavailable.

{}

- input_tokens (Pflichtfeld): s477

### s477: integer

Cumulative provider input tokens, or provisional zero on message_start only.

int64

{"minimum":"0"}

- output_tokens (Pflichtfeld): s478

### s478: integer

Cumulative provider output tokens, or provisional zero on message_start only.

int64

{"minimum":"0"}

- output_tokens_details (Pflichtfeld): s479

### s479: object | null

Provider-reported thinking-token detail, or null when unavailable; visible reasoning is not counted as a measurement.

{}

- thinking_tokens (Pflichtfeld): s1121

### s1121: integer

Measured thinking tokens.

int64

{"minimum":"0"}

- server_tool_use (Pflichtfeld): s480

### s480: object | null

Provider-reported native web-search and web-fetch counters, or null when unavailable; client function calls are not server-tool usage.

{}

- web_fetch_requests (Pflichtfeld): s1122

### s1122: integer

Native web fetches.

int64

{"minimum":"0"}

- web_search_requests (Pflichtfeld): s1123

### s1123: integer

Native web searches.

int64

{"minimum":"0"}

- service_tier (Pflichtfeld): s481

### s481: string | null

Reported service tier, null when unavailable; no tier is inferred.

{}

- * (optional): s482

### s482: any

Existing gateway billing metadata, retaining explicit currencies.

{}

## Antwort 200: text/event-stream

Anthropic message or named event stream; usage and cost reflect the shared Chat generation.

```text
event: content_block_delta
data: {"delta":{"text":"Hello","type":"text_delta"},"index":0,"type":"content_block_delta"}


```

### s22: object

One Messages SSE frame. event must equal data.type. A successful stream ends in
message_stop, not [DONE]. Deltas are forwarded without collecting the complete stream.

{}

```json
{
  "data": {
    "delta": {
      "text": "Hello",
      "type": "text_delta"
    },
    "index": 0,
    "type": "content_block_delta"
  },
  "event": "content_block_delta"
}
```

- data (Pflichtfeld): s333

### s333: oneOf

JSON payload of the event field's matching type.

{}

oneOf: s853

### s853: object

Initial identity with provisional counters, not final accounting.

{}

- message (Pflichtfeld): s849

### s849: object

Initial message: empty content, null completion reason, provisional 0/0 usage.

{}

- container (Pflichtfeld): s323

No provider execution container is created by this Chat-backed adapter.

- content (Pflichtfeld): s444

### s444: array

No content has been emitted at message_start.

{"maxItems":"0"}

- id (Pflichtfeld): s445

### s445: string

Gateway generation identifier.

{}

- model (Pflichtfeld): s446

### s446: string

Actual routed model.

{}

- role (Pflichtfeld): s447

### s447: string

Always assistant.

"assistant"

{}

- stop_details (Pflichtfeld): s328

No structured refusal classification is inferred from Chat output.

- stop_reason (Pflichtfeld): s448

### s448: null

Completion reason is unknown at message_start; this is not a finished message.

{}

- stop_sequence (Pflichtfeld): s449

### s449: null

No matched stop sequence is known at message_start.

{}

- type (Pflichtfeld): s450

### s450: string

Always message.

"message"

{}

- usage (Pflichtfeld): s451

### s451: object

Initial provisional 0/0 wire placeholders with explicitly unavailable details. Final measured usage replaces them; these values never enter billing or storage.

{}

```json
{
  "cache_creation": null,
  "cache_creation_input_tokens": null,
  "cache_read_input_tokens": null,
  "inference_geo": null,
  "input_tokens": 5,
  "output_tokens": 2,
  "output_tokens_details": null,
  "server_tool_use": null,
  "service_tier": null
}
```

- cache_creation (Pflichtfeld): s1107

### s1107: null

No cache TTL measurement exists at message_start.

{}

- cache_creation_input_tokens (Pflichtfeld): s1108

### s1108: null

No cache-write measurement exists at message_start.

{}

- cache_read_input_tokens (Pflichtfeld): s1109

### s1109: null

No cache-read measurement exists at message_start.

{}

- inference_geo (Pflichtfeld): s1110

### s1110: null

No provider-reported inference geography exists at message_start.

{}

- input_tokens (Pflichtfeld): s1111

### s1111: integer

Provisional wire-only zero at message_start, never a token measurement or accounting value.

{"minimum":"0","maximum":"0"}

- output_tokens (Pflichtfeld): s1111

Provisional wire-only zero at message_start, never a token measurement or accounting value.

- output_tokens_details (Pflichtfeld): s1112

### s1112: null

No thinking-token measurement exists at message_start.

{}

- server_tool_use (Pflichtfeld): s1113

### s1113: null

No native server-tool measurement exists at message_start.

{}

- service_tier (Pflichtfeld): s1114

### s1114: null

No provider-reported service tier exists at message_start.

{}

- * (optional): s1115

### s1115: any

Existing gateway billing metadata, retaining explicit currencies.

{}

- metadata (Pflichtfeld): s850

### s850: object

Gateway event metadata; kept outside usage so SDK accumulators cannot retain a stale
pending flag after replacing the provisional counters with actual measurements.

{}

- usage_status (Pflichtfeld): s1202

### s1202: string

Wire counters are provisional and never accounting evidence.

"pending"

{}

- type (Pflichtfeld): s851

### s851: string

Initial message identity with provisional, non-accounting counters.

"message_start"

{}

```json
"message_start"
```

oneOf: s854

### s854: object

Measured final usage and completion reason.

{}

- delta (Pflichtfeld): s842

### s842: object

Final completion reason and explicit absence of execution context.

{}

- container (Pflichtfeld): s323

No provider execution container is created by this Chat-backed adapter.

- stop_details (Pflichtfeld): s328

No structured refusal classification is inferred from Chat output.

- stop_reason (Pflichtfeld): s436

### s436: string

Actual final completion reason; successful final deltas never carry a provisional null.

"end_turn", "max_tokens", "stop_sequence", "tool_use", "refusal"

{}

- stop_sequence (Pflichtfeld): s437

### s437: string | null

Matched sequence if known, otherwise null.

{}

- metadata (Pflichtfeld): s843

### s843: object

Gateway event metadata; kept outside usage so SDK accumulators cannot retain a stale
pending flag after replacing the provisional counters with actual measurements.

{}

- usage_status (Pflichtfeld): s1201

### s1201: string

Final cumulative counters are actual measurements replacing provisional wire counters.

"measured"

{}

- type (Pflichtfeld): s844

### s844: string

Final metadata with actual cumulative usage; unknown counters fail instead of completing.

"message_delta"

{}

```json
"message_delta"
```

- usage (Pflichtfeld): s845

### s845: object

Actual cumulative token counts, replacing rather than adding to initial counters.

{}

```json
{
  "cache_creation": null,
  "cache_creation_input_tokens": null,
  "cache_read_input_tokens": null,
  "inference_geo": null,
  "input_tokens": 5,
  "output_tokens": 2,
  "output_tokens_details": null,
  "server_tool_use": null,
  "service_tier": null
}
```

- cache_creation (Pflichtfeld): s473

- cache_creation_input_tokens (Pflichtfeld): s474

Reported cache-write count, null when unavailable; never invented as zero.

- cache_read_input_tokens (Pflichtfeld): s475

Reported cache-read count, null when unavailable; never invented as zero.

- inference_geo (Pflichtfeld): s476

Reported inference geography, null when unavailable.

- input_tokens (Pflichtfeld): s477

Cumulative provider input tokens, or provisional zero on message_start only.

- output_tokens (Pflichtfeld): s478

Cumulative provider output tokens, or provisional zero on message_start only.

- output_tokens_details (Pflichtfeld): s479

- server_tool_use (Pflichtfeld): s480

- service_tier (Pflichtfeld): s481

Reported service tier, null when unavailable; no tier is inferred.

- * (optional): s482

Existing gateway billing metadata, retaining explicit currencies.

oneOf: s855

### s855: object

Successful terminal event.

{}

- type (Pflichtfeld): s852

### s852: string

Successful terminal event after final usage and durable recording.

"message_stop"

{}

```json
"message_stop"
```

oneOf: s856

### s856: object

Begin a supported content block.

{}

- content_block (Pflichtfeld): s837

### s837: anyOf

Output blocks actually produced by the bounded Chat-backed adapter.

{}

anyOf: s1198

### s1198: object

Generated text without inferred citations.

{}

- citations (Pflichtfeld): s452

Citations are unavailable; ordinary generated text is not converted to citations.

- text (Pflichtfeld): s453

Generated text.

- type (Pflichtfeld): s454

Generated text; this adapter does not infer citations.

anyOf: s1199

### s1199: object

Client function request, not native execution.

{}

- caller (Pflichtfeld): s467

- id (Pflichtfeld): s468

Correlation identifier preserved on tool_result.

- input (Pflichtfeld): s469

Function argument object; dynamic client arguments are not arbitrary message blocks.

- name (Pflichtfeld): s470

Client function name.

- type (Pflichtfeld): s471

A client function request, never server-side execution.

anyOf: s1200

### s1200: object

Unsigned reasoning text, not authenticated state.

{}

- signature (Pflichtfeld): s455

Runtime emits only the empty unsigned sentinel; the wire type is a string, not an integrity proof.

- thinking (Pflichtfeld): s456

Reasoning text from the EU Chat model.

- type (Pflichtfeld): s457

Visible unsigned reasoning; no cryptographic integrity or native signed-history replay is claimed.

- index (Pflichtfeld): s838

### s838: integer

Stable zero-based block index.

int32

{"minimum":"0"}

- type (Pflichtfeld): s839

### s839: string

Start of one text, client-tool or unsigned-thinking block.

"content_block_start"

{}

```json
"content_block_start"
```

oneOf: s857

### s857: object

Incremental text, client-tool JSON or unsigned thinking.

{}

- delta (Pflichtfeld): s834

### s834: oneOf

Incremental data emitted for the adapter's supported content blocks.

{}

oneOf: s1194

### s1194: object

{}

- text (Pflichtfeld): s7

- type (Pflichtfeld): s1328

### s1328: string

"text_delta"

{}

oneOf: s1195

### s1195: object

{}

- partial_json (Pflichtfeld): s7

- type (Pflichtfeld): s1329

### s1329: string

"input_json_delta"

{}

oneOf: s1196

### s1196: object

{}

- thinking (Pflichtfeld): s7

- type (Pflichtfeld): s1330

### s1330: string

"thinking_delta"

{}

oneOf: s1197

### s1197: object

{}

- signature (Pflichtfeld): s7

- type (Pflichtfeld): s1331

### s1331: string

"signature_delta"

{}

- index (Pflichtfeld): s835

### s835: integer

Stable index of the open block.

int32

{"minimum":"0"}

- type (Pflichtfeld): s836

### s836: string

Incremental content for an already open supported block.

"content_block_delta"

{}

```json
"content_block_delta"
```

oneOf: s858

### s858: object

Finish an open content block.

{}

- index (Pflichtfeld): s840

### s840: integer

Index of the block being closed.

int32

{"minimum":"0"}

- type (Pflichtfeld): s841

### s841: string

Closes one open content block.

"content_block_stop"

{}

```json
"content_block_stop"
```

oneOf: s859

### s859: object

Keepalive event.

{}

- type (Pflichtfeld): s848

### s848: string

Keepalive without generated content or usage.

"ping"

{}

```json
"ping"
```

oneOf: s860

### s860: object

Terminal error instead of a successful stop.

{}

- error (Pflichtfeld): s846

### s846: object

Safe Anthropic error class plus existing gateway catalog metadata.

{}

- message (Pflichtfeld): s423

### s423: string

Safe English explanation.

{}

- metadata (optional): s424

### s424: oneOf

Gateway error type, request ID, collected issues, remedy and provider diagnostics.

{}

oneOf: s1082

### s1082: object

Maschinenlesbare Fehlerdetails. Kein Bestandteil des OpenRouter-Formats, das `metadata` offenlässt. Clients, die diese Felder nicht kennen, können sie ignorieren.

{}

```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): s1275

### s1275: array

Provider, die das Modell anbieten, wenn `provider.only` alle ausgeschlossen hat.

{}

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

- docs_url (Pflichtfeld): s640

### s640: string

Link zum Abschnitt dieses Fehlertyps in der Dokumentation.

{}

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

- failed_routing_step (optional): s641

### s641: string

Routing-Schritt, nach dem keine Route übrig blieb. Nur bei Routing-Fehlern.

{}

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

- issues (optional): s1276

### s1276: array

Alle erkannten Probleme der Anfrage, damit sie gemeinsam behoben werden können. Höchstens 20 Einträge. Bei Routing-Fehlern ein Eintrag je ausgeschlossener Route, bei `no_provider_available` einer je fehlgeschlagenem Versuch.

{}

### s123: object

Ein Anfrageproblem, ein Ausschlussgrund einer Route oder ein fehlgeschlagener Versuch.

{}

```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 (Pflichtfeld): s636

### s636: string

Art des Problems. Für Programme stabil.

"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 (Pflichtfeld): s637

### s637: string

Problembeschreibung auf Englisch mit dem Feld und, sofern kurz, dem gesendeten Wert.

{}

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

- path (Pflichtfeld): s638

### s638: string

Position des Problems: JSONPath des Felds im Anfrageinhalt, beispielsweise `$.messages[2].content[0].image_url.url`, oder `query.<name>` bei einem Abfrageparameter.

{}

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

- provider_error (optional): s1277

### s1277: oneOf

Sichere Provider-Diagnosen, einheitlich für HTTP-Fehler und finale Stream-Ereignisse.

{}

oneOf: s1336

### s1336: object

Provider-Diagnosen ohne vom Provider verfassten Text. HTTP-Fehler und finale SSE-Fehler verwenden dieselbe Struktur. Beliebige Upstream-Meldungen und Metadaten werden verworfen.

{}

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

- category (Pflichtfeld): s1350

### s1350: string

Gateway-Klassifizierung anhand von HTTP-Status und erkannten Dialektkennungen.

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

{}

```json
"rate_limited"
```

- code (optional): s1300

### s1300: string

Exakte Kennung aus der festen Liste des konfigurierten Dialekts. Beliebige andere Werte werden entfernt.

{}

```json
"rate_limit_exceeded"
```

- provider_name (Pflichtfeld): s1301

### s1301: string

Konfigurierter Provider-Name. Nie ein Name aus dem Upstream-Antwortinhalt.

{}

```json
"deepinfra"
```

- retry_after (optional): s1302

### s1302: integer

Begrenzte Wartezeit in Sekunden aus dem Upstream-Header Retry-After, sofern vorhanden und numerisch.

int64

{"minimum":"0"}

```json
2
```

- retryable (Pflichtfeld): s1303

### s1303: boolean

Ob der klassifizierte Fehler vorübergehend sein kann. Bei unbekannten Fehlern wird ein sinnvoller erneuter Versuch nicht zugesichert.

{}

- status (optional): s1304

### s1304: integer

Tatsächlich vom Upstream empfangener HTTP-Status, einschließlich 200 bei nativen Fehlern. Fehlt, wenn kein HTTP-Status verfügbar ist.

int32

{"minimum":"0"}

```json
429
```

oneOf: s588

- provider_name (optional): s644

### s644: string

Fehlgeschlagener Provider wie im Antwortfeld `provider`. Nur bei Provider-Fehlern.

{}

```json
"deepinfra"
```

- raw (optional): s645

### s645: string

Reserviertes Feld für OpenRouter-Kompatibilität. Das Gateway befüllt es nie. Freier Provider-Text wird bewusst nicht ausgegeben. Stattdessen provider_error verwenden.

{}

```json
""
```

- remedy_hint (optional): s646

### s646: string

Ein konkreter Lösungsvorschlag, beispielsweise die ähnlichste Modell-ID bei einem Tippfehler.

{}

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

- request_id (Pflichtfeld): s647

### s647: string

Anfrage-ID. Identisch mit dem Antwortheader `x-request-id`. Diese ID bei Supportanfragen angeben.

{}

```json
"req_01k7tm9qz3f5c8x2v6b4n0m7hd"
```

- requested_providers (optional): s1278

### s1278: array

Unter `provider.only` genannte Provider, wenn dadurch alle Routen ausgeschlossen wurden.

{}

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

- retry_after (optional): s649

### s649: integer

Wartezeit vor einem erneuten Versuch in Sekunden. Wird bei 429 und 503 auch als Header `Retry-After` gesendet.

int64

{"minimum":"0"}

```json
2
```

- retryable (Pflichtfeld): s650

### s650: boolean

Ob dieselbe unveränderte Anfrage bei einem erneuten Versuch erfolgreich sein kann, beispielsweise nach einer Zeitüberschreitung oder einem Anfragelimit. Im Gegensatz zu Fehlern, die eine geänderte Anfrage erfordern.

{}

- routing_funnel (optional): s1279

### s1279: array

Eingrenzung der Provider durch das Routing. Jeder Schritt nennt die Anzahl verbleibender Routen. Nur bei Routing-Fehlern, im selben Format wie bei OpenRouter.

{}

### s200: object

Ein Routing-Schritt wie unter `routing_funnel` von OpenRouter.

{}

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

- endpoint_count (Pflichtfeld): s979

### s979: integer

Anzahl der nach diesem Schritt verbleibenden Routen beziehungsweise Modell-Provider.

{"minimum":"0"}

```json
2
```

- reason (optional): s980

### s980: string

Anfragefeld, nach dem der Schritt gefiltert hat.

{}

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

- step (Pflichtfeld): s981

### s981: string

Name des Schritts wie bei OpenRouter.

{}

```json
"Initial Endpoints"
```

- type (Pflichtfeld): s1280

### s1280: string

Stabiler Fehlertyp für die Auswertung im Code. Siehe „Fehler“ in der Einführung. Meldungen können sich ändern, der Typ bleibt stabil.

"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"
```

oneOf: s588

- type (Pflichtfeld): s425

### s425: string

Anthropic's wire-level error class, selected from HTTP status and shared catalog.

"authentication_error", "invalid_request_error", "permission_error", "not_found_error", "rate_limit_error", "api_error", "overloaded_error"

{}

- type (Pflichtfeld): s847

### s847: string

Terminal failure; no successful message_stop follows.

"error"

{}

```json
"error"
```

- event (Pflichtfeld): s334

### s334: string

Named SSE event: message_start, content_block_start, content_block_delta,
content_block_stop, message_delta, message_stop, ping or error.

{}

## Antwort 400: application/json

Invalid JSON, fields, unknown model or unsupported feature; all issues use original Messages paths.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

### s23: object

Anthropic-compatible HTTP error, retaining the shared catalog under error.metadata.

{}

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

- error (Pflichtfeld): s335

### s335: object

Public protocol error with the gateway's detailed catalog metadata.

{}

- message (Pflichtfeld): s423

Safe English explanation.

- metadata (optional): s424

- type (Pflichtfeld): s425

Anthropic's wire-level error class, selected from HTTP status and shared catalog.

- request_id (Pflichtfeld): s336

### s336: string | null

Request ID, also returned in x-request-id; null when no request context is available.

{}

- type (Pflichtfeld): s337

### s337: string

Always error.

"error"

{}

## Antwort 401: application/json

Missing, invalid, ambiguous or expired API key.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 402: application/json

Insufficient organization credit or workspace/key budget before paid work.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 403: application/json

Organization, workspace or key policy prohibits the request.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 404: application/json

No compatible European endpoint for the requested model and capabilities.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 408: application/json

Request or provider deadline exceeded.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 409: application/json

Idempotency conflict, original operation still running or replay unavailable; follow remedy_hint.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 413: application/json

Request body or parsed structure exceeds the shared memory limits.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 429: application/json

Customer or upstream rate limit; respect Retry-After.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 500: application/json

Unexpected gateway or unconfirmed recording failure.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 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.

### s3: object

Jede Antwort mit HTTP-Status ab 400 hat diese Struktur im Fehlerformat von OpenRouter. Alle Gateway-Erweiterungen stehen unter `error.metadata`, damit OpenRouter-Clients keine unbekannte äußere Struktur erhalten. Der Abschnitt „Fehler“ in der Einführung nennt alle Fehlertypen.

{}

```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 (Pflichtfeld): s238

### s238: object

Fehlerbeschreibung.

{}

```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 (Pflichtfeld): s633

### s633: integer

HTTP-Status der Antwort als Zahl.

int32

{"minimum":"0"}

```json
400
```

- message (Pflichtfeld): s634

### s634: string

Fehlerbeschreibung auf Englisch. Bei mehreren Problemen werden das erste und die Anzahl weiterer genannt. Alle stehen unter `metadata.issues`. Der Text kann sich ändern. Im Code stattdessen `metadata.type` auswerten.

{}

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

- metadata (optional): s635

### s635: object

Maschinenlesbare Details: Fehlertyp, Anfrage-ID, alle Probleme, ein Lösungsvorschlag und bei Provider-Fehlern der betroffene Provider. Bei Gateway-Fehlern immer vorhanden.

{}

```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

Provider, die das Modell anbieten, wenn `provider.only` alle ausgeschlossen hat.

{}

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

- docs_url (Pflichtfeld): s640

Link zum Abschnitt dieses Fehlertyps in der Dokumentation.

- failed_routing_step (optional): s641

Routing-Schritt, nach dem keine Route übrig blieb. Nur bei Routing-Fehlern.

- issues (optional): s642

### s642: array

Alle erkannten Probleme der Anfrage, damit sie gemeinsam behoben werden können. Höchstens 20 Einträge. Bei Routing-Fehlern ein Eintrag je ausgeschlossener Route, bei `no_provider_available` einer je fehlgeschlagenem Versuch.

{}

- provider_error (optional): s643

### s643: oneOf

Sichere Provider-Diagnosen, einheitlich für HTTP-Fehler und finale Stream-Ereignisse.

{}

oneOf: s1158

### s1158: object

Provider-Diagnosen ohne vom Provider verfassten Text. HTTP-Fehler und finale SSE-Fehler verwenden dieselbe Struktur. Beliebige Upstream-Meldungen und Metadaten werden verworfen.

{}

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

- category (Pflichtfeld): s1299

### s1299: string

Gateway-Klassifizierung anhand von HTTP-Status und erkannten Dialektkennungen.

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

{}

```json
"rate_limited"
```

- code (optional): s1300

Exakte Kennung aus der festen Liste des konfigurierten Dialekts. Beliebige andere Werte werden entfernt.

- provider_name (Pflichtfeld): s1301

Konfigurierter Provider-Name. Nie ein Name aus dem Upstream-Antwortinhalt.

- retry_after (optional): s1302

Begrenzte Wartezeit in Sekunden aus dem Upstream-Header Retry-After, sofern vorhanden und numerisch.

- retryable (Pflichtfeld): s1303

Ob der klassifizierte Fehler vorübergehend sein kann. Bei unbekannten Fehlern wird ein sinnvoller erneuter Versuch nicht zugesichert.

- status (optional): s1304

Tatsächlich vom Upstream empfangener HTTP-Status, einschließlich 200 bei nativen Fehlern. Fehlt, wenn kein HTTP-Status verfügbar ist.

oneOf: s588

- provider_name (optional): s644

Fehlgeschlagener Provider wie im Antwortfeld `provider`. Nur bei Provider-Fehlern.

- raw (optional): s645

Reserviertes Feld für OpenRouter-Kompatibilität. Das Gateway befüllt es nie. Freier Provider-Text wird bewusst nicht ausgegeben. Stattdessen provider_error verwenden.

- remedy_hint (optional): s646

Ein konkreter Lösungsvorschlag, beispielsweise die ähnlichste Modell-ID bei einem Tippfehler.

- request_id (Pflichtfeld): s647

Anfrage-ID. Identisch mit dem Antwortheader `x-request-id`. Diese ID bei Supportanfragen angeben.

- requested_providers (optional): s648

### s648: array

Unter `provider.only` genannte Provider, wenn dadurch alle Routen ausgeschlossen wurden.

{}

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

- retry_after (optional): s649

Wartezeit vor einem erneuten Versuch in Sekunden. Wird bei 429 und 503 auch als Header `Retry-After` gesendet.

- retryable (Pflichtfeld): s650

Ob dieselbe unveränderte Anfrage bei einem erneuten Versuch erfolgreich sein kann, beispielsweise nach einer Zeitüberschreitung oder einem Anfragelimit. Im Gegensatz zu Fehlern, die eine geänderte Anfrage erfordern.

- routing_funnel (optional): s651

### s651: array

Eingrenzung der Provider durch das Routing. Jeder Schritt nennt die Anzahl verbleibender Routen. Nur bei Routing-Fehlern, im selben Format wie bei OpenRouter.

{}

- type (Pflichtfeld): s652

### s652: string

Stabiler Fehlertyp für die Auswertung im Code. Siehe „Fehler“ in der Einführung. Meldungen können sich ändern, der Typ bleibt stabil.

"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

Organisation des API-Keys, sofern der Key erkannt wurde.

{}

```json
"org_01k7tm2c4e6g8j0k2m4p6r8t0v"
```

## Antwort 502: application/json

Provider failure or invalid response.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```

## Antwort 503: application/json

No provider available, configuration unavailable, memory pressure or shutdown.

```json
{
  "error": {
    "message": "An API key is required.",
    "metadata": {
      "docs_url": "/docs#description/authentication",
      "request_id": "req_eu_example",
      "retryable": false,
      "type": "authentication"
    },
    "type": "authentication_error"
  },
  "request_id": "req_eu_example",
  "type": "error"
}
```
