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

# Get your balance

> Your account's credit cap, spend to date and remaining balance, in USD. Figures
are current to within about a minute. When `balance_usd` reaches zero, inference
requests return `422` (`type: budget_exceeded`) until you top up on the
[dashboard](https://dashboard.primalabs.ai).




## OpenAPI

````yaml /api-reference/inference/openapi.yaml get /credits
openapi: 3.1.0
info:
  title: PrimaLabs Inference API
  version: 1.0.0
  description: >
    Serverless LLM inference on PrimaLabs. The API is OpenAI-compatible: point
    any

    OpenAI SDK at the base URL below and pass a PrimaLabs API key as the bearer

    token. Anthropic (`/messages`) and OpenAI Responses (`/responses`) formats
    are

    also accepted as passthroughs.


    This is a **curated** spec covering the endpoints we serve; it is maintained
    by

    hand. The current model list is published at

    https://docs.primalabs.ai/inference/models.
servers:
  - url: https://api.primalabs.ai/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Chat
    description: OpenAI-compatible chat completions — the primary endpoint.
  - name: Completions
    description: Legacy text completions.
  - name: Models
    description: The models your key can call, with context, pricing and capabilities.
  - name: Account
    description: Your account's balance.
  - name: Passthrough
    description: Anthropic and OpenAI Responses formats, forwarded as-is.
paths:
  /credits:
    get:
      tags:
        - Account
      summary: Get your balance
      description: >
        Your account's credit cap, spend to date and remaining balance, in USD.
        Figures

        are current to within about a minute. When `balance_usd` reaches zero,
        inference

        requests return `422` (`type: budget_exceeded`) until you top up on the

        [dashboard](https://dashboard.primalabs.ai).
      operationId: getCredits
      responses:
        '200':
          description: Your balance.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credits'
              example:
                object: credits
                currency: usd
                cap_usd: 25
                spent_usd: 7.25
                balance_usd: 17.75
                as_of: 1760460000
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          description: The balance could not be read right now. Retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Credits:
      type: object
      properties:
        object:
          type: string
          example: credits
        currency:
          type: string
          example: usd
        cap_usd:
          type:
            - number
            - 'null'
          description: >-
            Your spending cap in USD. `null` means the account has no cap, so
            `balance_usd` is `null` too.
          example: 25
        spent_usd:
          type: number
          example: 7.25
        balance_usd:
          type:
            - number
            - 'null'
          description: >-
            `cap_usd` minus `spent_usd`, or `null` when there is no cap. Can go
            slightly negative when the last requests overshoot the cap.
          example: 17.75
        as_of:
          type: integer
          description: Unix time of the figures.
          example: 1760460000
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type: string
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Authentication Error, Invalid proxy server token passed.
              type: token_not_found_in_db
              param: key
              code: '401'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your PrimaLabs API key, sent as `Authorization: Bearer <key>`.'

````

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