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

# Get balance

> Read available credit, reservations, and expiring promotional grants.

Available credit excludes holds and expired grants. All USD amounts are exact
decimal strings with nine fractional digits; use decimal or integer arithmetic.



## OpenAPI

````yaml /openapi.json get /v1/balance
openapi: 3.1.0
info:
  description: >-
    Synchronous structured predictions. Reuse Idempotency-Key for retries.
    Prices are USD decimal strings.
  title: D1 Prediction API
  version: 1.0.0
servers:
  - url: https://d1-staging-5gh8d.ondigitalocean.app
    description: Invited staging — simulated predictions and test credit
security:
  - APIKey: []
paths:
  /v1/balance:
    get:
      tags:
        - Account
      summary: Get balance
      description: >-
        Read available credit, reservations, and expiring promotional grants.


        Available credit excludes holds and expired grants. All USD amounts are
        exact

        decimal strings with nine fractional digits; use decimal or integer
        arithmetic.
      operationId: get_balance_v1_balance_get
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BalanceResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Malformed or ambiguous JSON.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Missing, invalid, or revoked API key.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Insufficient available credit.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Account is waitlisted or suspended.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Resource not found.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: >-
            Operation conflict, in-progress request, expired replay, or
            cancellation.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Request exceeds a body, input, or model limit.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '415':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Unsupported media type or content encoding.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Request validation failed or model is unavailable.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Account request, token, concurrency, or read limit exceeded.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: >-
            Unexpected service error; replay a prediction to resolve
            uncertainty.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Invalid model output; no charge is settled.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Service paused, capacity exhausted, or dependency unavailable.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
          description: Prediction deadline exceeded; replay using the same operation key.
          headers:
            Retry-After:
              description: When present, wait this many seconds before retrying.
              schema:
                minimum: 1
                type: integer
            X-Request-ID:
              description: Server request identifier for support and correlation.
              schema:
                type: string
components:
  schemas:
    BalanceResponse:
      additionalProperties: false
      properties:
        available_usd:
          pattern: ^\d+\.\d{9}$
          title: Available Usd
          type: string
        currency:
          const: USD
          title: Currency
          type: string
        expiring_grants:
          items:
            $ref: '#/components/schemas/ExpiringGrant'
          title: Expiring Grants
          type: array
        financial_shortfall_usd:
          pattern: ^\d+\.\d{9}$
          title: Financial Shortfall Usd
          type: string
        paid_usd:
          pattern: ^\d+\.\d{9}$
          title: Paid Usd
          type: string
        promotional_usd:
          pattern: ^\d+\.\d{9}$
          title: Promotional Usd
          type: string
        reserved_usd:
          pattern: ^\d+\.\d{9}$
          title: Reserved Usd
          type: string
      required:
        - currency
        - available_usd
        - reserved_usd
        - paid_usd
        - promotional_usd
        - financial_shortfall_usd
        - expiring_grants
      title: BalanceResponse
      type: object
    ErrorEnvelope:
      additionalProperties: false
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      title: ErrorEnvelope
      type: object
    ExpiringGrant:
      additionalProperties: false
      properties:
        amount_usd:
          pattern: ^\d+\.\d{9}$
          title: Amount Usd
          type: string
        expires_at:
          format: date-time
          title: Expires At
          type: string
        id:
          format: uuid
          title: Id
          type: string
      required:
        - id
        - amount_usd
        - expires_at
      title: ExpiringGrant
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
        request_id:
          title: Request Id
          type: string
      required:
        - code
        - message
        - request_id
      title: ErrorDetail
      type: object
  securitySchemes:
    APIKey:
      scheme: bearer
      type: http

````