> ## 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 as numbers

> The calling key's charged spend this UTC day, this Monday-to-Sunday week and this month, with its credit limit and what is left of it: the figures `GET /v1/key/usage` returns, under a `data` object with money as JSON numbers. It suits a tool that already expects to read a key's usage and limit in this shape. `usage` and `usage_monthly` are both this month's spend, `usage_weekly` this week's and `usage_daily` today's; the week can begin in the previous month, so early in a month `usage_weekly` can exceed `usage_monthly`. `label` is the calling key's id. `limit` and `limit_remaining` are null for a key with no limit, and `limit_reset` is null for a key with no limit or a limit that never resets. `limit_remaining` counts credit held for this key's requests still in flight as spent, the way admission does. `is_free_tier` is always `false`.

Each amount is a JSON number written from the exact decimal's own digits, never rounded on our side; a client that parses it into a double keeps about fifteen significant digits. Read `GET /v1/key/usage` for the same figures as exact decimal 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
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:
    get:
      tags:
        - Usage
      summary: Retrieve this key's spend and limit as numbers
      description: >-
        The calling key's charged spend this UTC day, this Monday-to-Sunday week
        and this month, with its credit limit and what is left of it: the
        figures `GET /v1/key/usage` returns, under a `data` object with money as
        JSON numbers. It suits a tool that already expects to read a key's usage
        and limit in this shape. `usage` and `usage_monthly` are both this
        month's spend, `usage_weekly` this week's and `usage_daily` today's; the
        week can begin in the previous month, so early in a month `usage_weekly`
        can exceed `usage_monthly`. `label` is the calling key's id. `limit` and
        `limit_remaining` are null for a key with no limit, and `limit_reset` is
        null for a key with no limit or a limit that never resets.
        `limit_remaining` counts credit held for this key's requests still in
        flight as spent, the way admission does. `is_free_tier` is always
        `false`.


        Each amount is a JSON number written from the exact decimal's own
        digits, never rounded on our side; a client that parses it into a double
        keeps about fifteen significant digits. Read `GET /v1/key/usage` for the
        same figures as exact decimal 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: retrieveKeyLimits
      responses:
        '200':
          description: The key's spend and limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicKeyLimits'
              example:
                as_of: '2026-10-21T15:30:00.000Z'
                data:
                  label: 3f2a9c1e
                  limit: 10
                  limit_remaining: 6
                  limit_reset: daily
                  usage: 7
                  usage_daily: 1
                  usage_weekly: 3
                  usage_monthly: 7
                  is_free_tier: false
          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 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:
    PublicKeyLimits:
      type: object
      additionalProperties: false
      required:
        - data
        - as_of
      properties:
        as_of:
          type: string
          format: date-time
        data:
          type: object
          additionalProperties: false
          required:
            - label
            - limit
            - limit_remaining
            - limit_reset
            - usage
            - usage_daily
            - usage_weekly
            - usage_monthly
            - is_free_tier
          properties:
            label:
              type: string
              description: The calling key's id.
              example: 3f2a9c1e
            limit:
              type: number
              nullable: true
              description: >-
                An exact decimal dollar amount written as a JSON number from its
                own digits, never rounded on our side. null for a key with no
                limit.
              example: 10
            limit_remaining:
              type: number
              nullable: true
              description: >-
                An exact decimal dollar amount written as a JSON number from its
                own digits, never rounded on our side. 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.
            usage:
              type: number
              description: >-
                This key's charged spend this UTC month, the same figure as
                `usage_monthly`. An exact decimal dollar amount written as a
                JSON number from its own digits, never rounded on our side.
              example: 7
            usage_daily:
              type: number
              description: >-
                This key's charged spend this UTC day. An exact decimal dollar
                amount written as a JSON number from its own digits, never
                rounded on our side.
              example: 1
            usage_weekly:
              type: number
              description: >-
                This key's charged spend this Monday-to-Sunday UTC week. An
                exact decimal dollar amount written as a JSON number from its
                own digits, never rounded on our side.
              example: 3
            usage_monthly:
              type: number
              description: >-
                This key's charged spend this UTC month. An exact decimal dollar
                amount written as a JSON number from its own digits, never
                rounded on our side.
              example: 7
            is_free_tier:
              type: boolean
              description: Always `false`.
    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.