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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Credit Balance

> Read the current wallet balance and the amount available to an API key.

Read the current wallet balance and the amount available to the API key used for
the request. This is a read-only endpoint and does not accept query parameters.

## Request

```bash curl theme={null}
curl -sS https://api.aisa.one/v1/credits/balance \
  -H "Authorization: Bearer $AISA_API_KEY"
```

The endpoint requires a standard AIsa API key in the `Authorization` header. It
does not accept MPP payment authorization.

## Response

```json theme={null}
{
  "currency": "USD",
  "account_balance_micros_usd": 3250000,
  "available_balance_micros_usd": 1750000,
  "go_to_market_balance_micros_usd": 750000,
  "gtm": {
    "active": true,
    "balance_micros_usd": 750000,
    "trial_balance_micros_usd": 250000,
    "trial_expires_at": "2026-10-31T12:00:00Z",
    "subscription_balance_micros_usd": 400000,
    "subscription_addon_balance_micros_usd": 100000,
    "subscription_addon_available_micros_usd": 100000,
    "subscription_addon_frozen_micros_usd": 0,
    "expires_at": "2026-10-31T12:00:00Z"
  },
  "media_promo": {
    "balance_micros_usd": 200000,
    "next_expires_at": "2026-10-31T12:00:00Z"
  },
  "api_key": {
    "unlimited": false,
    "remaining_micros_usd": 1000000,
    "used_micros_usd": 300000
  },
  "as_of": "2026-10-12T12:00:00Z"
}
```

All monetary values are integer microdollars. One dollar is `1,000,000`
microdollars. This avoids floating-point rounding in automated clients.

### Top-level fields

| Field | Type | Description |
| - | - | - |
| `currency` | string | The balance currency. Currently always `USD`. |
| `account_balance_micros_usd` | integer | Effective PAYG balance plus the GTM balance. |
| `available_balance_micros_usd` | integer | PAYG balance available to the authenticated API key plus the GTM balance. |
| `go_to_market_balance_micros_usd` | integer | Total GTM balance. This equals `gtm.balance_micros_usd`. |
| `gtm` | object | GTM balance details, including trial and subscription balances. |
| `media_promo` | object | Provider-scoped media credit, reported separately from general available balance. |
| `api_key` | object | Remaining and used balance for this API key. |
| `as_of` | string | UTC timestamp for the balance snapshot. |

### GTM fields

| Field | Type | Description |
| - | - | - |
| `active` | boolean | Whether GTM funds are available or a GTM subscription period exists. |
| `balance_micros_usd` | integer | Total GTM balance. |
| `trial_balance_micros_usd` | integer | Unexpired GTM trial balance. |
| `trial_expires_at` | string | UTC expiry of the GTM trial balance. Omitted when no trial expiry applies. |
| `subscription_balance_micros_usd` | integer | GTM subscription balance. |
| `subscription_addon_balance_micros_usd` | integer | Total add-on credit, including available and frozen parts. |
| `subscription_addon_available_micros_usd` | integer | Add-on credit spendable during an active paid plan period; included in GTM balance. |
| `subscription_addon_frozen_micros_usd` | integer | Add-on credit currently frozen without an active paid plan period; excluded from available and GTM totals. |
| `expires_at` | string | UTC expiry of the current GTM subscription period. Omitted when no period applies. |

### Media promo fields

`media_promo.balance_micros_usd` is credit restricted to the providers named by its credit lots. It is excluded from both general account and available balance totals. `next_expires_at` is the next lot expiry and is omitted when none applies. A positive media promo balance does not imply that an unrelated API request can be funded.

### Balance calculation

The PAYG balance is the sum of the effective cash, Trial, promo, and credit
buckets. An expired Trial balance is excluded.

`go_to_market_balance_micros_usd` is the GTM balance. It is also exposed as
`gtm.balance_micros_usd`, with its trial, subscription, and available add-on components in the
`gtm` object. Frozen add-on credit is reported separately and excluded from this total.

`account_balance_micros_usd` is the PAYG balance plus
`go_to_market_balance_micros_usd`.

For a limited API key, `available_balance_micros_usd` is the lower of the PAYG
balance and `api_key.remaining_micros_usd`, plus the GTM balance. For an
unlimited API key, it equals the PAYG balance plus the GTM balance. The PAYG
portion available to the key is clamped at zero when the PAYG or key balance is
negative.

Expired Trial credit is not included in the effective balance.

## Errors

* `401 Unauthorized` — the API key is missing, invalid, revoked, or expired.
* `403 Forbidden` — the user is disabled or the key is not allowed from the
  requesting IP address.
* `500 Internal Server Error` — the balance snapshot could not be read.

Errors from this endpoint use a string-valued `error` field:

```json theme={null}
{
  "error": "invalid api key"
}
```

