Chatantwort erstellen

Sends the conversation to the model and returns its answer, as one JSON response or, with stream: true, as server-sent events while it is generated. Same format as OpenRouter.

The gateway picks a European provider of the model (respecting provider preferences) and, if it fails before sending output, tries the next one and then the models fallbacks. The body is validated completely before any provider is called; every problem is listed in error.metadata.issues. Unknown parameters are ignored and named in x-ignored-params. usage.cost is the price of the request in EUR. For a provider with prices in another currency, usage.cost_details.original adds its costs in that currency and the exchange rate (version and time) the EUR amounts were converted with.

PDFs: If no selected chat route accepts file input, PDFs are automatically extracted through file-parser when bridge mode, provider policy, data class and the automatic reservation ceiling permit it. OCR must match the compliance and ZDR of every admitted chat target. plugins: [{"id":"file-parser","enabled":false}] opts out unless locked by policy. Refused/failed automatic work preserves the native 404; bridge_failed names data_class, cost_cap, format or bridge_error. Explicit plugins: [{"id":"file-parser","pdf":{"engine":"mistral-ocr"}}] extracts up to eight PDFs before inference through the engine's configured OCR model. Inline base64 PDFs are accepted; remote HTTP(S) PDFs require media_transport.fetch_enabled. The protected loader checks hosts and public addresses at every redirect, byte limits and deadlines. Disabled fetching, file IDs and unmapped engines fail with field issues and a remedy hint. Extracted text is limited to 4 MiB and checked against the model's context. Extraction runs once across fallbacks, costs usage.cost_details.ocr_cost in EUR (included in total cost), and also works before streaming. With missing inference usage, the known OCR charge is returned without inventing a total or token counts. With fetching enabled, allowed automatic URL file bridges load once only when native admission lacks file input; explicit file-parser also runs on native file models. Content-Type and signature must agree; names are not type evidence. Fetch failures keep media errors; unsupported formats keep the native 404 with bridge_failed=format. Loading is free and adds no bridge entry. UTF-8 files of type text/plain, text/markdown, text/html, text/csv or application/json use the same file-parser policy and opt-out, automatically only when native file admission fails, or explicitly through the plugin. They are decoded locally for free, without OCR: the text part is [File <name>, <mime>] followed by a newline and the content. A UTF-8 BOM is removed; HTML is unchanged. All text files together may contain at most 4 MiB. Executed file-parser bridges are announced in x-tokenlane-bridges before any response body, including SSE. usage.cost_details.bridge_cost is their EUR aggregate (currently equal to the compatibility field ocr_cost), not an additional charge. bridges[] contains the same GenerationPreprocessing entries as GET /v1/generation: id=file-parser, model, provider, unit, quantity and exact cost_pico_eur. No bridge means no new fields.

Audio: plugins: [{"id":"media"}] transcribes inline input_audio for a model without audio input over the cheapest permitted configured transcription route, before the first byte, into a text part [Audio transcript] …; billed per started second as a bridges[] entry id=media, kind=transcription, unit=second. Models with audio input receive the audio natively. A failed transcription keeps the original 404 with bridge_failed. As for OCR, only paid provider work is billed: transcriptions the provider charged in this request (earlier audio parts, or a paid invalid result) remain billed, own fees are waived on the failed request.

PII: plugins: [{"id":"pii-redact","entities":["email"],"restore":true}] scans bounded text conversations with the configured approved EU detector. Key/organization rules can enforce redaction per route; fallbacks reevaluate those rules. Input is limited to 64 KiB and 128 text parts; tools, unextracted media and unscanned free-text options fail closed. usage.cost_details includes pii_cost, pii_characters, pii_calls and pii_duration_ms. Text output can be restored across stream chunks with bounded memory. For json_object content, restored entities are JSON-escaped, including across chunks. Detector failures block by default; optional fail-open never bypasses enforced policies.

Broken JSON: by default (no plugin needed) and with response_format json_object or json_schema, a non-streaming answer whose content is not valid JSON (code fences, trailing commas, cut-off output) is repaired; valid JSON and content that cannot be repaired are returned unchanged, and streams are never changed. plugins: [{"id": "response-healing", "enabled": false}] turns the repair off.

Unusable answers: a well-formed non-streaming answer that finished with stop but has no content, tool call or refusal (only reasoning, or nothing), or that repeats itself until the output limit, counts as a failed attempt: the next route is tried and the route's circuit breaker counts a failure. Without another route the error is provider_invalid_response; the customer is not charged for it (C-333). An answer cut off at the output limit before any content is legitimate (too small max_tokens) and returned with an x-remedy-hint header. The rules are configuration data (answer_checks).

Which provider is tried first: provider.sort orders the providers of the model by price (lowest price of one input plus one output token, in EUR), latency (shortest time until the first byte of a streamed answer) or throughput (most output tokens per second). Providers named in provider.order still come first. If a provider fails before sending output, the next one is tried, unless provider.allow_fallbacks is false.

Tariff variants: a provider may offer a model in several tariffs, for example a cache tariff with cheap cache reads but higher base prices. Each variant is a route of its own with the endpoint tag <provider>/<variant> (GET /v1/models lists it as routes[].tag, e.g. grunden/cache). A variant serves a request only when provider.only or provider.order names its tag; it never takes part in fallback or provider.sort and is excluded from the model-wide catalog price unless the model has no standard route. A provider ID alone names the standard route; in provider.ignore it excludes the variants as well. The object form {"by": "price", "partition": "none"} sorts the providers of model and of all models fallbacks together, so a cheaper fallback model may answer first; the default "partition": "model" keeps fallback models behind model. Differences from OpenRouter: latency and throughput are shared across gateway nodes through Valkey, as the median of each provider's last 32 answers within 30 minutes; only streamed answers count for latency, and providers without measurements come after measured ones, in the gateway's default order. exacto is accepted but keeps the default order (no ranking by tool-calling quality yet).

POST https://api.tokenlane.de/v1/chat/completions

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 --request POST \
  --url 'https://api.tokenlane.de/v1/chat/completions' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "max_tokens": 200,
  "messages": [
    {
      "content": "Answer in one sentence.",
      "role": "system"
    },
    {
      "content": "What is the capital of Portugal?",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  },
  "temperature": 0.2
}'

node

import OpenAI from 'openai';

