Read generation content
The request's messages and what the client received of the first choice (text, reasoning and tool calls), plus the error if the generation failed, in OpenRouter's format. Streams are recorded as they pass, without holding them back. The gateway's additional data.previous_errors lists up to 16 earlier failed attempts, even after a successful fallback (data.error stays null). On failure the same history is also available at OpenRouter's data.error.previous_errors. The terminal provider error is not repeated as a previous attempt; when every provider failed, the aggregate error lists all attempts.
Only generations of API keys whose policy allows content capture (capture) have content, and only such keys of the same organization and workspace can read it; for every other key and generation the answer is 404. Without that opt-in, the gateway stores no prompts or answers anywhere. Messages are kept up to 768 KiB of JSON and answers up to 256 KiB per generation; longer content is cut and marked with truncated. This gateway instance keeps the most recent 32 MiB of content in memory. Active captures share a separate 16 MiB reservation for their bounded input, output and attempt history. If admission would exceed it, the request proceeds without content (this endpoint returns 404), while generation metadata and billing are recorded normally. Queued content is also bounded to 32 MiB. Reservations are released when content moves into that queue or is dropped. Downloads reserve space for the content copy and encoded response from the shared response budget before copying. Slow downloads keep that reservation until their bytes are sent or dropped; memory pressure returns 503 with Retry-After after a bounded wait.
GET https://api.tokenlane.de/v1/generation/content
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": [] } ] ]
Values starting with YOUR_ are placeholders. Replace them with appropriate values before sending.
curl
curl --request GET \
--url 'https://api.tokenlane.de/v1/generation/content?id=YOUR_ID' \
--header 'Authorization: Bearer YOUR_API_KEY'
node
const response = await fetch("https://api.tokenlane.de/v1/generation/content?id=YOUR_ID", {
method: "GET",
headers: {
"Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
},
});
console.log(await response.text());
python
import os
import urllib.request
request = urllib.request.Request(
"https://api.tokenlane.de/v1/generation/content?id=YOUR_ID",
method="GET",
headers={
"Authorization": "Bearer " + os.environ["TOKENLANE_API_KEY"],
},
)
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/generation/content?id=YOUR_ID", {
method: "GET",
headers: {
"Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
},
});
console.log(await response.text());
query: id (required)
The generation ID, e.g. the id of a chat completion
s7: string
{}
Response 200: application/json
Prompt and answer, previous failed attempts even after successful fallback, and the terminal error only if the generation failed
{
"data": {
"error": null,
"id": "gen-01k7tm9qz3f5c8x2v6b4n0m7hd",
"input": {
"messages": [
{
"content": "What is the capital of Austria?",
"role": "user"
}
],
"truncated": false
},
"output": {
"completion": "Vienna.",
"reasoning": null,
"tool_calls": [],
"truncated": false
},
"previous_errors": []
}
}
s18: object
Response of GET /v1/generation/content, in OpenRouter's shape.
{}
- data (required): s307
s307: object
Prompt and answer of the generation.
{}
{
"error": null,
"id": "gen-01k7tm9qz3f5c8x2v6b4n0m7hd",
"input": {
"messages": [
{
"content": "What is the capital of Austria?",
"role": "user"
}
],
"truncated": false
},
"output": {
"completion": "Vienna.",
"reasoning": null,
"tool_calls": [],
"truncated": false
},
"previous_errors": []
}
- error (required): s667
s667: object | null
The error a failed generation ended with, in OpenRouter's shape.
{}
{
"message": "Provider scaleway returned an error (HTTP 500)",
"previous_errors": [],
"provider_name": "scaleway",
"raw": null,
"status": 502
}
- message (required): s1159
s1159: string | null
The error message the client received.
{}
"Provider scaleway returned an error (HTTP 500)"
- previous_errors (required): s1160
s1160: array
Earlier failed attempts in order, at most the first 16; the same as data.previous_errors. A single terminal provider failure is not repeated. An aggregate error after every provider failed includes all attempts, up to the limit.
{}
s132: object
A provider attempt that failed before the gateway tried the next provider.
{}
{
"code": 429,
"message": "Provider mistral is rate limited",
"provider_name": "mistral",
"raw": null
}
- code (required): s680
s680: integer
HTTP status the attempt ended with.
int32
{"minimum":"0"}
429
- message (required): s681
s681: string
What went wrong.
{}
"Provider mistral is rate limited"
- provider_error (optional): s682
s682: oneOf
Safe provider diagnostics; identical to error.metadata.provider_error.
{}
oneOf: s1165
s1165: 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): s1306
s1306: 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
s588: null
{}
- provider_name (required): s683
s683: string | null
The provider that was tried, or null.
{}
"mistral"
- raw (required): s684
s684: string | null
Reserved OpenRouter compatibility field; always null. Provider text is withheld.
{}
- provider_error (optional): s1161
s1161: oneOf
Safe provider diagnostics; identical to error.metadata.provider_error.
{}
oneOf: s1305
s1305: 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): s1347
s1347: 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 (required): s1162
s1162: string | null
The provider whose error the client received, or null.
{}
"scaleway"
- raw (required): s684
Reserved OpenRouter compatibility field; always null. Provider text is withheld.
- status (required): s1163
s1163: integer | null
HTTP status the client received.
int32
{"minimum":"0"}
502
- id (required): s668
s668: string
ID of the generation.
{}
"gen-01k7tm9qz3f5c8x2v6b4n0m7hd"
- input (required): s669
s669: object
What the request sent.
{}
{
"messages": [
{
"content": "What is the capital of Austria?",
"role": "user"
}
],
"truncated": false
}
- messages (required): s685
s685: array
The messages of the request. When truncated, long strings are cut and later messages or fields are missing; what is there is valid JSON.
{}
[
{
"content": "What is the capital of Austria?",
"role": "user"
}
]
s1164: object
{}
- truncated (required): s686
s686: boolean
Whether the messages were longer than the gateway keeps (768 KiB of JSON) and were cut.
{}
false
- output (required): s670
s670: object
What the client received of the first choice.
{}
{
"completion": "Vienna.",
"reasoning": null,
"tool_calls": [],
"truncated": false
}
- completion (required): s687
s687: string | null
The text of the answer, or null if it had none (for example only tool calls, or the generation failed before any text).
{}
"Vienna."
- reasoning (required): s688
s688: string | null
The reasoning the client received, or null.
{}
- tool_calls (required): s689
s689: array
Tool calls of the answer, in order.
{}
s135: object
One tool call of an answer.
{}
{
"arguments": "{\"city\":\"Vienna\"}",
"id": "call_1",
"name": "get_weather"
}
- arguments (required): s691
s691: string
The arguments as the model wrote them (usually JSON).
{}
"{\"city\":\"Vienna\"}"
- id (required): s692
s692: string | null
ID of the call, or null if the model sent none.
{}
"call_1"
- name (required): s693
s693: string | null
Name of the called function, or null if the model sent none.
{}
"get_weather"
- truncated (required): s690
s690: boolean
Whether the answer was longer than the gateway keeps (256 KiB) and was cut.
{}
false
- previous_errors (optional): s671
s671: array
Earlier failed attempts in order, at most the first 16. Available even when a fallback succeeded (error is null) or the client cancelled. On failure this is also returned in error.previous_errors. A final single-provider error is not repeated here; an aggregate error after all providers failed includes every attempt, up to the limit. This additional gateway field does not change the generation's terminal status.
{"maxItems":"16"}
[]
- response_format (optional): s672
s672: object
Original output format including its JSON Schema, only with content capture; valid JSON bounded to 64 KiB.
{}
- response_format_truncated (optional): s673
s673: boolean
Whether response_format was structurally shortened. Absent when that field was not captured.
{}
false
- stop (optional): s674
s674: any
Original stop sequences, only with content capture; valid JSON bounded to 64 KiB.
{}
- stop_truncated (optional): s675
s675: boolean
Whether stop was structurally shortened. Absent when that field was not captured.
{}
false
- tool_choice (optional): s676
s676: any
Original tool selection including the function name, only with content capture; valid JSON bounded to 64 KiB.
{}
- tool_choice_truncated (optional): s677
s677: boolean
Whether tool_choice was structurally shortened. Absent when that field was not captured.
{}
false
- tools (optional): s678
s678: array
Original tool definitions and parameter schemas, only with content capture; valid JSON bounded to 64 KiB.
{}
- tools_truncated (optional): s679
s679: boolean
Whether tools was structurally shortened. Absent when that field was not captured.
{}
false
Response 400: application/json
The query parameter id is missing, empty or given more than once (invalid_parameter)
{
"error": {
"code": 400,
"message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
"metadata": {
"docs_url": "/docs#description/model-not-found",
"issues": [
{
"code": "unknown_model",
"message": "deepseek/deepseek-v4.1-flsh is not a valid model ID",
"path": "$.model"
}
],
"remedy_hint": "Did you mean deepseek/deepseek-v4.1-flash?",
"request_id": "req_01k7tm9qz3f5c8x2v6b4n0m7hd",
"retryable": false,
"type": "model_not_found"
}
},
"user_id": "org_01k7tm2c4e6g8j0k2m4p6r8t0v"
}
s3: object
Every response with an HTTP status of 400 or higher has this shape, OpenRouter's error format. Everything the gateway adds is inside error.metadata, so OpenRouter clients see nothing unfamiliar. See "Errors" in the introduction for all error types.
{}
{
"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
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): s642
s642: array
Every problem found in the request, so all can be fixed at once (at most 20); for routing errors one entry per excluded route, for no_provider_available one per failed attempt.
{}
s123: object
One problem in the request, one reason a route was excluded, or one failed attempt.
{}
{
"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): 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
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): s648
s648: 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): s651
s651: array
How routing narrowed down the providers: each step with the number of routes left (routing errors only, same format as OpenRouter).
{}
s200: object
One routing step, as in OpenRouter's routing_funnel.
{}
{
"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): 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 401: application/json
Missing, invalid or expired API key (authentication)
Response 404: application/json
No content for this ID and key: the key's policy does not allow content capture, the generation was made without capture, by another organization or workspace, has not ended, is unknown, was not admitted due to capture memory pressure, or is no longer kept (not_found)
Response 429: application/json
Customer quota exhausted (rate_limited); retry after Retry-After
Response 500: application/json
Unexpected gateway error (internal)
Response 503: application/json
Content reads cannot reserve response memory within the bounded wait (no_provider_available). Finish or cancel pending downloads and retry with Retry-After.