# Generations

## Get Generation Details

> Retrieves detailed usage and performance metrics for a past generation request. Returns cost breakdown, model/provider info, token counts, latency, throughput, and BYOK status.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Generation Details","description":"Retrieve detailed information about API requests and responses."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, disabled, or your OAuth session has expired. Check your credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"RateLimitError":{"description":"Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/generation":{"post":{"operationId":"getGenerationDetails","tags":["Generation Details"],"summary":"Get Generation Details","description":"Retrieves detailed usage and performance metrics for a past generation request. Returns cost breakdown, model/provider info, token counts, latency, throughput, and BYOK status.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generation_id"],"properties":{"generation_id":{"type":"string","description":"The generation ID returned in the API response. Can be chat_id, request_id, or similar ID field from any FastRouter API endpoint response."}}}}}},"responses":{"200":{"description":"Generation details retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Generation ID (same as requested)"},"model":{"type":"string","description":"Model used for this generation in provider/model format"},"provider_name":{"type":"string","description":"Provider that processed the request"},"api_key":{"type":"string","description":"Hashed API key used for the request (for auditing)"},"credits_used":{"type":"number","description":"Total credits consumed by this request"},"query_time":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the request was made"},"avg_response_time_minutes_per_transaction":{"type":"number","description":"Average response time in minutes per transaction"},"avg_tokens_per_nano":{"type":"number","description":"Average tokens processed per nanosecond (throughput metric)"},"input_token_size":{"type":"integer","description":"Number of tokens in the input/prompt"},"output_token_size":{"type":"integer","description":"Number of tokens in the generated output/completion"},"is_byok":{"type":"boolean","description":"Whether this request used Bring Your Own Key (BYOK). True if customer's own API key was used."},"endpoint":{"type":"string","description":"API endpoint used for the request"},"created_at":{"type":"integer","description":"Unix timestamp of request creation"},"request":{"type":"object","description":"Full request body that was sent (if available)"},"response":{"type":"object","description":"Full response body that was returned (if available)"},"usage":{"type":"object","description":"Detailed token usage information","properties":{"prompt_tokens":{"type":"integer","description":"Tokens in the prompt"},"completion_tokens":{"type":"integer","description":"Tokens in the completion"},"total_tokens":{"type":"integer","description":"Total tokens used"},"cost":{"type":"number","description":"Cost in USD"}}},"timing":{"type":"object","description":"Timing information","properties":{"started_at":{"type":"integer","description":"Unix timestamp when processing started"},"completed_at":{"type":"integer","description":"Unix timestamp when processing completed"},"duration_ms":{"type":"integer","description":"Total duration in milliseconds"}}},"metadata":{"type":"object","description":"Additional metadata about the request"}}}}}},"400":{"description":"Bad Request - Invalid generation ID format"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"Not Found - Generation ID not found or expired"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"description":"Internal Server Error"}}}}}}
```
