> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmrouter.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve a generation

> Retrieve detailed information about a specific generation by its ID. The generation must belong to the authenticated organization's API key.



## OpenAPI

````yaml /api-reference/openapi.json get /generation/{id}
openapi: 3.1.0
info:
  title: LLM Router API
  description: >-
    Intelligent AI Gateway with smart routing, Skills, Zero Data Retention, and
    cost optimization. Fully compatible with the OpenAI API.
  version: 1.0.0
  contact:
    name: LLM Router Support
    url: https://docs.llmrouter.app
servers:
  - url: https://api.llmrouter.app/v1
    description: Production Server
security:
  - bearerAuth: []
paths:
  /generation/{id}:
    get:
      tags:
        - Generations
      summary: Retrieve a generation
      description: >-
        Retrieve detailed information about a specific generation by its ID. The
        generation must belong to the authenticated organization's API key.
      parameters:
        - name: id
          in: path
          required: true
          description: The unique ID of the generation to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Generation details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerationResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Generation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    GenerationResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Generation'
      required:
        - data
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
              nullable: true
              enum:
                - UNAUTHORIZED
                - FORBIDDEN
                - INTERNAL_SERVER_ERROR
                - BAD_REQUEST
                - USER_NOT_FOUND
                - MODEL_NOT_FOUND
                - EXCEEDS_MONTHLY_LIMIT
                - INVALID_GATEWAY_SETTINGS
                - TOO_MANY_REQUESTS
              description: Error code (can be null or undefined)
          additionalProperties: true
      additionalProperties: true
    Generation:
      type: object
      properties:
        genId:
          type: string
          description: Unique identifier of the generation
        model:
          type: string
          description: Model used for this generation
        path:
          type: string
          description: API path or endpoint used
        reqCost:
          type: number
          nullable: true
          description: >-
            Cost of the request in credits without including request routing /
            analysis cost
        inputTokens:
          type: integer
          nullable: true
        outputTokens:
          type: integer
          nullable: true
        reasoningTokens:
          type: integer
          nullable: true
        planningInputTokens:
          type: integer
          nullable: true
        planningOutputTokens:
          type: integer
          nullable: true
        planningCost:
          type: number
          nullable: true
        loadedTools:
          type: string
          nullable: true
        routingCost:
          type: number
          nullable: true
        optimizationPercentage:
          type: number
          nullable: true
        durationMsToFirstToken:
          type: integer
          nullable: true
        totalDurationMs:
          type: integer
        createdAt:
          type: string
          format: date-time
        score:
          type: number
          nullable: true
        skills:
          type: string
          nullable: true
        tag:
          type: string
          nullable: true
      required:
        - genId
        - model
        - path
        - totalDurationMs
        - createdAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: LLM Router API Key (e.g., sk-llmr-...)

````