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

# Query Usage Summary

> Aggregate usage stats for the authenticated caller.

Accepts either a dashboard session token (JWT) or an rsk_ API key. With a JWT
the stats span every key the caller can see in the given org; with an API key
they are scoped to that single key (the body's org_id / member filters are
ignored). Results are cached for 1 minute per org/filter combination for JWT
callers. Pass ?refresh=true to bypass.



## OpenAPI

````yaml /api/openapi.json post /v1/usage
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/usage:
    post:
      tags:
        - Usage
      summary: Query Usage Summary
      description: >-
        Aggregate usage stats for the authenticated caller.


        Accepts either a dashboard session token (JWT) or an rsk_ API key. With
        a JWT

        the stats span every key the caller can see in the given org; with an
        API key

        they are scoped to that single key (the body's org_id / member filters
        are

        ignored). Results are cached for 1 minute per org/filter combination for
        JWT

        callers. Pass ?refresh=true to bypass.
      operationId: query_usage_summary
      parameters:
        - name: refresh
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Refresh
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageFilter'
            examples:
              default:
                summary: Example request
                value:
                  org_id: 0190a1b2-3c4d-7e8f-9012-3456789abcde
                  since: '2026-07-01'
                  until: '2026-07-14'
                  limit: 10
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app__usage__analytics__UsageSummary'
              examples:
                default:
                  summary: Example response
                  value:
                    total_requests: 1284
                    successful_requests: 1270
                    error_requests: 14
                    prompt_tokens: 482913
                    completion_tokens: 197233
                    total_tokens: 680146
                    total_cost_usd: '12.4832100'
                    total_platform_fee_usd: '0.6241600'
                    by_model_total: 3
                    by_model:
                      - model: openai/gpt-4o-mini
                        requests: 900
                        prompt_tokens: 300000
                        completion_tokens: 120000
                        total_tokens: 420000
                        cost_usd: '6.1200000'
                        platform_fee_usd: '0.3060000'
                      - model: anthropic/claude-haiku-4.5
                        requests: 320
                        prompt_tokens: 150000
                        completion_tokens: 60000
                        total_tokens: 210000
                        cost_usd: '4.9000000'
                        platform_fee_usd: '0.2450000'
                      - model: openai/text-embedding-3-small
                        requests: 64
                        prompt_tokens: 32913
                        completion_tokens: 0
                        total_tokens: 32913
                        cost_usd: '1.4632100'
                        platform_fee_usd: '0.0731600'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    UsageFilter:
      properties:
        since:
          anyOf:
            - type: string
            - type: 'null'
          title: Since
        until:
          anyOf:
            - type: string
            - type: 'null'
          title: Until
        model:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Model
        status:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Status
        key_id:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Key Id
        org_id:
          type: string
          title: Org Id
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Id
        member_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Member User Id
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
        limit:
          anyOf:
            - type: integer
              maximum: 200
              minimum: 1
            - type: 'null'
          title: Limit
          default: 50
        offset:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Offset
          default: 0
      type: object
      required:
        - org_id
      title: UsageFilter
    app__usage__analytics__UsageSummary:
      properties:
        total_requests:
          type: integer
          title: Total Requests
        successful_requests:
          type: integer
          title: Successful Requests
        error_requests:
          type: integer
          title: Error Requests
        prompt_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Prompt Tokens
        completion_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completion Tokens
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
        total_cost_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Total Cost Usd
        total_platform_fee_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Total Platform Fee Usd
        total_byok_platform_fee_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Total Byok Platform Fee Usd
        total_byok_cost_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Total Byok Cost Usd
        total_byok_requests:
          type: integer
          title: Total Byok Requests
          default: 0
        total_platform_requests:
          type: integer
          title: Total Platform Requests
          default: 0
        total_byok_tokens:
          type: integer
          title: Total Byok Tokens
          default: 0
        total_platform_tokens:
          type: integer
          title: Total Platform Tokens
          default: 0
        by_model:
          items:
            $ref: '#/components/schemas/ModelBreakdown'
          type: array
          title: By Model
        by_model_total:
          type: integer
          title: By Model Total
          default: 0
        cached_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Cached At
      type: object
      required:
        - total_requests
        - successful_requests
        - error_requests
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - total_cost_usd
        - by_model
      title: UsageSummary
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ModelBreakdown:
      properties:
        model:
          type: string
          title: Model
        requests:
          type: integer
          title: Requests
        error_requests:
          type: integer
          title: Error Requests
          default: 0
        prompt_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Prompt Tokens
        completion_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completion Tokens
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
        cost_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Cost Usd
        platform_fee_usd:
          anyOf:
            - type: string
            - type: 'null'
          title: Platform Fee Usd
      type: object
      required:
        - model
        - requests
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - cost_usd
      title: ModelBreakdown
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````