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
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 --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
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
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
// 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.
Body: application/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.
{}
{
"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 (required): 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.
{}
{
"content": [
{
"content": "12 degrees Celsius",
"tool_use_id": "call_eu_weather",
"type": "tool_result"
}
],
"role": "user"
}
- content (required): 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 (required): s1088
s1088: string
Original text, not a provider instruction inferred from metadata.
{}
- type (required): s1089
s1089: string
"text"
{}
oneOf: s429
s429: object
User image, subject to the existing protected media validation and route capabilities.
{}
- source (required): 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 (required): s1083
s1083: string
"url"
{}
- url (required): 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 (required): s1085
s1085: string
Encoded image bytes, validated by the common media path.
{}
- media_type (required): s1086
s1086: string
An allowed image MIME type.
"image/jpeg", "image/png", "image/gif", "image/webp"
{}
- type (required): s1087
s1087: string
"base64"
{}
- type (required): s1091
s1091: string
"image"
{}
oneOf: s430
s430: object
User base64 PDF; shared file-parser/OCR admission, policy and charges still apply.
{}
- source (required): 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 (required): s1105
s1105: string
Base64 PDF bytes; validity, size, OCR policy and charges are checked by the shared path.
{}
- media_type (required): s1106
s1106: string
Exactly application/pdf.
"application/pdf"
{}
- type (required): s1087
- type (required): s1093
s1093: string
"document"
{}
oneOf: s431
s431: object
Previous assistant request for client execution, never gateway execution.
{}
- id (required): s1094
s1094: string
Tool call correlation identifier.
{}
- input (required): s1095
s1095: object
Function argument object, not arbitrary message content.
{}
- name (required): s470
s470: string
Client function name.
{}
- type (required): 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 (required): s1116
s1116: string
Tool output text.
{}
- type (required): s1089
oneOf: s463
s463: object
Protected image input.
{}
- source (required): s1117
s1117: oneOf
Existing URL/base64 image forms.
{}
oneOf: s426
oneOf: s427
- type (required): s1091
oneOf: s464
s464: object
Inline PDF through the shared file-parser/OCR lifecycle.
{}
- source (required): s1118
s1118: oneOf
Existing base64 PDF form only.
{}
oneOf: s441
- type (required): s1093
- is_error (optional): s1098
s1098: boolean
True appends an explicit error note without changing the original tool output.
{}
- tool_use_id (required): s1099
s1099: string
Identifier of the corresponding assistant client-tool request.
{}
- type (required): s1100
s1100: string
"tool_result"
{}
oneOf: s433
s433: object
Previous assistant reasoning, accepted only as unsigned, untrusted text.
{}
- signature (required): s1101
s1101: string
Required; only the empty unsigned sentinel is usable, nonempty signatures fail not_available.
{}
- thinking (required): s1102
s1102: string
Visible reasoning history, not authenticated provider state.
{}
- type (required): s1103
s1103: string
"thinking"
{}
- role (required): 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 (required): s312
s312: string
Public EU model ID or gateway alias, not an Anthropic-hosted model name.
{}
"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
A piece of text.
{}
{
"text": "What is shown in this picture?",
"type": "text"
}
- text (required): s531
s531: string
A piece of text.
{}
- type (required): s532
s532: string
Kind of the part; names the field that carries the content.
"text"
{}
"text"
- * (optional): s533
s533: any
Further fields (for example cache_control), passed to the provider as sent.
{}
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.
{}
{
"budget_tokens": 1024,
"type": "enabled"
}
oneOf: s1064
s1064: object
{}
- budget_tokens (required): 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 (required): s1256
s1256: string
"enabled"
{}
oneOf: s1065
s1065: object
{}
- type (required): s1257
s1257: string
"disabled"
{}
oneOf: s1066
s1066: object
{}
- display (optional): s1255
Visible trace presentation; only omitted is supported, the others fail not_available.
- type (required): s1258
s1258: string
"adaptive"
{}
oneOf: s1067
s1067: object
{}
- type (required): 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.
{}
{
"disable_parallel_tool_use": true,
"name": "get_weather",
"type": "tool"
}
oneOf: s1069
s1069: object
{}
- disable_parallel_tool_use (optional): s1260
s1260: boolean
{}
- type (required): s1261
s1261: string
"auto"
{}
oneOf: s1070
s1070: object
{}
- disable_parallel_tool_use (optional): s1260
- type (required): s1262
s1262: string
"any"
{}
oneOf: s1071
s1071: object
{}
- disable_parallel_tool_use (optional): s1260
- type (required): s1263
s1263: string
"none"
{}
oneOf: s1072
s1072: object
{}
- disable_parallel_tool_use (optional): s1260
- name (required): s7
- type (required): 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.
{}
{
"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 (required): s459
s459: any
JSON Schema object describing the tool input.
{}
- name (required): 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 (required): 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.
{}
Response 200: application/json
Anthropic message or named event stream; usage and cost reflect the shared Chat generation.
{
"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.
{}
{
"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 (required): s323
s323: null
No provider execution container is created by this Chat-backed adapter.
{}
- content (required): 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 (required): s452
s452: null
Citations are unavailable; ordinary generated text is not converted to citations.
{}
- text (required): s453
s453: string
Generated text.
{}
- type (required): s454
s454: string
Generated text; this adapter does not infer citations.
"text"
{}
"text"
oneOf: s439
s439: object
Client function request, not native execution.
{}
- caller (required): s467
s467: object
Only direct client calls are produced.
{}
- type (required): s422
s422: string
Direct client-function caller, without server execution or a container context.
"direct"
{}
"direct"
- id (required): s468
s468: string
Correlation identifier preserved on tool_result.
{}
- input (required): s469
s469: object
Function argument object; dynamic client arguments are not arbitrary message blocks.
{}
- name (required): s470
Client function name.
- type (required): s471
s471: string
A client function request, never server-side execution.
"tool_use"
{}
"tool_use"
oneOf: s440
s440: object
Unsigned reasoning text, not authenticated state.
{}
- signature (required): s455
s455: string
Runtime emits only the empty unsigned sentinel; the wire type is a string, not an integrity proof.
{}
- thinking (required): s456
s456: string
Reasoning text from the EU Chat model.
{}
- type (required): s457
s457: string
Visible unsigned reasoning; no cryptographic integrity or native signed-history replay is claimed.
"thinking"
{}
"thinking"
- id (required): s325
s325: string
Gateway generation ID, also available in x-generation-id.
{}
- model (required): s326
s326: string
Actual EU model after alias resolution and routing.
{}
- role (required): s327
s327: string
Always assistant.
"assistant"
{}
- stop_details (required): s328
s328: null
No structured refusal classification is inferred from Chat output.
{}
- stop_reason (required): 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 (required): s330
s330: string | null
Reported matched sequence, otherwise null. Chat-backed routes generally do not report it.
{}
- type (required): s331
s331: string
Always message.
"message"
{}
- usage (required): 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.
{}
{
"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 (required): 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 (required): s1119
s1119: integer
Cache writes with one-hour TTL.
int64
{"minimum":"0"}
- ephemeral_5m_input_tokens (required): s1120
s1120: integer
Cache writes with five-minute TTL.
int64
{"minimum":"0"}
- cache_creation_input_tokens (required): s474
s474: integer | null
Reported cache-write count, null when unavailable; never invented as zero.
int64
{"minimum":"0"}
- cache_read_input_tokens (required): s475
s475: integer | null
Reported cache-read count, null when unavailable; never invented as zero.
int64
{"minimum":"0"}
- inference_geo (required): s476
s476: string | null
Reported inference geography, null when unavailable.
{}
- input_tokens (required): s477
s477: integer
Cumulative provider input tokens, or provisional zero on message_start only.
int64
{"minimum":"0"}
- output_tokens (required): s478
s478: integer
Cumulative provider output tokens, or provisional zero on message_start only.
int64
{"minimum":"0"}
- output_tokens_details (required): s479
s479: object | null
Provider-reported thinking-token detail, or null when unavailable; visible reasoning is not counted as a measurement.
{}
- thinking_tokens (required): s1121
s1121: integer
Measured thinking tokens.
int64
{"minimum":"0"}
- server_tool_use (required): 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 (required): s1122
s1122: integer
Native web fetches.
int64
{"minimum":"0"}
- web_search_requests (required): s1123
s1123: integer
Native web searches.
int64
{"minimum":"0"}
- service_tier (required): 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.
{}
Response 200: text/event-stream
Anthropic message or named event stream; usage and cost reflect the shared Chat generation.
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.
{}
{
"data": {
"delta": {
"text": "Hello",
"type": "text_delta"
},
"index": 0,
"type": "content_block_delta"
},
"event": "content_block_delta"
}
- data (required): 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 (required): s849
s849: object
Initial message: empty content, null completion reason, provisional 0/0 usage.
{}
- container (required): s323
No provider execution container is created by this Chat-backed adapter.
- content (required): s444
s444: array
No content has been emitted at message_start.
{"maxItems":"0"}
- id (required): s445
s445: string
Gateway generation identifier.
{}
- model (required): s446
s446: string
Actual routed model.
{}
- role (required): s447
s447: string
Always assistant.
"assistant"
{}
- stop_details (required): s328
No structured refusal classification is inferred from Chat output.
- stop_reason (required): s448
s448: null
Completion reason is unknown at message_start; this is not a finished message.
{}
- stop_sequence (required): s449
s449: null
No matched stop sequence is known at message_start.
{}
- type (required): s450
s450: string
Always message.
"message"
{}
- usage (required): 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.
{}
{
"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 (required): s1107
s1107: null
No cache TTL measurement exists at message_start.
{}
- cache_creation_input_tokens (required): s1108
s1108: null
No cache-write measurement exists at message_start.
{}
- cache_read_input_tokens (required): s1109
s1109: null
No cache-read measurement exists at message_start.
{}
- inference_geo (required): s1110
s1110: null
No provider-reported inference geography exists at message_start.
{}
- input_tokens (required): s1111
s1111: integer
Provisional wire-only zero at message_start, never a token measurement or accounting value.
{"minimum":"0","maximum":"0"}
- output_tokens (required): s1111
Provisional wire-only zero at message_start, never a token measurement or accounting value.
- output_tokens_details (required): s1112
s1112: null
No thinking-token measurement exists at message_start.
{}
- server_tool_use (required): s1113
s1113: null
No native server-tool measurement exists at message_start.
{}
- service_tier (required): s1114
s1114: null
No provider-reported service tier exists at message_start.
{}
- * (optional): s1115
s1115: any
Existing gateway billing metadata, retaining explicit currencies.
{}
- metadata (required): 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 (required): s1202
s1202: string
Wire counters are provisional and never accounting evidence.
"pending"
{}
- type (required): s851
s851: string
Initial message identity with provisional, non-accounting counters.
"message_start"
{}
"message_start"
oneOf: s854
s854: object
Measured final usage and completion reason.
{}
- delta (required): s842
s842: object
Final completion reason and explicit absence of execution context.
{}
- container (required): s323
No provider execution container is created by this Chat-backed adapter.
- stop_details (required): s328
No structured refusal classification is inferred from Chat output.
- stop_reason (required): 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 (required): s437
s437: string | null
Matched sequence if known, otherwise null.
{}
- metadata (required): 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 (required): s1201
s1201: string
Final cumulative counters are actual measurements replacing provisional wire counters.
"measured"
{}
- type (required): s844
s844: string
Final metadata with actual cumulative usage; unknown counters fail instead of completing.
"message_delta"
{}
"message_delta"
- usage (required): s845
s845: object
Actual cumulative token counts, replacing rather than adding to initial counters.
{}
{
"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 (required): s473
- cache_creation_input_tokens (required): s474
Reported cache-write count, null when unavailable; never invented as zero.
- cache_read_input_tokens (required): s475
Reported cache-read count, null when unavailable; never invented as zero.
- inference_geo (required): s476
Reported inference geography, null when unavailable.
- input_tokens (required): s477
Cumulative provider input tokens, or provisional zero on message_start only.
- output_tokens (required): s478
Cumulative provider output tokens, or provisional zero on message_start only.
- output_tokens_details (required): s479
- server_tool_use (required): s480
- service_tier (required): 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 (required): s852
s852: string
Successful terminal event after final usage and durable recording.
"message_stop"
{}
"message_stop"
oneOf: s856
s856: object
Begin a supported content block.
{}
- content_block (required): s837
s837: anyOf
Output blocks actually produced by the bounded Chat-backed adapter.
{}
anyOf: s1198
s1198: object
Generated text without inferred citations.
{}
- citations (required): s452
Citations are unavailable; ordinary generated text is not converted to citations.
- text (required): s453
Generated text.
- type (required): s454
Generated text; this adapter does not infer citations.
anyOf: s1199
s1199: object
Client function request, not native execution.
{}
- caller (required): s467
- id (required): s468
Correlation identifier preserved on tool_result.
- input (required): s469
Function argument object; dynamic client arguments are not arbitrary message blocks.
- name (required): s470
Client function name.
- type (required): s471
A client function request, never server-side execution.
anyOf: s1200
s1200: object
Unsigned reasoning text, not authenticated state.
{}
- signature (required): s455
Runtime emits only the empty unsigned sentinel; the wire type is a string, not an integrity proof.
- thinking (required): s456
Reasoning text from the EU Chat model.
- type (required): s457
Visible unsigned reasoning; no cryptographic integrity or native signed-history replay is claimed.
- index (required): s838
s838: integer
Stable zero-based block index.
int32
{"minimum":"0"}
- type (required): s839
s839: string
Start of one text, client-tool or unsigned-thinking block.
"content_block_start"
{}
"content_block_start"
oneOf: s857
s857: object
Incremental text, client-tool JSON or unsigned thinking.
{}
- delta (required): s834
s834: oneOf
Incremental data emitted for the adapter's supported content blocks.
{}
oneOf: s1194
s1194: object
{}
- text (required): s7
- type (required): s1328
s1328: string
"text_delta"
{}
oneOf: s1195
s1195: object
{}
- partial_json (required): s7
- type (required): s1329
s1329: string
"input_json_delta"
{}
oneOf: s1196
s1196: object
{}
- thinking (required): s7
- type (required): s1330
s1330: string
"thinking_delta"
{}
oneOf: s1197
s1197: object
{}
- signature (required): s7
- type (required): s1331
s1331: string
"signature_delta"
{}
- index (required): s835
s835: integer
Stable index of the open block.
int32
{"minimum":"0"}
- type (required): s836
s836: string
Incremental content for an already open supported block.
"content_block_delta"
{}
"content_block_delta"
oneOf: s858
s858: object
Finish an open content block.
{}
- index (required): s840
s840: integer
Index of the block being closed.
int32
{"minimum":"0"}
- type (required): s841
s841: string
Closes one open content block.
"content_block_stop"
{}
"content_block_stop"
oneOf: s859
s859: object
Keepalive event.
{}
- type (required): s848
s848: string
Keepalive without generated content or usage.
"ping"
{}
"ping"
oneOf: s860
s860: object
Terminal error instead of a successful stop.
{}
- error (required): s846
s846: object
Safe Anthropic error class plus existing gateway catalog metadata.
{}
- message (required): 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
Details of an error for programs. Not part of OpenRouter's format, which leaves metadata open; clients that do not know these fields can ignore them.
{}
{
"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
Providers that serve the model (when provider.only excluded all of them).
{}
[
"deepinfra",
"open-inference"
]
- docs_url (required): s640
s640: string
Link to the section of this error type in the documentation.
{}
"/docs#description/model-not-found"
- failed_routing_step (optional): s641
s641: string
The routing step that left no route (routing errors only).
{}
"Filter by Max Price"
- issues (optional): s1276
s1276: 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.
{}
{
"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"
{}
"out_of_range"
- message (required): s637
s637: string
The problem in English, naming the field and, if short, the value sent.
{}
"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.
{}
"$.temperature"
- provider_error (optional): s1277
s1277: oneOf
Safe provider diagnostics, identical for HTTP errors and terminal stream events.
{}
oneOf: s1336
s1336: object
Provider diagnostics without provider-authored text. HTTP and terminal SSE errors use this same structure; arbitrary upstream messages and metadata are discarded.
{}
{
"category": "rate_limited",
"provider_name": "deepinfra",
"retry_after": 2,
"retryable": true,
"status": 429
}
- category (required): s1350
s1350: string
Gateway classification from HTTP status and recognized dialect identifiers.
"rate_limited", "overloaded", "invalid_request", "context_length", "content_filtered", "authentication", "billing", "timeout", "unavailable", "unknown"
{}
"rate_limited"
- code (optional): s1300
s1300: string
Exact identifier from the configured dialect's fixed list; arbitrary values vanish.
{}
"rate_limit_exceeded"
- provider_name (required): s1301
s1301: string
Configured provider name, never a name supplied by the upstream body.
{}
"deepinfra"
- retry_after (optional): s1302
s1302: integer
Bounded seconds from the upstream Retry-After header, when present and numeric.
int64
{"minimum":"0"}
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"}
429
oneOf: s588
- provider_name (optional): s644
s644: string
The provider that failed, as in the response field provider (provider errors only).
{}
"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.
{}
""
- remedy_hint (optional): s646
s646: string
A concrete fix, for example the closest model ID to a mistyped one.
{}
"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.
{}
"req_01k7tm9qz3f5c8x2v6b4n0m7hd"
- requested_providers (optional): s1278
s1278: array
Providers named in provider.only (when it excluded all routes).
{}
[
"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"}
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): s1279
s1279: 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.
{}
{
"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"}
2
- reason (optional): s980
s980: string
The request field the step filtered on.
{}
"provider.only"
- step (required): s981
s981: string
Name of the step, as at OpenRouter.
{}
"Initial Endpoints"
- type (required): s1280
s1280: 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"
{}
"invalid_parameter"
oneOf: s588
- type (required): 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 (required): s847
s847: string
Terminal failure; no successful message_stop follows.
"error"
{}
"error"
- event (required): s334
s334: string
Named SSE event: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping or error.
{}
Response 400: application/json
Invalid JSON, fields, unknown model or unsupported feature; all issues use original Messages paths.
{
"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.
{}
{
"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 (required): s335
s335: object
Public protocol error with the gateway's detailed catalog metadata.
{}
- message (required): s423
Safe English explanation.
- metadata (optional): s424
- type (required): s425
Anthropic's wire-level error class, selected from HTTP status and shared catalog.
- request_id (required): s336
s336: string | null
Request ID, also returned in x-request-id; null when no request context is available.
{}
- type (required): s337
s337: string
Always error.
"error"
{}
Response 401: application/json
Missing, invalid, ambiguous or expired API key.
{
"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"
}
Response 402: application/json
Insufficient organization credit or workspace/key budget before paid work.
{
"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"
}
Response 403: application/json
Organization, workspace or key policy prohibits the request.
{
"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"
}
Response 404: application/json
No compatible European endpoint for the requested model and capabilities.
{
"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"
}
Response 408: application/json
Request or provider deadline exceeded.
{
"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"
}
Response 409: application/json
Idempotency conflict, original operation still running or replay unavailable; follow remedy_hint.
{
"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"
}
Response 413: application/json
Request body or parsed structure exceeds the shared memory limits.
{
"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"
}
Response 429: application/json
Customer or upstream rate limit; respect Retry-After.
{
"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"
}
Response 500: application/json
Unexpected gateway or unconfirmed recording failure.
{
"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"
}
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.
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.
{}
{
"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.
{}
{
"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"}
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.
{}
"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.
{}
{
"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).
{}
[
"deepinfra",
"open-inference"
]
- docs_url (required): s640
Link to the section of this error type in the documentation.
- failed_routing_step (optional): s641
The routing step that left no route (routing errors only).
- 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.
{}
- 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.
{}
{
"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"
{}
"rate_limited"
- code (optional): s1300
Exact identifier from the configured dialect's fixed list; arbitrary values vanish.
- provider_name (required): s1301
Configured provider name, never a name supplied by the upstream body.
- retry_after (optional): s1302
Bounded seconds from the upstream Retry-After header, when present and numeric.
- retryable (required): s1303
Whether the classified failure can be transient. Unknown failures are not promised retryable.
- status (optional): s1304
Actual HTTP status received from the upstream, including 200 for native errors. Absent when no HTTP status is available.
oneOf: s588
- provider_name (optional): s644
The provider that failed, as in the response field provider (provider errors only).
- raw (optional): s645
Reserved OpenRouter compatibility field. The gateway never fills it: provider free text is deliberately withheld. Use provider_error instead.
- remedy_hint (optional): s646
A concrete fix, for example the closest model ID to a mistyped one.
- request_id (required): s647
ID of the request, the same as the x-request-id response header. Quote it when contacting support.
- requested_providers (optional): s648
s648: array
Providers named in provider.only (when it excluded all routes).
{}
[
"scaleway"
]
- retry_after (optional): s649
Seconds to wait before retrying; also sent as the Retry-After header (429 and 503).
- retryable (required): s650
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).
{}
- 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"
{}
"invalid_parameter"
- user_id (optional): s239
s239: string | null
Organization of the API key, if the key was recognized.
{}
"org_01k7tm2c4e6g8j0k2m4p6r8t0v"
Response 502: application/json
Provider failure or invalid response.
{
"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"
}
Response 503: application/json
No provider available, configuration unavailable, memory pressure or shutdown.
{
"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"
}