const client = new OpenAI({ baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY });
const response = await client.chat.completions.create({
  "max_tokens": 200,
  "messages": [
    {
      "content": "Answer in one sentence.",
      "role": "system"
    },
    {
      "content": "What is the capital of Portugal?",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  },
  "temperature": 0.2
}, {});
console.log(response);

python

import os
import json
from openai import OpenAI

client = OpenAI(base_url="https://api.tokenlane.de/v1", api_key=os.environ["TOKENLANE_API_KEY"])
body = json.loads(r'''{
  "max_tokens": 200,
  "messages": [
    {
      "content": "Answer in one sentence.",
      "role": "system"
    },
    {
      "content": "What is the capital of Portugal?",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  },
  "temperature": 0.2
}''')
response = client.chat.completions.create(
    model=body["model"],
    messages=body["messages"],
    max_tokens=body["max_tokens"],
    temperature=body["temperature"],
    extra_body=json.loads(r'''{
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  }
}''')
)
print(response)

vercel

import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';

const tokenlane = createOpenAICompatible({ name: 'tokenlane', baseURL: "https://api.tokenlane.de/v1", apiKey: process.env.TOKENLANE_API_KEY, includeUsage: true });
const result = await generateText({
  model: tokenlane("deepseek/deepseek-v4-flash-0731"),
  system: "Answer in one sentence.",
  messages: [
  {
    "content": "What is the capital of Portugal?",
    "role": "user"
  }
],
  maxOutputTokens: 200,
  temperature: 0.2,
  providerOptions: { tokenlane: {
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  }
} },
});
console.log(result.text);

Header: Idempotency-Key (optional)

Ausdrückliches Opt-in zur verschlüsselten Antwortwiederholung über alle Gateway-Knoten. Ein Wert aus 1 bis 255 druckbaren ASCII-Zeichen pro logischem Vorgang, begrenzt auf die Identität dieses API-Keys. Methode, Pfad und normalisierten Body unverändert wiederholen. Abgeschlossene Antworten bleiben höchstens zehn Minuten verfügbar; eine Wiederholung ist kostenlos und erzeugt keine neue Generierung. Abweichender Inhalt oder eine nicht sicher wiederholbare Antwort ergibt 409. Eine erfolgreiche Wiederholung enthält Idempotent-Replayed: true und erhält die ursprünglichen Request- und Generation-IDs. Siehe /docs/guides/idempotency.

s0: string | null

{}

Header: x-session-id (optional)

Ordnet die Generierung einer Session zu, die über GET /v1/sessions/{id} aufgelistet wird. Erlaubt sind 1 bis 256 Zeichen aus Buchstaben, Ziffern, -, _, . und :. Das Feld session_id im Anfrageinhalt hat Vorrang.

Anfrageinhalt: application/json

