> ## 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.

# Retrieve this key's spend and limit

> What the calling key has been charged today, this Monday-to-Sunday week and this month, in UTC, with its credit limit and what is left of it. `limit_remaining` counts credit held for this key's requests still in flight as spent, the way admission does. `limit`, `limit_remaining` and `limit_reset` are null for a key with no limit, and `limit_reset` is also null for a limit that never resets. The week can begin in the previous month, so early in a month `week` can exceed `month`. Amounts are exact decimal dollar strings.

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/key/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/key/usage:
    get:
      tags:
        - Usage
      summary: Retrieve this key's spend and limit
      description: >-
        What the calling key has been charged today, this Monday-to-Sunday week
        and this month, in UTC, with its credit limit and what is left of it.
        `limit_remaining` counts credit held for this key's requests still in
        flight as spent, the way admission does. `limit`, `limit_remaining` and
        `limit_reset` are null for a key with no limit, and `limit_reset` is
        also null for a limit that never resets. The week can begin in the
        previous month, so early in a month `week` can exceed `month`. Amounts
        are exact decimal dollar strings.


        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: retrieveKeyUsage
      responses:
        '200':
          description: The key's spend and limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicKeyUsage'
              example:
                object: key_usage
                currency: USD
                usage:
                  today: '1'
                  week: '3'
                  month: '7'
                limit: '10'
                limit_remaining: '6'
                limit_reset: daily
                as_of: '2026-10-21T15:30:00.000Z'
          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/key/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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: >-
                    This key'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
          headers:
            x-hopscotch-request-id:
              $ref: '#/components/headers/RequestId'
      security:
        - customerApiKey: []
      servers:
        - url: https://api.hopscotchlabs.ai
          description: Production
components:
  schemas:
    PublicKeyUsage:
      type: object
      additionalProperties: false
      required:
        - object
        - currency
        - usage
        - limit
        - limit_remaining
        - limit_reset
        - as_of
      properties:
        object:
          type: string
          enum:
            - key_usage
        currency:
          type: string
          example: USD
        usage:
          type: object
          additionalProperties: false
          required:
            - today
            - week
            - month
          properties:
            today:
              type: string
              description: >-
                An exact decimal dollar amount with no sign or symbol, as many
                places as it has (up to six).
              example: '1'
            week:
              type: string
              description: >-
                An exact decimal dollar amount with no sign or symbol, as many
                places as it has (up to six).
              example: '3'
            month:
              type: string
              description: >-
                An exact decimal dollar amount with no sign or symbol, as many
                places as it has (up to six).
              example: '7'
        limit:
          type: string
          nullable: true
          description: An exact decimal dollar amount, or null for a key with no limit.
          example: '10'
        limit_remaining:
          type: string
          nullable: true
          description: An exact decimal dollar amount, or null for a key with no limit.
          example: '6'
        limit_reset:
          type: string
          nullable: true
          enum:
            - daily
            - weekly
            - monthly
            - null
          description: >-
            How often the key's limit starts counting again, in UTC calendar
            windows. null when the key has no limit or its limit never resets.
        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.