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

# Get credit balance and key spend

> Credit balance for the account that owns the API key, plus the credits spent by the calling key (key_spent), optionally since a Unix time. Free: no credits are charged and no hold is placed. Returns 200 even when available is 0, so you can alert and pause before a request fails with 402.



## OpenAPI

````yaml /openapi.json get /v1/credits
openapi: 3.1.0
info:
  title: Refuseless API
  version: 1.0.0
  description: >-
    OpenAI-compatible hosted inference for a named lineup of refusal-removed
    open weights.
servers:
  - url: https://api.refuseless.com
security:
  - bearerAuth: []
paths:
  /v1/credits:
    get:
      tags:
        - Credits
      summary: Get credit balance and key spend
      description: >-
        Credit balance for the account that owns the API key, plus the credits
        spent by the calling key (key_spent), optionally since a Unix time.
        Free: no credits are charged and no hold is placed. Returns 200 even
        when available is 0, so you can alert and pause before a request fails
        with 402.
      operationId: getCredits
      parameters:
        - name: since
          in: query
          required: false
          description: >-
            Unix time in seconds. When set, key_spent counts only requests
            started at or after it.
          schema:
            type: integer
            minimum: 0
      responses:
        '200':
          description: Credit balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Credits'
        '400':
          description: since is not a Unix time in seconds (bad_request)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Too many balance requests (60 per minute per key)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: Billing service unreachable (gateway_down)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    Credits:
      type: object
      required:
        - object
        - balance
        - reserved
        - available
        - key_limit
        - key_spent
        - key_spent_since
        - unit
        - updated_at
      properties:
        object:
          type: string
          const: credits
        balance:
          type: number
          description: >-
            Total credits on the account, including credits held by in-flight
            requests.
          examples:
            - 42.5
        reserved:
          type: number
          description: >-
            Credits currently held by in-flight requests. Unused holds return to
            the balance when each request settles.
          examples:
            - 1.2
        available:
          type: number
          description: >-
            What a new request can reserve: balance minus reserved, capped by
            key_limit when the key has a budget.
          examples:
            - 41.3
        key_limit:
          type:
            - number
            - 'null'
          description: >-
            What this key's spend budget (or its workspace's limit) still
            allows. null when the key has no budget.
          examples:
            - null
        key_spent:
          type: number
          description: >-
            Credits billed to this key for finished requests, all time or since
            the since parameter. Excludes in-flight requests and plan or promo
            usage.
          examples:
            - 3.184211
        key_spent_since:
          type:
            - integer
            - 'null'
          description: The since parameter echoed back, or null for all time.
          examples:
            - null
        unit:
          type: string
          const: usd
          description: Amounts are in US dollars, with up to 6 decimal places.
        updated_at:
          type: integer
          description: >-
            Unix time in seconds when the balance was read. Values are live, not
            cached.
          examples:
            - 1793836800
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - type
          properties:
            code:
              type: string
              examples:
                - invalid_key
                - insufficient_credits
                - model_not_found
                - model_busy
                - model_warming
                - upstream_error
                - model_unavailable
            message:
              type: string
            type:
              type: string
              examples:
                - api_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: YOUR_API_KEY

````

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