{
  "max_tokens": 200,
  "messages": [
    {
      "content": "Answer in one sentence.",
      "role": "system"
    },
    {
      "content": "What is the capital of Portugal?",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4-flash-0731",
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  },
  "temperature": 0.2
}

s11: object

A conversation and its generation options, in OpenRouter's format: existing OpenRouter and OpenAI clients work by changing only the base URL and the API key.

Besides the fields listed here, every parameter of OpenRouter's chat API is accepted, for example max_tokens (upper limit of output tokens), temperature (0 to 2), top_p, stop, seed, tools and tool_choice, response_format (json_object or json_schema), reasoning (effort, max_tokens, exclude) and provider (routing preferences: only, ignore, order, allow_fallbacks, require_parameters, max_price, sort). Differences from OpenRouter:

  • Requested controls in receipts: n and transforms are validated and recorded as requested, but remain listed in x-ignored-params and do not affect execution. The gateway continues to request a single generation without message transforms.
  • Output bound: max_tokens and max_completion_tokens express one upper bound, reasoning included. With two valid positive integers the smaller wins; with one, that value wins. Suitable routes receive one native field with this bound, including after aliases, renames and fallback. A string or zero remains a tolerated ignored input. provider.require_parameters: true excludes routes whose mappings cannot preserve total-output semantics. Reservation uses the effective bound, not the larger alias; actual provider usage is settled separately and is not truncated to the reservation.
  • Prices in EUR: provider.max_price is in EUR per million tokens ({"prompt": 0.5, "completion": 2}), not USD; costs in usage are EUR as well. Price limits and provider.sort: "price" use exact exchange-rate quotients before rounding; a zero price limit excludes every positive price.
  • Checked before any provider is called: the whole body is validated first, and every problem is listed in error.metadata.issues (400 invalid_parameter). Requests OpenRouter passes on and lets the provider reject (unknown role, unknown response_format, broken tool schema, tool_choice naming an undefined tool, invalid media URL or base64) fail here at once, without cost. Response and tool schemas are structurally checked within 32 JSON levels, 4,096 values and 256 KiB of content; field names are limited to 256 bytes. References must resolve locally. Boolean subschemas and recursive local references are supported; unknown vocabulary keywords remain provider-specific. This is not instance validation. Locally available PNG/JPEG/GIF/WebP headers and dimensions are checked within 64 KiB, including the first PNG chunk's CRC; compressed pixel data is not decoded.
  • Mixed provider failures: a definitive content rejection plus only unclassified failures returns 400 with per-provider issues and no Retry-After. Explicitly profiled outages and transport timeouts retain retryable service-failure semantics.
  • Unknown parameters are ignored, as on OpenRouter, and named in the x-ignored-params response header, so typos do not go unnoticed. usage: {"include": true} is accepted silently: usage is always included.
  • Provider slugs in provider.only, provider.ignore and provider.order are matched case-insensitively, including variant tags. Failed only/order filters suggest a close serving slug when one exists; unknown optional preferences remain harmless.
  • Reasoning compatibility: legacy include_reasoning: false maps to reasoning.exclude: true (true maps to false); an explicit reasoning.exclude wins. A route unable to disable reasoning still hides its output and charges actual tokens; the unfulfilled control (reasoning.effort, reasoning.enabled or reasoning.max_tokens) is named in x-ignored-params for the answering route. Messages and stream deltas expose reasoning_details alongside reasoning text: plain text becomes an indexed reasoning.text block; original structured blocks and their signatures, IDs and order are preserved, never replaced with synthesized text. Excluding reasoning removes both views.
  • Balanced routing: without a request or policy sort and without provider.order, otherwise equivalent routes are sampled without replacement using inverse-square weights of their EUR prompt-plus-completion token price. Routes without a failure in the last 30 seconds are preferred. Existing eligibility and routing tiers still apply.
  • **provider.sort:** price sorts by EUR prompt-plus-completion price. latency and throughput use shared Valkey measurements across gateway instances: the median of the last 32 answers per provider within 30 minutes. Unmeasured providers come last. exacto is accepted but preserves configured order, not Balanced selection.
  • Soft performance preferences: provider.preferred_max_latency (seconds) and provider.preferred_min_throughput (output tokens/second) accept a non-negative number for p50, or an object with p50, p75, p90, p99 thresholds. Shared measurements use the last 32 answers within five minutes. Missing measurements or any missed threshold move a route behind otherwise equivalent matching routes, never exclude it. Latency is evaluated at millisecond precision, throughput at thousandths of a token/second.
  • Routing variants: :nitro selects throughput sorting and :floor price sorting; an explicit provider.sort wins. The primary model's variant sets sorting for the whole request, including fallback models. Variants are removed before model-policy checks; they do not bypass allowed_models. Responses name the resolved base model, while generation receipts retain the requested suffix.
  • Required parallel tool calls: with provider.require_parameters: true, parallel_tool_calls: true requires a route with parallel tool support. false also permits serial tool routes, provided the parameter reaches the provider. Null or an absent field imposes no parallel-tool requirement.
  • Required tool choice: with provider.require_parameters: true, tool_choice: "required" or a named function excludes routes marked as unable to enforce forced choice. Such routes may still accept auto/none; without require_parameters, choice is forwarded subject to the route's ordinary parameter mapping.
  • Sessions: session_id (or the x-session-id header; the field wins) groups generations, listed by GET /v1/sessions/{id}, and is never sent to the provider. It must have 1 to 256 characters from letters, digits, -, _, . and :, otherwise the request fails with 400 invalid_parameter.
  • Assistant reasoning history: reasoning (or reasoning_content) is text; reasoning_details is an ordered array of reasoning.text, reasoning.summary and reasoning.encrypted blocks. Only assistant messages may carry these fields. A route maps plaintext or explicitly accepts the original provider-bound details; otherwise unsupported reasoning is removed before sending. Text mappings never expose opaque or summary blocks as plaintext. reasoning.exclude only affects new output.
  • Limits: the body may have at most 50 MiB; see "Limits" in the introduction.
  • Plugins and server tools: plugins never reaches the provider. response-healing and file-parser run in the gateway. web (web search) works only with a model whose provider offers it and a key whose policy allows web_search; it takes max_results (1 to 20), max_uses (1 to 100, capped by the provider route) and engine (auto or native), and each search is charged on top of the tokens. Explicit max_uses and max_results are hard routing requirements even with provider.require_parameters false: a route must translate them or be excluded before any upstream call. If no route can enforce them, 404 no_endpoint identifies the unsupported limits and suggests a remedy. Missing or null limits use route defaults; a disabled plugin requests no search. Other OpenRouter plugins, server tools in tools (e.g. openrouter:web_search), a tool_choice naming one, and web_search_options fail with 400 invalid_parameter (issue code not_available) instead of running unbilled; a plugin with enabled: false is accepted. stop_server_tools_when is ignored (named in x-ignored-params).
  • PDF extraction: plugins: [{"id":"file-parser","pdf":{"engine":"mistral-ocr"}}] converts up to eight PDF file parts into text before inference, using the engine's configured OCR model. Missing pdf/engine defaults to mistral-ocr. Inline base64 PDFs are accepted; remote HTTP(S) PDFs require media_transport.fetch_enabled. The protected loader enforces host policy, public destination addresses at every redirect, byte limits and deadlines. Disabled fetching, file IDs, unmapped engines and non-PDF media fail with collected issues and a remedy hint. The extracted text is limited to 4 MiB per request, is checked against the model's context, and is reused across fallbacks. OCR costs are included in usage.cost and separately in usage.cost_details.ocr_cost (EUR), with ocr_documents. With missing inference usage, only the known OCR detail is returned; no token counts or total cost are invented. Streams begin after extraction and then pass through without buffering. Disabled file-parser leaves file parts to routes with native file support. Where the operator maps an engine to tokenlane/pdf-text, the gateway's own media worker reads the PDF text layer instead of OCR (receipt kind text_layer). Unlike OCR, this includes text that is invisible on the rendered page (white or hidden text, OCR layers of scans). Automatic selection uses it first and falls back to OCR for documents with pages without enough text or mostly scanned pages, named by the receipt's fallback.
  • Tool calls are checked by default (tool-call-healing; unlike OpenRouter, which passes them unchanged): with tools, every returned call must name one of them, carry a JSON object as arguments and include the schema's required arguments. Unambiguous defects are repaired (leaked model-format markers such as </arg_value> in names or arguments, <arg_key>/<arg_value> pairs, almost-JSON); valid calls stay byte-identical. A call that cannot be repaired is a failed attempt: the next route is tried, otherwise 502 provider_invalid_response. Streams are checked at the end; a call that is not valid as sent ends the stream with an error event. plugins: [{"id": "tool-call-healing", "enabled": false}] passes tool calls unchanged.
  • Broken JSON is repaired by default (response-healing, no plugin needed; unlike OpenRouter, where it is opt-in) when response_format is json_object or json_schema: it removes Markdown code fences and text around the JSON, trailing, doubled and missing commas, escapes raw line breaks in strings, and completes output that was cut off (closes strings and brackets, drops an unfinished member). Valid JSON is never changed. Content that cannot be repaired is returned unchanged. Only for non-streaming requests: streams are passed on unchanged, because repairing them would hold back the answer. plugins: [{"id": "response-healing", "enabled": false}] turns it off for the request.

{}

{
  "max_tokens": 200,
  "messages": [
    {
      "content": "Answer in one sentence.",
      "role": "system"
    },
    {
      "content": "What is the capital of Portugal?",
      "role": "user"
    }
  ],
  "model": "deepseek/deepseek-v4.1-flash",
  "provider": {
    "max_price": {
      "completion": 2,
      "prompt": 0.5
    }
  },
  "temperature": 0.2
}
  • messages (Pflichtfeld): s278

s278: array

Bisherige Unterhaltung, beginnend mit der ältesten Nachricht. Mindestens eine Nachricht. Das Modell beantwortet die letzte.

{}

s86: oneOf

Eine Nachricht der Unterhaltung. role bestimmt ihre Felder. Nutzer- und Tool-Nachrichten können Bilder, Audio, Video und Dateien enthalten, sofern das Modell sie akzeptiert (architecture.input_modalities unter GET /v1/models).

{}

{
  "content": "What is the capital of Portugal?",
  "role": "user"
}

oneOf: s540

s540: object

Anweisungen für die gesamte Unterhaltung.

{}

{
  "content": "Answer in one sentence.",
  "role": "system"
}
  • content (Pflichtfeld): s556

s556: anyOf

Text als Zeichenkette oder Array von Textteilen, beispielsweise zum Markieren eines langen unveränderten Abschnitts für Prompt-Caching mit cache_control.

{}

anyOf: s7

s7: string

{}

anyOf: s1139

s1139: array

{}

s83: object

Ein Textabschnitt.

{}

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

{}

"text"
  • * (optional): s533

s533: any

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

{}

  • role (Pflichtfeld): s557

s557: string

Sprecherrolle. Bestimmt, wie das Modell die Nachricht behandelt.

"system"

{}

"system"
  • * (optional): s558

s558: any

Weitere Nachrichtenfelder, beispielsweise name oder cache_control. Sie werden unverändert an den Provider weitergegeben.

{}

oneOf: s541

s541: object

Aussage oder Frage des Nutzers.

{}

{
  "content": "What is the capital of Portugal?",
  "role": "user"
}
  • content (Pflichtfeld): s563

s563: anyOf

Text als Zeichenkette oder als Array aus Text, Bildern, Audio, Video und Dateien. Medien erfordern ein Modell, das sie akzeptiert (architecture.input_modalities unter GET /v1/models). Andernfalls scheitert die Anfrage mit 404 no_endpoint.

{}

anyOf: s7

anyOf: s1141

s1141: array

{}

s82: oneOf

Ein Nachrichtenteil. type bestimmt das Feld mit dem Inhalt. Medien-URLs werden vor jedem Provider-Aufruf geprüft. Erlaubt sind http(s)-URLs mit Host oder Base64-Daten-URLs (data:<media type>;base64,<data>). Andernfalls nennt 400 invalid_parameter den betroffenen Teil, beispielsweise $.messages[0].content[1].image_url.url.

{}

{
  "image_url": {
    "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
  },
  "type": "image_url"
}

oneOf: s525

s525: object

Ein Textabschnitt.

{}

{
  "text": "What is shown in this picture?",
  "type": "text"
}
  • text (Pflichtfeld): s531

Ein Textabschnitt.

  • type (Pflichtfeld): s532

Typ des Teils. Benennt das Feld mit dem Inhalt.

  • * (optional): s533

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

oneOf: s526

s526: object

Ein Bild als URL oder Daten-URL.

{}

{
  "image_url": {
    "detail": "auto",
    "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
  },
  "type": "image_url"
}
  • image_url (Pflichtfeld): s522

s522: object

Ein Bild als HTTP(S)-URL oder Base64-Daten-URL. Seine Größe wird nur durch den Anfrageinhalt von höchstens 50 MiB begrenzt. Große Bilder vorzugsweise als URLs senden.

{}

{
  "detail": "low",
  "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
}
  • url (Pflichtfeld): s830

s830: string

An http(s) URL with a host, which the provider downloads, or a base64 data URL (data:image/png;base64,...). Anything else fails with 400 invalid_parameter (invalid_url or invalid_base64). Inline PNG/JPEG/GIF/WebP also require readable headers and nonzero dimensions within 64 KiB; PNG checks the IHDR CRC. This header check does not decompress or certify the compressed pixel data.

{}

"https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
  • * (optional): s831

s831: any

Weitere Optionen, die unverändert an den Provider weitergegeben werden, beispielsweise detail (low, high, auto) für Bilder.

{}

  • type (Pflichtfeld): s523

s523: string

Typ des Teils. Benennt das Feld mit dem Inhalt.

"image_url"

{}

"image_url"
  • * (optional): s524

s524: any

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

{}

oneOf: s527

s527: object

Audio als Base64-Daten.

{}

{
  "input_audio": {
    "data": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQAAAAA=",
    "format": "wav"
  },
  "type": "input_audio"
}
  • input_audio (Pflichtfeld): s516

s516: object

Audio als Base64-Daten mit Formatangabe.

{}

{
  "data": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQAAAAA=",
  "format": "wav"
}
  • data (Pflichtfeld): s780

s780: string

Base64-kodierte Audiodatei ohne Daten-URL-Präfix. Ungültiges Base64 scheitert vor jedem Provider-Aufruf mit 400 invalid_parameter.

{}

  • format (Pflichtfeld): s781

s781: string

Audioformat, beispielsweise wav oder mp3. Welche Formate funktionieren, hängt vom Provider ab.

{}

"wav"
  • * (optional): s782

s782: any

Weitere Optionen, die unverändert an den Provider weitergegeben werden.

{}

  • type (Pflichtfeld): s517

s517: string

Typ des Teils. Benennt das Feld mit dem Inhalt.

"input_audio"

{}

"input_audio"
  • * (optional): s518

s518: any

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

{}

oneOf: s528

s528: object

Ein Video mit dem älteren Typ input_video.

{}

{
  "type": "input_video",
  "video_url": {
    "url": "https://storage.example.eu/clips/demo.mp4"
  }
}
  • type (Pflichtfeld): s823

s823: string

Immer input_video.

"input_video"

{}

"input_video"
  • video_url (Pflichtfeld): s824

s824: object

Video als HTTP(S)-URL oder Base64-Daten-URL.

{}

{
  "detail": "low",
  "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
}
  • url (Pflichtfeld): s830

An http(s) URL with a host, which the provider downloads, or a base64 data URL (data:image/png;base64,...). Anything else fails with 400 invalid_parameter (invalid_url or invalid_base64). Inline PNG/JPEG/GIF/WebP also require readable headers and nonzero dimensions within 64 KiB; PNG checks the IHDR CRC. This header check does not decompress or certify the compressed pixel data.

  • * (optional): s831

Weitere Optionen, die unverändert an den Provider weitergegeben werden, beispielsweise detail (low, high, auto) für Bilder.

  • * (optional): s825

s825: any

Weitere Felder, die unverändert an den Provider weitergegeben werden.

{}

oneOf: s529

s529: object

Ein Video als URL oder Daten-URL.

{}

{
  "type": "video_url",
  "video_url": {
    "url": "https://storage.example.eu/clips/demo.mp4"
  }
}
  • type (Pflichtfeld): s534

s534: string

Typ des Teils. Benennt das Feld mit dem Inhalt.

"video_url"

{}

"video_url"
  • video_url (Pflichtfeld): s535

s535: object

Ein Video als HTTP(S)-URL oder Base64-Daten-URL.

{}

{
  "detail": "low",
  "url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
}
  • url (Pflichtfeld): s830

An http(s) URL with a host, which the provider downloads, or a base64 data URL (data:image/png;base64,...). Anything else fails with 400 invalid_parameter (invalid_url or invalid_base64). Inline PNG/JPEG/GIF/WebP also require readable headers and nonzero dimensions within 64 KiB; PNG checks the IHDR CRC. This header check does not decompress or certify the compressed pixel data.

  • * (optional): s831

Weitere Optionen, die unverändert an den Provider weitergegeben werden, beispielsweise detail (low, high, auto) für Bilder.

  • * (optional): s536

s536: any

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

{}

oneOf: s530

s530: object

Ein Dokument, beispielsweise ein PDF, als URL, Daten-URL oder Datei-ID.

{}

{
  "file": {
    "file_data": "https://storage.example.eu/docs/invoice.pdf",
    "filename": "invoice.pdf"
  },
  "type": "file"
}
  • file (Pflichtfeld): s519

s519: object

Ein Dokument, beispielsweise ein PDF.

{}

{
  "file_data": "data:application/pdf;base64,JVBERi0xLjQK",
  "filename": "invoice.pdf"
}
  • file_data (optional): s657

s657: string

Datei als http(s)-URL oder Base64-Daten-URL (data:application/pdf;base64,...). Das Plugin file-parser akzeptiert höchstens acht PDFs je Anfrage: eingebettetes Base64 oder entfernte HTTP(S)-URLs bei aktiviertem media_transport.fetch_enabled. Der geschützte Lader prüft Hostregeln, öffentliche Zieladressen bei jeder Weiterleitung sowie Größen- und Zeitgrenzen. Deaktiviertes Laden, Datei-IDs und nicht zugeordnete Engines werden vor dem OCR-Aufruf abgelehnt.

{}

  • file_id (optional): s658

s658: string

ID einer zuvor beim Provider hochgeladenen Datei.

{}

  • filename (optional): s659

s659: string

Dateiname, der dem Modell hilft, mehrere Dateien zu unterscheiden.

{}

  • * (optional): s660

s660: any

Weitere Optionen, die unverändert an den Provider weitergegeben werden.

{}

  • type (Pflichtfeld): s520

s520: string

Typ des Teils. Benennt das Feld mit dem Inhalt.

"file"

{}

"file"
  • * (optional): s521

s521: any

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

{}

  • role (Pflichtfeld): s564

s564: string

Sprecherrolle. Bestimmt, wie das Modell die Nachricht behandelt.

"user"

{}

"user"
  • * (optional): s565

s565: any

Weitere Nachrichtenfelder, beispielsweise name oder cache_control. Sie werden unverändert an den Provider weitergegeben.

{}

oneOf: s542

s542: object

Anweisungen des Anwendungsentwicklers, ähnlich wie system.

{}

{
  "content": "Reply in German.",
  "role": "developer"
}
  • content (Pflichtfeld): s537

s537: anyOf

Text als Zeichenkette oder Array von Textteilen, beispielsweise zum Markieren eines langen unveränderten Abschnitts für Prompt-Caching mit cache_control.

{}

anyOf: s7

anyOf: s1137

s1137: array

{}

  • role (Pflichtfeld): s538

s538: string

Sprecherrolle. Bestimmt, wie das Modell die Nachricht behandelt.

"developer"

{}

"developer"
  • * (optional): s539

s539: any

Weitere Nachrichtenfelder, beispielsweise name oder cache_control. Sie werden unverändert an den Provider weitergegeben.

{}

oneOf: s543

s543: object

Eine frühere Modellantwort, die zum Fortsetzen der Unterhaltung erneut gesendet wird.

{}

{
  "content": null,
  "role": "assistant",
  "tool_calls": [
    {
      "function": {
        "arguments": "{\"city\": \"Lisbon\"}",
        "name": "get_weather"
      },
      "id": "call_8f2c1d",
      "type": "function"
    }
  ]
}
  • content (optional): s509

s509: anyOf

Text als Zeichenkette oder als Array aus Text, Bildern, Audio, Video und Dateien. Medien erfordern ein Modell, das sie akzeptiert (architecture.input_modalities unter GET /v1/models). Andernfalls scheitert die Anfrage mit 404 no_endpoint.

{}

anyOf: s7

anyOf: s1136

s1136: array

{}

anyOf: s588

s588: null

{}

  • role (Pflichtfeld): s510

s510: string

Immer assistant.

"assistant"

{}

"assistant"
  • * (optional): s511

s511: any

Further fields: tool_calls (tools the model wants called, with JSON arguments as a string), refusal, and reasoning with reasoning_details (the model's reasoning, under this name for every provider; left out with reasoning.exclude). Chat providers may return images: an array of {"type":"image_url","image_url":{"url":"data:image/png;base64,..."}}. The optional type and image URL survive response filtering; provider-only fields do not. This passthrough does not add a native Images API adapter or a megapixel tariff.

{}

oneOf: s544

s544: object

Ergebnis eines vom Modell angeforderten Tool-Aufrufs.

{}

{
  "content": "{\"temperature_c\": 18}",
  "role": "tool",
  "tool_call_id": "call_8f2c1d"
}
  • content (Pflichtfeld): s559

s559: anyOf

Text als Zeichenkette oder als Array aus Text, Bildern, Audio, Video und Dateien. Medien erfordern ein Modell, das sie akzeptiert (architecture.input_modalities unter GET /v1/models). Andernfalls scheitert die Anfrage mit 404 no_endpoint.

{}

anyOf: s7

anyOf: s1140

s1140: array

{}

  • role (Pflichtfeld): s560

s560: string

Immer tool.

"tool"

{}

"tool"
  • tool_call_id (Pflichtfeld): s561

s561: string

Die id des Tool-Aufrufs, auf den diese Nachricht antwortet, aus tool_calls des Assistants.

{}

"call_8f2c1d"
  • * (optional): s562

s562: any

Weitere Felder, die unverändert an den Provider weitergegeben werden.

{}

  • model (optional): s279

s279: string | null

Zu verwendendes Modell mit derselben ID wie bei OpenRouter, etwa deepseek/deepseek-v4.1-flash, oder ein Gateway-Alias: eu/fast folgt der aktuell empfohlenen Version, eu/fast@2026-10 bleibt auf ein Modell festgelegt. Das Feld model der Antwort nennt das aufgelöste Modell. Ein auf bestimmte Modelle begrenzter Key darf einen Alias nur verwenden, wenn dieses Modell erlaubt ist. Aliase gehören nicht zu OpenRouter. GET /v1/models listet alle IDs und Aliase. Eine unbekannte ID scheitert mit 400 model_not_found und einem Vorschlag in remedy_hint. Die Suffixe :nitro (Durchsatz) und :floor (Preis) wählen die Sortierung für die ganze Anfrage, sofern provider.sort nicht explizit gesetzt ist. Das Suffix eines Fallback-Modells ändert die primäre Wahl nicht. Suffixe werden vor der Prüfung von allowed_models entfernt. Antworten nennen das aufgelöste Basismodell; Generierungsbelege behalten das angeforderte Suffix. Erforderlich, sofern models nicht angegeben ist.

{}

"deepseek/deepseek-v4.1-flash"
  • models (optional): s280

s280: array | null

Fallback-Modelle als IDs oder Aliase. Sie werden nach model in dieser Reihenfolge versucht, wenn alle Provider des vorherigen Modells vor dem Senden einer Ausgabe scheitern. Das Feld model der Antwort nennt das tatsächlich antwortende Modell.

{}

[
  "deepseek/deepseek-v4.1-flash",
  "qwen/qwen3.7-flash"
]
  • stream (optional): s281

s281: boolean | null

true streamt die Antwort während der Generierung als Server-Sent Events mit Abschluss data: [DONE]. Das letzte Ereignis davor enthält usage mit EUR-Kosten. Standardwert false: eine JSON-Antwort nach vollständiger Generierung.

{}

false
  • * (optional): s282

s282: any

Weitere unterstützte OpenRouter-Parameter. Beobachtungsdaten werden lokal verarbeitet: user mit höchstens 256 Zeichen; metadata mit 16 Zeichenkettenpaaren, Schlüsseln mit 1 bis 64 und Werten mit 0 bis 512 Zeichen; trace mit 21 Paaren, Namen mit höchstens 512 Zeichen, unveränderten Zeichenketten-Kennungen und eigenen Werten mit höchstens 512 JSON-Bytes. Beobachtungsfelder mit null gelten als nicht angegeben. debug wird nie an einen Provider übermittelt. Nur wenn capabilities.parameters ausdrücklich user enthält, wird ein mandantenbezogener Nutzer-HMAC übermittelt. Auch cache_control, prompt_cache_key und prompt_cache_options müssen ausdrücklich aufgeführt sein. Zuordnungsheader: HTTP-Referer mit 2048 Zeichen, User-Agent mit 512, X-OpenRouter-Title / X-Title mit 256 (der bevorzugte Titel hat Vorrang), X-Trace-Id (der Anfrageinhalt hat Vorrang; es gelten die Grenzen für HTTP-Header und lokale Speicherung). Doppelte oder zu große Zuordnungsheader ergeben Katalogfehler. Die lokalen Zuordnungsdaten haben eine Textgrenze von 4096 Bytes und ein gemeinsames Speicherbudget von 16 MiB; eine Kürzung wird in der Generation angezeigt.

{}

Antwort 200: application/json

Die Antwort als JSON oder Server-Sent Events mit Abschluss data: [DONE]. Sofern der Provider Tokenzahlen meldet, enthalten Streams im letzten Ereignis vor [DONE] die usage mit EUR-Kosten, unabhängig von stream_options.include_usage. Ein nach dem ersten Byte fehlgeschlagener Stream endet mit einem Ereignis mit error und finish_reason: "error". Bei längeren Pausen, beispielsweise während einer Modellbegründung mit reasoning.exclude, enthalten Streams SSE-Kommentare (: keepalive), die SSE-Parser ignorieren.

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The capital of Portugal is Lisbon.",
        "reasoning": "Simple geography question.",
        "role": "assistant"
      },
      "native_finish_reason": "stop"
    }
  ],
  "created": 1792352796,
  "id": "gen-1792352796-wrVYATCfa7dAoZzZ5w8J",
  "model": "deepseek/deepseek-v4.1-flash",
  "object": "chat.completion",
  "provider": "deepinfra",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 16,
    "completion_tokens_details": {
      "audio_tokens": 0,
      "image_tokens": 0,
      "reasoning_tokens": 6
    },
    "cost": 0.0020198,
    "cost_details": {
      "bridge_cost": 0.002,
      "bridges": [
        {
          "cost_pico_eur": "2000000000",
          "exchange_rate": null,
          "id": "file-parser",
          "kind": "ocr",
          "model": "mock/ocr",
          "original_cost": {
            "currency": "EUR",
            "picos": "2000000000"
          },
          "price_version": "saved-tariff-hash",
          "provider": "mock",
          "quantity": 1,
          "unit": "page"
        }
      ],
      "currency": "EUR",
      "ocr_cost": 0.002,
      "upstream_inference_completions_cost": 0.0000128,
      "upstream_inference_cost": 0.0000198,
      "upstream_inference_prompt_cost": 0.000007
    },
    "currency": "EUR",
    "is_byok": false,
    "prompt_tokens": 35,
    "total_tokens": 51
  }
}

