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

# List charged spend by day and model

> The calling key's workspace's charged spend, token counts and request counts, one row per UTC day and model. Every figure is the amount charged. Synchronous requests count on the day they started and video jobs on the day they settled, and a day or model with no requests has no row rather than a row of zeros.

With no range it covers the last 30 days. `from` and `to` each take an ISO date or a Unix millisecond timestamp, and a bare date as `to` covers that whole UTC day. A range longer than the usage retention window is refused rather than shortened, and the refusal names the window. Rows are never split by key; read `GET /v1/key/usage` for one key's spend.

This read counts in a bucket of its own, 60 reads a minute per key shared by the workspace's balance and spend reads, so polling it never spends the request rate your inference calls need. The workspace is the calling key's own, and no id in the request can name another. Nothing here writes, and every answer carries `Cache-Control: no-store` and the instant it was read in `as_of`.



## OpenAPI

````yaml /api-reference/openapi.public.json get /v1/usage
openapi: 3.0.3
info:
  title: Hopscotch
  version: v1
  description: >-
    An OpenAI-compatible inference API. Point an OpenAI client at
    https://api.hopscotchlabs.ai, give it a Hopscotch API key, and call models
    across providers on one prepaid balance.


    Every response, errors included, matches the shape an unmodified OpenAI SDK
    expects.
servers:
  - url: https://api.hopscotchlabs.ai
    description: Production
security:
  - customerApiKey: []
tags:
  - name: Chat
    description: Chat completions, streamed or not.
  - name: Models
    description: What you can call.
  - name: Completions
    description: Text completions, streamed or not.
  - name: Messages
    description: The Anthropic Messages API, streamed or not.
  - name: Usage
    description: >-
      What one request recorded and cost, and what your workspace and key have
      spent and have left.
  - name: Videos
    description: 'Video jobs: create, poll, download, delete.'
  - name: Images
    description: Generate images with an offered image model.
  - name: Audio
    description: Speech, transcription and translation.
paths:
  /v1/usage:
    get:
      tags:
        - Usage
      summary: List charged spend by day and model
      description: >-
        The calling key's workspace's charged spend, token counts and request
        counts, one row per UTC day and model. Every figure is the amount
        charged. Synchronous requests count on the day they started and video
        jobs on the day they settled, and a day or model with no requests has no
        row rather than a row of zeros.


        With no range it covers the last 30 days. `from` and `to` each take an
        ISO date or a Unix millisecond timestamp, and a bare date as `to` covers
        that whole UTC day. A range longer than the usage retention window is
        refused rather than shortened, and the refusal names the window. Rows
        are never split by key; read `GET /v1/key/usage` for one key's spend.


        This read counts in a bucket of its own, 60 reads a minute per key
        shared by the workspace's balance and spend reads, so polling it never
        spends the request rate your inference calls need. The workspace is the
        calling key's own, and no id in the request can name another. Nothing
        here writes, and every answer carries `Cache-Control: no-store` and the
        instant it was read in `as_of`.
      operationId: listDailyUsage
      parameters:
        - name: from
          in: query
          required: false
          description: >-
            The start of the range, an ISO date or a Unix millisecond timestamp.
            Defaults to 30 days before `to`.
          schema:
            type: string
          example: '2026-10-01'
        - name: to
          in: query
          required: false
          description: >-
            The end of the range, inclusive. A bare date covers the whole UTC
            day. Defaults to now.
          schema:
            type: string
          example: '2026-10-21'
      responses:
        '200':
          description: The daily totals.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicUsage'
              example:
                object: usage
                currency: USD
                from: '2026-09-21T15:30:00.000Z'
                to: '2026-10-21T15:30:00.000Z'
                bucketing: >-
                  Usage is grouped by UTC day: synchronous requests on the day
                  they started and video jobs on the day they settled. charge is
                  an exact dollar string.
                data:
                  - day: '2026-10-21'
                    model: gpt-4o-mini
                    requests: 2
                    prompt_tokens: 20
                    completion_tokens: 10
                    total_tokens: 30
                    charge: '0.002'
                as_of: '2026-10-21T15:30:00.000Z'
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
        '400':
          description: >-
            `from` or `to` is neither an ISO date nor a millisecond timestamp,
            `from` is later than `to`, or the range is longer than the retention
            window, with code `invalid_range`. The message names which.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                format:
                  summary: A bound that is not a date
                  value:
                    error:
                      message: >-
                        from and to must each be an ISO date such as 2026-08-01
                        or a Unix millisecond timestamp.
                      type: invalid_request_error
                      param: from
                      code: invalid_range
                      request_id: REQUEST_ID
                order:
                  summary: from is later than to
                  value:
                    error:
                      message: from must not be later than to.
                      type: invalid_request_error
                      param: from
                      code: invalid_range
                      request_id: REQUEST_ID
                too_long:
                  summary: Longer than the retention window
                  value:
                    error:
                      message: >-
                        That range is longer than the 90 days usage records are
                        kept for. Ask for at most 90 days at a time. The
                        guaranteed minimum retention is 62 days.
                      type: invalid_request_error
                      param: from
                      code: invalid_range
                      request_id: REQUEST_ID
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
        '401':
          description: >-
            No key, a scheme other than Bearer, a key of the wrong shape, a key
            we reject, or a key past its own expiry date, which carries code
            `key_expired` and names the date it expired on.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: Incorrect API key provided.
                  type: authentication_error
                  param: null
                  code: invalid_api_key
                  request_id: REQUEST_ID
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
        '403':
          description: >-
            Refused for a setting the caller owns rather than anything about the
            model, and `code` names which. A key whose account staff have
            suspended is refused with code `account_suspended`, before any
            credit is held or any provider is called; contact support, because
            retrying will not change the answer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                account_suspended:
                  summary: The key's account is suspended
                  value:
                    error:
                      message: >-
                        This account is suspended, so it cannot send requests.
                        Contact support. Request id REQUEST_ID.
                      type: permission_error
                      param: null
                      code: account_suspended
                      request_id: REQUEST_ID
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
        '405':
          description: >-
            A method other than GET on this path. Nothing here writes. The route
            boundary answers this before any key is looked at.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: POST is not supported for /v1/usage in this release.
                  type: invalid_request_error
                  param: null
                  code: method_not_allowed
                  request_id: REQUEST_ID
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
            Allow:
              description: The methods this path accepts.
              schema:
                type: string
                enum:
                  - GET
              example: GET
        '429':
          description: >-
            This key's spend reads reached 60 in a minute, counted apart from
            its inference rate, with code `rate_limit_exceeded`. Wait the number
            of seconds `Retry-After` names.
          headers:
            Retry-After:
              schema:
                type: integer
                minimum: 1
              example: 12
              description: Seconds to wait.
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    Rate limit reached for this key. Try again in 12 seconds.
                    Request id REQUEST_ID.
                  type: rate_limit_error
                  param: null
                  code: rate_limit_exceeded
                  request_id: REQUEST_ID
        '503':
          description: >-
            The figure could not be read just now, with code
            `balance_unavailable`. Nothing was changed; retry shortly.
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    This workspace's usage could not be read just now. Nothing
                    was changed; try again shortly.
                  type: api_error
                  param: null
                  code: balance_unavailable
                  request_id: REQUEST_ID
      security:
        - customerApiKey: []
      servers:
        - url: https://api.hopscotchlabs.ai
          description: Production
