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

# Get the balance

> Your account balance. It can be negative after a final cost exceeds its estimate; new generations then fail with `insufficient_balance` until you top up.



## OpenAPI

````yaml /openapi.json get /balance
openapi: 3.1.0
info:
  title: Codzen API
  version: 1.0.0
  description: >-
    Generate video and images with every Codzen model through one asynchronous
    API.
servers:
  - url: https://codzen.ai/api/v1
security:
  - apiKey: []
paths:
  /balance:
    get:
      summary: Get the balance
      description: >-
        Your account balance. It can be negative after a final cost exceeds its
        estimate; new generations then fail with `insufficient_balance` until
        you top up.
      operationId: getBalance
      responses:
        '200':
          description: The balance.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Balance'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  headers:
    RequestId:
      description: ID of the request; quote it when contacting support.
      schema:
        type: string
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: 0
  schemas:
    Balance:
      type: object
      properties:
        amount:
          type: string
          pattern: ^-?\d+(\.\d+)?$
          description: >-
            Balance in USD; it can be negative after a final cost exceeds its
            estimate.
        currency:
          type: string
          const: USD
      required:
        - amount
        - currency
      additionalProperties: false
      description: Your account balance.
    HttpError:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Error'
        request_id:
          type: string
          description: ID of the request, also in the `x-request-id` header.
      required:
        - error
        - request_id
      additionalProperties: false
      description: Body of every error response.
    Error:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
            - authentication_error
            - billing_error
            - permission_error
            - not_found_error
            - rate_limit_error
            - upstream_error
            - api_error
          description: Broad category of the error.
        code:
          type: string
          enum:
            - invalid_request
            - content_rejected
            - invalid_api_key
            - insufficient_balance
            - api_key_disabled
            - account_suspended
            - model_not_found
            - generation_not_found
            - rate_limited
            - concurrency_limit
            - model_unavailable
            - upstream_failed
            - timeout
            - internal_error
          description: Stable error code; branch on this, not on `message`.
        message:
          type: string
          description: Human-readable explanation; it may change at any time.
        param:
          description: The request field the error is about, such as `input.seed`.
          type: string
        stage:
          description: >-
            For `content_rejected`: whether the input or the output was
            rejected.
          type: string
          enum:
            - input
            - output
        retryable:
          type: boolean
          description: Whether sending the same request again may succeed.
      required:
        - type
        - code
        - message
        - retryable
      additionalProperties: false
      description: What went wrong.
  responses:
    Unauthorized:
      description: The API key is missing or invalid (`authentication_error`).
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HttpError'
    Forbidden:
      description: >-
        The API key is disabled or the account is suspended
        (`permission_error`).
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HttpError'
    TooManyRequests:
      description: >-
        Too many requests or concurrent generations (`rate_limit_error`). Retry
        after the `Retry-After` header.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HttpError'
    InternalServerError:
      description: Something went wrong on our side (`api_error`). Retry later.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HttpError'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Your API key (`cz_…`), created in the console. Use it only on your
        server.

````

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