s12: object

The complete answer of a non-streaming request, as on OpenRouter.

Besides the fields below it carries provider (the provider that served the request) and usage: prompt_tokens, completion_tokens (including reasoning tokens, also when reasoning.exclude hides the reasoning), total_tokens and cost, the price of the request in EUR (OpenRouter: USD), with currency: "EUR" and the split into input and output in cost_details. Disjoint line items are prompt_cost, cache_read_cost, cache_write_cost, completion_cost, reasoning_cost, media_cost, request_cost, server_tool_cost and optional ocr_cost/pii_cost; their exact sum is cost. Inference totals are overlapping aggregates, not additional charges. With OCR, bridge_cost is an EUR aggregate equal to ocr_cost, never added again. bridges[] contains the same GenerationPreprocessing receipts as the generation lookup, with id: "file-parser", model, provider, unit: "page", quantity and exact EUR cost_pico_eur strings. Both extensions are omitted without a bridge. Prices use the actual total prompt tokens (including cache) and the request's UTC arrival instant. With web search, cost includes the searches at the route's price, shown in cost_details.server_tool_cost (EUR) next to the token cost in upstream_inference_cost, and server_tool_use_details.web_search_requests counts them. OCR preprocessing adds cost_details.ocr_cost (EUR) and ocr_documents; it is charged once per document even if inference falls back. With an OpenRouter extraction service, this charge includes its auxiliary inference as well as Mistral OCR. cost is missing when inference token usage is unknown; known OCR details remain available. For a provider with prices in another currency, cost_details.original holds currency, its costs in that currency (upstream_inference_cost, upstream_inference_prompt_cost, upstream_inference_completions_cost, with web search server_tool_cost) and the exchange_rate (per_eur, markup, version, as_of); each EUR part is cost × (1 + markup) / per_eur, rounded down to whole picos, and cost is their sum.