components:
  schemas:
    PublicUsage:
      type: object
      additionalProperties: false
      required:
        - object
        - currency
        - from
        - to
        - bucketing
        - data
        - as_of
      properties:
        object:
          type: string
          enum:
            - usage
        currency:
          type: string
          example: USD
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        bucketing:
          type: string
          description: Which day a figure belongs to.
        data:
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - day
              - model
              - requests
              - prompt_tokens
              - completion_tokens
              - total_tokens
              - charge
            properties:
              day:
                type: string
                description: The UTC day, YYYY-MM-DD.
              model:
                type: string
              requests:
                type: integer
              prompt_tokens:
                type: integer
              completion_tokens:
                type: integer
              total_tokens:
                type: integer
              charge:
                type: string
                description: >-
                  An exact decimal dollar amount with no sign or symbol, as many
                  places as it has (up to six).
                example: '0.002'
        as_of:
          type: string
          format: date-time
    Error:
      type: object
      description: The error envelope. One top-level `error` key, always, at every status.
      required:
        - error
      additionalProperties: false
      properties:
        error:
          type: object
          required:
            - message
            - type
            - param
            - code
          additionalProperties: false
          properties:
            message:
              type: string
              description: Prose for a person. It may be reworded, so do not branch on it.
            type:
              type: string
              description: The category an SDK branches on. A closed set.
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - not_found_error
                - rate_limit_error
                - api_error
                - insufficient_quota
                - server_error
            param:
              type: string
              nullable: true
              description: >-
                The request field at fault, or null. Present and null rather
                than absent.
            code:
              type: string
              nullable: true
              description: The stable machine-readable reason. Branch on this.
            request_id:
              type: string
              description: >-
                Our id for this request, the same value as the
                x-hopscotch-request-id header. Quote it when you contact
                support.
  headers:
    RequestId:
      description: >-
        Our id for this request. Quote it when you contact support. Present on
        every response, errors included.
      schema:
        type: string
  securitySchemes:
    customerApiKey:
      type: http
      scheme: bearer
      description: >-
        A workspace API key in an `Authorization: Bearer` header. A missing
        header, a scheme other than Bearer, a key of the wrong shape, and a key
        we reject are all 401.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.