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

# Get usage

> Get physical usage meters by time bucket, model, and public API key hash.



## OpenAPI

````yaml /openapi/v0-api/public.openapi.yaml get /api/v1/usage
openapi: 3.1.0
info:
  title: MyRouter V0 Public API
  version: 0.1.0
  description: >-
    Customer-facing MyRouter V0 API. Core paths follow OpenRouter where
    possible; billing is a MyRouter extension using Stripe-style resource
    naming.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  x-platform-contract-commit: 56b047ef2c076be151e090aa4e2f5e974180ea14
  x-phase-sources:
    - phase1/2026-05-28-source-inventory.md
    - phase8/2026-05-28-public-v0-api-review-matrix.md
servers:
  - url: https://api.myrouter.example
    description: Placeholder until public environment is finalized.
security:
  - bearerApiKey: []
paths:
  /api/v1/usage:
    get:
      tags:
        - Usage
      summary: Get usage
      description: >-
        Get physical usage meters by time bucket, model, and public API key
        hash.
      operationId: getUsage
      parameters:
        - $ref: '#/components/parameters/RequestIdHeader'
        - name: start_time
          in: query
          required: true
          schema:
            type: string
            format: date-time
          description: Usage start.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        - name: end_time
          in: query
          required: true
          schema:
            type: string
            format: date-time
          description: Usage end.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        - name: granularity
          in: query
          required: false
          schema:
            type: string
            enum:
              - 5m
              - hour
              - day
          description: Usage granularity.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        - name: api_key_hash
          in: query
          required: false
          schema:
            type: string
          description: Optional public key filter.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        - name: model
          in: query
          required: false
          schema:
            type: string
          description: Optional model filter.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
      responses:
        '200':
          description: Get usage response.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    RequestIdHeader:
      name: x-request-id
      in: header
      required: false
      schema:
        type: string
      description: Optional caller request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  headers:
    RequestId:
      schema:
        type: string
      description: Effective request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  schemas:
    UsageResponse:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/UsageBucket'
          description: Usage buckets.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        request_id:
          type: string
          description: Request id.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
      x-source: >-
        OpenAI/Anthropic usage report pattern plus June 4 platform usage
        aggregation
      x-owner: shared
      x-status: june-4-dependent
      x-platform-dependency: Platform usage aggregation by API key/account with 5-minute granularity
      x-rationale: Usage reports expose physical meters only, not customer charge amounts.
    UsageBucket:
      type: object
      additionalProperties: false
      required:
        - period_start
        - period_end
        - request_count
      properties:
        period_start:
          type: string
          description: Bucket start.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          format: date-time
        period_end:
          type: string
          description: Bucket end.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          format: date-time
        model:
          type: string
          description: Model.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        api_key_hash:
          type: string
          description: Public key hash.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
        request_count:
          type: integer
          description: Request count.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        input_tokens:
          type: integer
          description: Input tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        output_tokens:
          type: integer
          description: Output tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        total_tokens:
          type: integer
          description: Total tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        cache_read_tokens:
          type: integer
          description: Cache-read tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        cache_write_tokens:
          type: integer
          description: Cache-write tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
        reasoning_tokens:
          type: integer
          description: Reasoning tokens.
          x-source: >-
            OpenAI/Anthropic usage report pattern plus June 4 platform usage
            aggregation
          x-owner: shared
          x-status: june-4-dependent
          x-platform-dependency: >-
            Platform usage aggregation by API key/account with 5-minute
            granularity
          x-rationale: >-
            Usage reports expose physical meters only, not customer charge
            amounts.
          minimum: 0
      x-source: >-
        OpenAI/Anthropic usage report pattern plus June 4 platform usage
        aggregation
      x-owner: shared
      x-status: june-4-dependent
      x-platform-dependency: Platform usage aggregation by API key/account with 5-minute granularity
      x-rationale: Usage reports expose physical meters only, not customer charge amounts.
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            message:
              type: string
              description: Human-readable error message.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
            type:
              type: string
              description: Error category.
              x-source: Platform error contracts and product API convention
              x-owner: shared
              x-status: product-to-build
              x-platform-dependency: Platform runtime errors and product API errors
              x-rationale: >-
                Every API needs a stable supportable error envelope with request
                id.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
        request_id:
          type: string
          description: Effective request id for support.
          x-source: Platform error contracts and product API convention
          x-owner: shared
          x-status: product-to-build
          x-platform-dependency: Platform runtime errors and product API errors
          x-rationale: Every API needs a stable supportable error envelope with request id.
      x-source: Platform error contracts and product API convention
      x-owner: shared
      x-status: product-to-build
      x-platform-dependency: Platform runtime errors and product API errors
      x-rationale: Every API needs a stable supportable error envelope with request id.
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Authenticated principal is not allowed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: Internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: MyRouter API key

````