{}

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The capital of Portugal is Lisbon.",
        "reasoning": "Simple geography question.",
        "role": "assistant"
      },
      "native_finish_reason": "stop"
    }
  ],
  "created": 1792352796,
  "id": "gen-1792352796-wrVYATCfa7dAoZzZ5w8J",
  "model": "deepseek/deepseek-v4.1-flash",
  "object": "chat.completion",
  "provider": "deepinfra",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 16,
    "completion_tokens_details": {
      "audio_tokens": 0,
      "image_tokens": 0,
      "reasoning_tokens": 6
    },
    "cost": 0.0020198,
    "cost_details": {
      "bridge_cost": 0.002,
      "bridges": [
        {
          "cost_pico_eur": "2000000000",
          "exchange_rate": null,
          "id": "file-parser",
          "kind": "ocr",
          "model": "mock/ocr",
          "original_cost": {
            "currency": "EUR",
            "picos": "2000000000"
          },
          "price_version": "saved-tariff-hash",
          "provider": "mock",
          "quantity": 1,
          "unit": "page"
        }
      ],
      "currency": "EUR",
      "ocr_cost": 0.002,
      "upstream_inference_completions_cost": 0.0000128,
      "upstream_inference_cost": 0.0000198,
      "upstream_inference_prompt_cost": 0.000007
    },
    "currency": "EUR",
    "is_byok": false,
    "prompt_tokens": 35,
    "total_tokens": 51
  }
}
  • choices (Pflichtfeld): s283

