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

# Generation lookup (Beta)

> Retrieve a specific generation by ID.

Fetches the stored audit record for a given `request_id` that belongs to your team.

Use:

* `GET /v1/generations?id=<request_id>`

When the gateway captured full request details for that generation, the response also includes:

* `replay_supported`: whether a replay-ready payload is available
* `replay_request`: the stored request body you can send back to the original endpoint for a controlled rerun

Typical replay flow:

1. Read the generation record with `GET /v1/generations?id=<request_id>`.
2. Check `replay_supported === true`.
3. Re-submit `replay_request` to the original endpoint named by `endpoint` such as `/v1/chat/completions` or `/v1/responses`.


## OpenAPI

````yaml GET /generations
openapi: 3.0.3
info:
  title: AI Stats Gateway API
  description: >-
    A gateway API for accessing various AI models with OpenAI-compatible
    endpoints.
  version: 1.0.0
  contact:
    name: AI Stats
    url: https://docs.ai-stats.phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core AI Stats Gateway operations.
paths:
  /generations:
    get:
      tags:
        - Gateway
      summary: Get generation
      description: Retrieve a specific generation by ID.
      operationId: getGeneration
      parameters:
        - name: id
          in: query
          required: true
          description: The ID of the generation
          schema:
            type: string
      responses:
        '200':
          description: Generation data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerationResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  error:
                    type: string
                  reason:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  error:
                    type: string
components:
  schemas:
    GenerationResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        request_id:
          type: string
        team_id:
          type: string
        app_id:
          type: string
          nullable: true
        endpoint:
          type: string
        model_id:
          type: string
        provider:
          type: string
        native_response_id:
          type: string
          nullable: true
        stream:
          type: boolean
        byok:
          type: boolean
        status_code:
          type: number
        success:
          type: boolean
        error_code:
          type: string
          nullable: true
        error_message:
          type: string
          nullable: true
        latency_ms:
          type: number
        generation_ms:
          type: number
        usage:
          type: object
          nullable: true
          properties:
            prompt_tokens:
              type: number
            completion_tokens:
              type: number
            total_tokens:
              type: number
        cost_nanos:
          type: number
        currency:
          type: string
        pricing_lines:
          type: array
          items:
            type: object
        key_id:
          type: string
        throughput:
          type: number
          nullable: true
        replay_supported:
          type: boolean
          description: >-
            Whether a replay-ready request payload is available for this
            generation.
        replay_request:
          type: object
          nullable: true
          additionalProperties: true
          description: >-
            Replay-ready request payload captured for this generation when
            available.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication

````