> ## 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 the workspace balance

> What the calling key's workspace has to spend. `available_balance` is `settled_balance` less `outstanding_reservations`, the credit held for requests still in flight, and it is the figure a new request is admitted against. Every amount is an exact decimal dollar string with no sign or symbol, up to six places, so parse it as a decimal rather than a float.

It is the same balance the dashboard shows.

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/balance
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/balance:
    get:
      tags:
        - Usage
      summary: Retrieve the workspace balance
      description: >-
        What the calling key's workspace has to spend. `available_balance` is
        `settled_balance` less `outstanding_reservations`, the credit held for
        requests still in flight, and it is the figure a new request is admitted
        against. Every amount is an exact decimal dollar string with no sign or
        symbol, up to six places, so parse it as a decimal rather than a float.


        It is the same balance the dashboard shows.


        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: retrieveBalance
      responses:
        '200':
          description: The balance.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBalance'
              example:
                object: balance
                currency: USD
                available_balance: '18.50'
                settled_balance: '20.00'
                outstanding_reservations: '1.50'
                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/balance 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: >-
                    The balance 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:
    PublicBalance:
      type: object
      additionalProperties: false
      required:
        - object
        - currency
        - available_balance
        - settled_balance
        - outstanding_reservations
        - as_of
      properties:
        object:
          type: string
          enum:
            - balance
        currency:
          type: string
          example: USD
        available_balance:
          type: string
          description: >-
            An exact decimal dollar amount with no sign or symbol, as many
            places as it has (up to six).
          example: '18.50'
        settled_balance:
          type: string
          description: >-
            An exact decimal dollar amount with no sign or symbol, as many
            places as it has (up to six).
          example: '20.00'
        outstanding_reservations:
          type: string
          description: >-
            An exact decimal dollar amount with no sign or symbol, as many
            places as it has (up to six).
          example: '1.50'
        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.