GetGenerationData - Go SDK

GetGenerationData type definition

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

Generation data

Fields

FieldTypeRequiredDescriptionExample
IDstring✔️Unique identifier for the generationgen-3bhGkxlo4XFrqiabUM7NDtwDzWwG
UpstreamID*string✔️Upstream provider’s identifier for this generationchatcmpl-791bcf62-080e-4568-87d0-94c72e3b4946
TotalCostfloat64✔️Total cost of the generation in USD0.0015
CacheDiscountfloat64✔️Discount applied due to caching0.0002
UpstreamInferenceCostfloat64✔️Cost charged by the upstream provider0.0012
CreatedAtstring✔️ISO 8601 timestamp of when the generation was created2024-07-15T23:33:19.433273+00:00
Modelstring✔️Model used for the generationsao10k/l3-stheno-8b
AppIDint64✔️ID of the app that made the request12345
Streamed*bool✔️Whether the response was streamedtrue
Cancelled*bool✔️Whether the generation was cancelledfalse
ProviderName*string✔️Name of the provider that served the requestInfermatic
Latencyfloat64✔️Total latency in milliseconds1250
ModerationLatencyfloat64✔️Moderation latency in milliseconds50
GenerationTimefloat64✔️Time taken for generation in milliseconds1200
FinishReason*string✔️Reason the generation finishedstop
TokensPromptint64✔️Number of tokens in the prompt10
TokensCompletionint64✔️Number of tokens in the completion25
NativeTokensPromptint64✔️Native prompt tokens as reported by provider10
NativeTokensCompletionint64✔️Native completion tokens as reported by provider25
NativeTokensCompletionImagesint64✔️Native completion image tokens as reported by provider0
NativeTokensReasoningint64✔️Native reasoning tokens as reported by provider5
NativeTokensCachedint64✔️Native cached tokens as reported by provider3
NumMediaPromptint64✔️Number of media items in the prompt1
NumInputAudioPromptint64✔️Number of audio inputs in the prompt0
NumMediaCompletionint64✔️Number of media items in the completion0
NumSearchResultsint64✔️Number of search results included5
Originstring✔️Origin URL of the requesthttps://openrouter.ai/
Usagefloat64✔️Usage amount in USD0.0015
IsByokbool✔️Whether this used bring-your-own-keyfalse
NativeFinishReason*string✔️Native finish reason as reported by providerstop
ExternalUser*string✔️External user identifieruser-123
APIType*operations.APIType✔️Type of API used for the generation
Router*string✔️Router used for the request (e.g., openrouter/auto)openrouter/auto
ProviderResponses[]components.ProviderResponse✔️List of provider responses for this generation, including fallback attempts
UserAgent*string✔️User-Agent header from the request
HTTPReferer*string✔️Referer header from the request
RequestIDoptionalnullable.OptionalNullable[string]Unique identifier grouping all generations from a single API requestreq-1727282430-aBcDeFgHiJkLmNoPqRsT
SessionIDoptionalnullable.OptionalNullable[string]Session identifier grouping multiple generations in the same session