s283: array

Die Antworten, eine je Auswahl, üblicherweise genau eine.

{}

s77: object

Eine Modellantwort mit ihrem Abschlussgrund.

{}

{
  "finish_reason": "stop",
  "index": 0,
  "message": {
    "content": "The capital of Portugal is Lisbon.",
    "role": "assistant"
  },
  "native_finish_reason": "stop"
}
  • finish_reason (Pflichtfeld): s512

s512: string | null

Abschlussgrund der Antwort, einheitlich für alle Provider. Provider-spezifische Werte werden diesen fünf Werten zugeordnet. Der ursprüngliche Provider-Wert bleibt unter native_finish_reason erhalten.

"tool_calls", "stop", "length", "content_filter", "error", null

{}

"stop"
  • index (Pflichtfeld): s513

s513: integer

Position der Auswahl, beginnend bei 0.

int32

{"minimum":"0"}

0
  • message (Pflichtfeld): s514

s514: object

Die Antwort.

{}

{
  "content": null,
  "role": "assistant",
  "tool_calls": [
    {
      "function": {
        "arguments": "{\"city\": \"Lisbon\"}",
        "name": "get_weather"
      },
      "id": "call_8f2c1d",
      "type": "function"
    }
  ]
}
  • content (optional): s509
  • role (Pflichtfeld): s510