See [Error Codes](https://aisa.one/docs/api-reference/errors.md) for general status-code and retry
guidance, and [Rate Limits](https://aisa.one/docs/api-reference/rate-limits.md) for request limits.

## Request contract

* **Method and path:** GET /credits/balance
* **Request URL template:** `https://api.aisa.one/v1/credits/balance`

[Complete OpenAPI definition](https://aisa.one/docs/reference-contracts/account.json)

Effective request declaration (including authentication and referenced schemas):

```json theme={null}
{
  "operationId": "accountCreditsBalance",
  "method": "GET",
  "path": "/credits/balance",
  "servers": [
    {
      "url": "https://api.aisa.one/v1"
    }
  ],
  "parameters": [],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "AISA API Key or OAuth access token",
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```


## OpenAPI

````yaml reference-contracts/account.json GET /credits/balance
openapi: 3.0.3
info:
  description: >-
    Programmatic account endpoints for balance and usage monitoring. Both accept
    an AIsa API key (Bearer) or an OAuth access token, so unattended production
    callers can read balance and usage for cost monitoring and alerting.


    All monetary values are integer micro-USD (1 USD = 1,000,000 micros).
  title: AIsa Account & Usage API
  version: 1.0.0
servers:
  - url: https://api.aisa.one/v1
security:
  - BearerAuth: []
paths:
  /credits/balance:
    get:
      summary: Account Balance
      description: >-
        Return the current account credit balance. Accepts either an API key or
        an OAuth access token. No parameters.
      operationId: accountCreditsBalance
      parameters: []
      responses:
        '200':
          content:
            application/json:
              example:
                account_balance_micros_usd: 3250000
                api_key:
                  remaining_micros_usd: 1000000
                  unlimited: false
                  used_micros_usd: 300000
                as_of: '2026-08-27T10:36:29Z'
                available_balance_micros_usd: 1750000
                currency: USD
                go_to_market_balance_micros_usd: 750000
                gtm:
                  active: true
                  balance_micros_usd: 750000
                  expires_at: '2026-10-31T12:00:00Z'
                  subscription_balance_micros_usd: 500000
                  trial_balance_micros_usd: 250000
                  trial_expires_at: '2026-09-30T12:00:00Z'
              schema:
                properties:
                  account_balance_micros_usd:
                    description: Effective PAYG balance plus the GTM balance, in micro-USD.
                    format: int64
                    type: integer
                  api_key:
                    description: >-
                      Per-key limit view for the calling API key (absent for
                      OAuth callers).
                    properties:
                      remaining_micros_usd:
                        description: >-
                          Remaining per-key allowance in micro-USD (0 when
                          unlimited).
                        format: int64
                        type: integer
                      unlimited:
                        description: True when the key has no per-key spend cap.
                        type: boolean
                      used_micros_usd:
                        description: Amount spent by this key in micro-USD.
                        format: int64
                        type: integer
                    type: object
                  as_of:
                    description: Snapshot timestamp (RFC 3339, UTC).
                    format: date-time
                    type: string
                  available_balance_micros_usd:
                    description: >-
                      PAYG balance available to the authenticated API key plus
                      the GTM balance, in micro-USD. For a limited key this is
                      min(PAYG balance, key remaining balance) + GTM balance.
                    format: int64
                    type: integer
                  currency:
                    description: ISO currency code (always USD).
                    type: string
                  go_to_market_balance_micros_usd:
                    description: >-
                      Total GTM balance in micro-USD. Equal to
                      gtm.balance_micros_usd.
                    format: int64
                    type: integer
                  gtm:
                    description: >-
                      GTM balance details. The total includes GTM trial and
                      subscription balances.
                    properties:
                      active:
                        description: >-
                          True when GTM funds are available or a GTM
                          subscription period exists.
                        type: boolean
                      balance_micros_usd:
                        description: Total GTM balance in micro-USD.
                        format: int64
                        type: integer
                      expires_at:
                        description: >-
                          Current GTM subscription period expiry (RFC 3339,
                          UTC). Omitted when no period applies.
                        format: date-time
                        type: string
                      subscription_balance_micros_usd:
                        description: GTM subscription balance in micro-USD.
                        format: int64
                        type: integer
                      trial_balance_micros_usd:
                        description: Unexpired GTM trial balance in micro-USD.
                        format: int64
                        type: integer
                      trial_expires_at:
                        description: >-
                          GTM trial balance expiry (RFC 3339, UTC). Omitted when
                          no trial expiry applies.
                        format: date-time
                        type: string
                    type: object
                type: object
          description: Current balance snapshot.
components:
  securitySchemes:
    BearerAuth:
      bearerFormat: AISA API Key or OAuth access token
      scheme: bearer
      type: http

````

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