---
title: "Get request & usage metadata for a generation"
method: GET
path: "/generation"
tags: ["Generations"]
---

# Get request & usage metadata for a generation

`GET /generation`

## Query parameters

- `id` string, required — The generation ID

## Response `200`

Returns the request metadata for this generation

- GenerationResponse — Generation response
  - `data` object, required — Generation data
    - `api_type` 'completions' | 'embeddings' | 'rerank' | 'tts' | 'stt' | 'video' | 'image' | 'null', nullable, required — Type of API used for the generation
    - `app_id` integer, nullable, required — ID of the app that made the request
    - `cache_discount` number, double, nullable, required — Discount applied due to caching
    - `cancelled` boolean, nullable, required — Whether the generation was cancelled
    - `created_at` string, required — ISO 8601 timestamp of when the generation was created
    - `data_region` 'global' | 'europe' | 'us', required — The data region this generation was routed through: 'global', 'europe', or 'us'.
    - `external_user` string, nullable, required — External user identifier
    - `finish_reason` string, nullable, required — Reason the generation finished
    - `generation_time` number, double, nullable, required — Time taken for generation in milliseconds
    - `http_referer` string, nullable, required — Referer header from the request
    - `id` string, required — Unique identifier for the generation
    - `is_byok` boolean, required — Whether this used bring-your-own-key
    - `latency` number, double, nullable, required — Total latency in milliseconds
    - `model` string, required — Model used for the generation
    - `moderation_latency` number, double, nullable, required — Moderation latency in milliseconds
    - `native_finish_reason` string, nullable, required — Native finish reason as reported by provider
    - `native_tokens_cached` integer, nullable, required — Native cached tokens as reported by provider
    - `native_tokens_completion` integer, nullable, required — Native completion tokens as reported by provider
    - `native_tokens_completion_images` integer, nullable, required — Native completion image tokens as reported by provider
    - `native_tokens_prompt` integer, nullable, required — Native prompt tokens as reported by provider
    - `native_tokens_reasoning` integer, nullable, required — Native reasoning tokens as reported by provider
    - `num_fetches` integer, nullable, required — Number of web fetches performed
    - `num_input_audio_prompt` integer, nullable, required — Number of audio inputs in the prompt
    - `num_media_completion` integer, nullable, required — Number of media items in the completion
    - `num_media_prompt` integer, nullable, required — Number of media items in the prompt
    - `num_search_results` integer, nullable, required — Number of search results included
    - `origin` string, required — Origin URL of the request
    - `preset_id` string, nullable, required — ID of the preset used for this generation, null if no preset was used
    - `provider_name` string, nullable, required — Name of the provider that served the request
    - `provider_responses` ProviderResponse[], nullable, required — List of provider responses for this generation, including fallback attempts
      - `endpoint_id` string — Internal endpoint identifier
      - `id` string — Upstream provider response identifier
      - `is_byok` boolean — Whether the request used a bring-your-own-key
      - `latency` number, double — Response latency in milliseconds
      - `model_permaslug` string — Canonical model slug
      - `provider_name` 'AnyScale' | 'Atoma' | 'Cent-ML' | 'CrofAI' | 'Enfer' | 'GoPomelo' | 'HuggingFace' | 'Hyperbolic' | 'Hyperbolic 2' | 'InoCloud' | 'Kluster' | 'Lambda' | 'Lepton' | 'Lynn 2' | 'Lynn' | 'Mancer' | 'Modal' | 'Nineteen' | 'OctoAI' | 'Recursal' | 'Reflection' | 'Replicate' | 'SambaNova 2' | 'SF Compute' | 'Targon' | 'Together 2' | 'Ubicloud' | '01.AI' | 'AkashML' | 'AI21' | 'AionLabs' | 'Alibaba' | 'Ambient' | 'Baidu' | 'Amazon Bedrock' | 'Amazon Nova' | 'Anthropic' | 'Arcee AI' | 'AtlasCloud' | 'Avian' | 'Azure' | 'BaseTen' | 'BytePlus' | 'Black Forest Labs' | 'Cerebras' | 'Chutes' | 'Cirrascale' | 'Claude Platform on AWS' | 'Clarifai' | 'Cloudflare' | 'Cohere' | 'CoreWeave' | 'Crucible' | 'Crusoe' | 'Darkbloom' | 'Decart' | 'Deepgram' | 'DeepInfra' | 'DeepSeek' | 'DekaLLM' | 'DigitalOcean' | 'Featherless' | 'Fireworks' | 'Fish Audio' | 'Friendli' | 'GMICloud' | 'Google' | 'Google AI Studio' | 'Groq' | 'HeyGen' | 'Inception' | 'Inceptron' | 'InferenceNet' | 'Ionstream' | 'Infermatic' | 'Io Net' | 'Inferact vLLM' | 'Inflection' | 'Liquid' | 'Mara' | 'Mancer 2' | 'Meta' | 'Minimax' | 'ModelRun' | 'Mistral' | 'Modular' | 'Moonshot AI' | 'Morph' | 'VoyageAI by MongoDB' | 'NCompass' | 'Nebius' | 'Nex AGI' | 'NextBit' | 'Novita' | 'Nvidia' | 'OpenAI' | 'OpenInference' | 'Parasail' | 'Poolside' | 'Perceptron' | 'Perplexity' | 'Phala' | 'Recraft' | 'Reka' | 'Relace' | 'Sail Research' | 'Sakana AI' | 'SambaNova' | 'Seed' | 'SiliconFlow' | 'Sourceful' | 'StepFun' | 'Stealth' | 'StreamLake' | 'Switchpoint' | 'Tencent' | 'Tenstorrent' | 'Thinking Machines' | 'Together' | 'Upstage' | 'Venice' | 'Wafer' | 'WandB' | 'Quiver' | 'Krea' | 'Runway' | 'Xiaomi' | 'xAI' | 'Z.AI' | 'FakeProvider' — Name of the provider
      - `routed_service_tier` 'flex' | 'priority' — The service tier this request was routed to (e.g. flex, priority). The tier actually applied and billed is determined by the provider response and may differ.
      - `status` integer, nullable, required — HTTP status code from the provider
    - `request_id` string, nullable — Unique identifier grouping all generations from a single API request
    - `response_cache_source_id` string, nullable — If this generation was served from response cache, contains the original generation ID. Null otherwise.
    - `router` string, nullable, required — Router used for the request (e.g., openrouter/auto)
    - `service_tier` string, nullable, required — Service tier the upstream provider reported running this request on, or null if it did not report one.
    - `session_id` string, nullable — Session identifier grouping multiple generations in the same session
    - `streamed` boolean, nullable, required — Whether the response was streamed
    - `tokens_completion` integer, nullable, required — Number of tokens in the completion
    - `tokens_prompt` integer, nullable, required — Number of tokens in the prompt
    - `total_cost` number, double, required — Total cost of the generation in USD
    - `upstream_id` string, nullable, required — Upstream provider's identifier for this generation
    - `upstream_inference_cost` number, double, nullable, required — Cost charged by the upstream provider
    - `usage` number, double, required — Usage amount in USD
    - `user_agent` string, nullable, required — User-Agent header from the request
    - `web_search_engine` string, nullable, required — The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)
    - `workspace_id` string, nullable, required — ID of the workspace this generation is attributed to. Null for accounts without workspaces. Generations created before workspace resolution existed are attributed to the account default workspace.

## Other responses

- `401` — Unauthorized - Authentication required or invalid credentials
- `402` — Payment Required - Insufficient credits or quota to complete request
- `404` — Not Found - Resource does not exist
- `429` — Too Many Requests - Rate limit exceeded
- `500` — Internal Server Error - Unexpected server error
- `502` — Bad Gateway - Provider/upstream API failure
- `524` — Infrastructure Timeout - Provider request timed out at edge network
- `529` — Provider Overloaded - Provider is temporarily overloaded

---

[API](https://skmtc.net/openrouterteam/apis/openrouter-api.md) · [All operations](https://skmtc.net/openrouterteam/apis/openrouter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openrouterteam/openrouter-api/versions/9d1da2c7d2c3/schema)