Immer assistant.

  • * (optional): s511

Further fields: tool_calls (tools the model wants called, with JSON arguments as a string), refusal, and reasoning with reasoning_details (the model's reasoning, under this name for every provider; left out with reasoning.exclude). Chat providers may return images: an array of {"type":"image_url","image_url":{"url":"data:image/png;base64,..."}}. The optional type and image URL survive response filtering; provider-only fields do not. This passthrough does not add a native Images API adapter or a megapixel tariff.

  • * (optional): s515

s515: any

Weitere Felder wie native_finish_reason (der ursprüngliche Provider-Wert) und logprobs.

{}

  • created (Pflichtfeld): s284

s284: integer

Erstellungszeitpunkt der Antwort in Unix-Sekunden.

int64

{}

1792352796
  • id (Pflichtfeld): s285

s285: string

ID dieser Generierung.

{}

"gen-1792352796-wrVYATCfa7dAoZzZ5w8J"
  • model (Pflichtfeld): s286

s286: string

Tatsächlich antwortendes Modell als öffentliche Modell-ID. Bei Fallbacks unter models kann es vom angeforderten model abweichen.

{}

"deepseek/deepseek-v4.1-flash"
  • object (Pflichtfeld): s287

s287: string

Immer chat.completion.

"chat.completion"

{}

"chat.completion"
  • system_fingerprint (Pflichtfeld): s288

s288: string | null

Systemfingerabdruck des Providers. Null, wenn keiner gesendet wird.

{}

  • * (optional): s289

s289: any

Öffentliche OpenRouter-Felder, ergänzt um provider und exakte EUR-Nutzungsdaten. Unbekannte Felder der Provider-Antwortstruktur werden vor der Serialisierung entfernt.

{}

Antwort 200: text/event-stream

Die Antwort als JSON oder Server-Sent Events mit Abschluss data: [DONE]. Sofern der Provider Tokenzahlen meldet, enthalten Streams im letzten Ereignis vor [DONE] die usage mit EUR-Kosten, unabhängig von stream_options.include_usage. Ein nach dem ersten Byte fehlgeschlagener Stream endet mit einem Ereignis mit error und finish_reason: "error". Bei längeren Pausen, beispielsweise während einer Modellbegründung mit reasoning.exclude, enthalten Streams SSE-Kommentare (: keepalive), die SSE-Parser ignorieren.

data: {"choices":[{"delta":{"content":"The capital","role":"assistant"},"finish_reason":null,"index":0}],"created":1792352796,"id":"gen-1792352796-wrVYATCfa7dAoZzZ5w8J","model":"deepseek/deepseek-v4.1-flash","object":"chat.completion.chunk","provider":"deepinfra"}

s13: object

Ein Server-Sent Event eines Streams (stream: true): eine Zeile data: <chunk as JSON>. Der Stream endet mit data: [DONE]. Mit : beginnende Zeilen sind Kommentare, die SSE-Parser überspringen. Bei längeren Pausen wird : keepalive gesendet.

{}

{
  "data": {
    "choices": [
      {
        "delta": {
          "content": "The capital",
          "role": "assistant"
        },
        "finish_reason": null,
        "index": 0
      }
    ],
    "created": 1792352796,
    "id": "gen-1792352796-wrVYATCfa7dAoZzZ5w8J",
    "model": "deepseek/deepseek-v4.1-flash",
    "object": "chat.completion.chunk",
    "provider": "deepinfra"
  }
}
  • data (Pflichtfeld): s290

s290: object

Der im Ereignis enthaltene Chunk.

{}

{
  "choices": [
    {
      "delta": {
        "content": " of Portugal is Lisbon."
      },
      "finish_reason": null,
      "index": 0
    }
  ],
  "created": 1792352796,
  "id": "gen-1792352796-wrVYATCfa7dAoZzZ5w8J",
  "model": "deepseek/deepseek-v4.1-flash",
  "object": "chat.completion.chunk",
  "provider": "deepinfra"
}
  • choices (Pflichtfeld): s547

s547: array

Ergänzungen jeder Auswahl. Im letzten Chunk mit Nutzungsdaten üblicherweise leer.

{}

s87: object

Ergänzung einer Auswahl in diesem Chunk.

{}

{
  "delta": {
    "content": " of Portugal is Lisbon."
  },
  "finish_reason": null,
  "index": 0
}
  • delta (Pflichtfeld): s545

s545: object

Neuer Antwortteil.

{}

{
  "content": "The capital",
  "role": "assistant"
}
  • content (optional): s553

s553: string | null

An die Antwort anzuhängender Text. Provider-Arrays von Textteilen werden innerhalb jedes Chunks zusammengesetzt. Metadaten einzelner Teile werden ignoriert. Andere Teile als Text sind hier nicht darstellbar und führen zu einem finalen Fehler provider_invalid_response.

{}

  • role (optional): s554

s554: allOf

{}

allOf: s69

s69: string

Rolle einer Modellnachricht.

"assistant"

{}

"assistant"

allOf: s1138

s1138: object

assistant, üblicherweise nur im ersten Chunk.

{}

  • * (optional): s555

s555: any

Further fields: reasoning and reasoning_details (pieces of the model's reasoning), tool_calls (pieces of tool calls, joined by their index), and images (complete image URL objects, in the same shape as message.images). Image deltas are forwarded when received, not accumulated or moved to a different event. The existing 1 MiB provider-event limit applies to the entire event, including base64 data URLs.

{}

  • finish_reason (Pflichtfeld): s512

Abschlussgrund der Antwort, einheitlich für alle Provider. Provider-spezifische Werte werden diesen fünf Werten zugeordnet. Der ursprüngliche Provider-Wert bleibt unter native_finish_reason erhalten.

  • index (Pflichtfeld): s513

Position der Auswahl, beginnend bei 0.

  • * (optional): s546

s546: any

Weitere Felder wie native_finish_reason und logprobs.

{}

  • created (Pflichtfeld): s548

s548: integer

Beginn der Antwort in Unix-Sekunden.

int64

{}

1792352796
  • id (Pflichtfeld): s549

s549: string

Generierungs-ID. In jedem Chunk des Streams identisch.

{}

"gen-1792352796-wrVYATCfa7dAoZzZ5w8J"
  • model (Pflichtfeld): s550

s550: string

Antwortendes Modell als öffentliche Modell-ID.

{}

"deepseek/deepseek-v4.1-flash"
  • object (Pflichtfeld): s551

s551: string

Immer chat.completion.chunk.

"chat.completion.chunk"

{}

"chat.completion.chunk"
  • * (optional): s552

s552: any

Öffentliche Felder: provider, usage im letzten Chunk und der Gateway-Katalogfehler error bei fehlgeschlagenem Stream. Nur beim Provider vorhandene Ereignisse und Felder werden entfernt.

{}

Antwort 400: application/json

Erkannte Upstream-Ablehnungen mit 400 oder 422 ergeben Client-Fehler ohne sinnvollen erneuten Versuch und mit sicheren öffentlichen Feldpfaden. Ungültige Anfrage: fehlerhaftes JSON (invalid_request), ungültige Felder einschließlich der Session-ID in session_id oder x-session-id mit allen Problemen unter issues (invalid_parameter), eine unbekannte Modell-ID mit Vorschlag unter remedy_hint (model_not_found) oder ein für das Modell zu langer Prompt (context_length_exceeded). Vom Gateway nicht angebotene Plugins, Server-Tools und web_search_options scheitern mit dem Issue-Code not_available.

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

s3: object

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.

{}

{
  "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.

{}

{
  "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"}

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.

{}

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

{}

{
  "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.

{}

[
  "deepinfra",
  "open-inference"
]
  • docs_url (Pflichtfeld): s640

s640: string

Link zum Abschnitt dieses Fehlertyps in der Dokumentation.

{}

"/docs#description/model-not-found"
  • failed_routing_step (optional): s641

s641: string

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

{}

"Filter by Max Price"
  • 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.

{}

s123: object

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

{}

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

{}

"out_of_range"
  • message (Pflichtfeld): s637

s637: string

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

{}

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

{}

"$.temperature"
  • 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.

{}

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

{}

"rate_limited"
  • code (optional): s1300

s1300: string

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

{}

"rate_limit_exceeded"
  • provider_name (Pflichtfeld): s1301

s1301: string

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

{}

"deepinfra"
  • retry_after (optional): s1302

s1302: integer

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

int64

{"minimum":"0"}

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

429

oneOf: s588

  • provider_name (optional): s644

s644: string

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

{}

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

{}

""
  • remedy_hint (optional): s646

s646: string

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

{}

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

{}

"req_01k7tm9qz3f5c8x2v6b4n0m7hd"
  • requested_providers (optional): s648

s648: array

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

{}

[
  "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"}

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): 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.

{}

s200: object

Ein Routing-Schritt wie unter routing_funnel von OpenRouter.

{}

{
  "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"}

2
  • reason (optional): s980

s980: string

Anfragefeld, nach dem der Schritt gefiltert hat.

{}

"provider.only"
  • step (Pflichtfeld): s981

s981: string

Name des Schritts wie bei OpenRouter.

{}

"Initial Endpoints"
  • 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"

{}

"invalid_parameter"
  • user_id (optional): s239

s239: string | null

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

{}

"org_01k7tm2c4e6g8j0k2m4p6r8t0v"

Antwort 401: application/json

API-Key fehlt, ist ungültig oder abgelaufen (authentication). Der Ablauf wird zu Beginn einer Anfrage geprüft. Ein bereits laufender Stream wird abgeschlossen.

Antwort 402: application/json

Das Ausgabenlimit des API-Schlüssels, das Arbeitsbereichsbudget (workspace_budget_exceeded) oder das vorausbezahlte Organisationsguthaben deckt die geschätzte Reservierung einschließlich Gebühren, Medien und gleichzeitiger Reservierungen nicht (insufficient_credits bei Schlüssel und Organisation). Ohne Reservierung beginnt kein kostenpflichtiger Upstream-Aufruf.

Antwort 403: application/json

Die Richtlinie der Organisation, des Arbeitsbereichs oder des Schlüssels erlaubt das Modell in model nicht (permission_denied); issues nennt jedes angefragte, nicht erlaubte Modell und remedy_hint die erlaubten Modelle. Nicht erlaubte Fallbacks in models werden übersprungen. Websuche (das web-Plugin) erfordert web_search in server_tools der Richtlinie.

Antwort 404: application/json

Das Modell existiert, aber keiner seiner Provider passt zur Anfrage: provider-Filter, max_price, vom Modell nicht akzeptierte Medien oder vom Modell nicht angebotene Webs