GenerationResponseData - Python SDK

GenerationResponseData method reference

The Python SDK and docs are currently in beta. Report issues on GitHub.

Generation data

Fields

FieldTypeRequiredDescriptionExample
api_typeNullable[components.APIType]✔️Type of API used for the generation
app_idNullable[int]✔️ID of the app that made the request12345
cache_discountNullable[float]✔️Discount applied due to caching0.0002
cancelledNullable[bool]✔️Whether the generation was cancelledfalse
created_atstr✔️ISO 8601 timestamp of when the generation was created2024-07-15T23:33:19.433273+00:00
data_regioncomponents.DataRegion✔️The data region this generation was routed through. ‘europe’ for EU-routed requests, ‘global’ otherwise.global
external_userNullable[str]✔️External user identifieruser-123
finish_reasonNullable[str]✔️Reason the generation finishedstop
generation_timeNullable[float]✔️Time taken for generation in milliseconds1200
http_refererNullable[str]✔️Referer header from the request
idstr✔️Unique identifier for the generationgen-3bhGkxlo4XFrqiabUM7NDtwDzWwG
is_byokbool✔️Whether this used bring-your-own-keyfalse
latencyNullable[float]✔️Total latency in milliseconds1250
modelstr✔️Model used for the generationsao10k/l3-stheno-8b
moderation_latencyNullable[float]✔️Moderation latency in milliseconds50
native_finish_reasonNullable[str]✔️Native finish reason as reported by providerstop
native_tokens_cachedNullable[int]✔️Native cached tokens as reported by provider3
native_tokens_completionNullable[int]✔️Native completion tokens as reported by provider25
native_tokens_completion_imagesNullable[int]✔️Native completion image tokens as reported by provider0
native_tokens_promptNullable[int]✔️Native prompt tokens as reported by provider10
native_tokens_reasoningNullable[int]✔️Native reasoning tokens as reported by provider5
num_fetchesNullable[int]✔️Number of web fetches performed0
num_input_audio_promptNullable[int]✔️Number of audio inputs in the prompt0
num_media_completionNullable[int]✔️Number of media items in the completion0
num_media_promptNullable[int]✔️Number of media items in the prompt1
num_search_resultsNullable[int]✔️Number of search results included5
originstr✔️Origin URL of the requesthttps://openrouter.ai/
preset_idNullable[str]✔️ID of the preset used for this generation, null if no preset was useda9e8d400-592a-494f-908c-375efa66cafd
provider_nameNullable[str]✔️Name of the provider that served the requestInfermatic
provider_responsesList[components.ProviderResponse]✔️List of provider responses for this generation, including fallback attempts
request_idOptionalNullable[str]Unique identifier grouping all generations from a single API requestreq-1727282430-aBcDeFgHiJkLmNoPqRsT
response_cache_source_idOptionalNullable[str]If this generation was served from response cache, contains the original generation ID. Null otherwise.
routerNullable[str]✔️Router used for the request (e.g., openrouter/auto)openrouter/auto
service_tierNullable[str]✔️Service tier the upstream provider reported running this request on, or null if it did not report one.priority
session_idOptionalNullable[str]Session identifier grouping multiple generations in the same session
streamedNullable[bool]✔️Whether the response was streamedtrue
tokens_completionNullable[int]✔️Number of tokens in the completion25
tokens_promptNullable[int]✔️Number of tokens in the prompt10
total_costfloat✔️Total cost of the generation in USD0.0015
upstream_idNullable[str]✔️Upstream provider’s identifier for this generationchatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946
upstream_inference_costNullable[float]✔️Cost charged by the upstream provider0.0012
usagefloat✔️Usage amount in USD0.0015
user_agentNullable[str]✔️User-Agent header from the request
web_search_engineNullable[str]✔️The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)exa