Credit accounts are wallets
A customer holds one credit account per denomination they transact in — aunit wallet for “AI Credits”, a usd wallet for prepaid dollars, and so on. Each wallet is its own bucket; balances are never combined across wallets.
A wallet accumulates grants (deposits) and deductions (usage), and its balance at any moment is:
Wallet lifecycle
A credit account moves through three states:| Status | Meaning | Can deduct? | Can grant? |
|---|---|---|---|
ACTIVE | Normal operation | Yes | Yes |
FROZEN | Temporarily suspended — usage is blocked but the balance is preserved | No | — |
CLOSED | Retired — the wallet is done | No | No |
FROZEN is a pause, not a loss — grants stay on the books and become spendable again when the wallet returns to ACTIVE. CLOSED is terminal.
The
ACTIVE / FROZEN / CLOSED lifecycle is part of v2 credit accounts. Reach for FROZEN when you need to halt consumption without wiping a customer’s balance — for example while a billing dispute is resolved.The ledger
The ledger is the append-only record of every grant and every deduction against a wallet. Nothing is edited in place and nothing is deleted — a correction is a new entry, never a rewrite. That gives you:- A complete audit trail — every credit’s origin and every unit’s consumption is traceable.
- A derivable balance — replay the open grants and you get the current balance, at any point in time.
- Explainable deductions — you can show exactly which grant a unit of usage was drawn from and why (via the priority convention).
Reserving before you spend
For operations whose final cost you don’t know upfront — an AI completion, a long-running job — you can hold balance on a wallet before the work starts, then confirm, adjust, or release the hold when it finishes. This reserve → work → finalize flow keeps concurrent requests from double-spending the same credits.Reading a wallet
Read a customer’s live per-wallet balance fromGET /v1/credit-accounts?customerId=…, the grants behind it from GET /v1/credit-grants?customerId=…, and the full history from GET /v1/credit-ledger?customerId=…. In the app, the React hooks render wallets, ledger, and burn directly.
See also
Grants & priority
What a grant is and the order deductions draw from.
Top-ups
How a top-up lands as a grant on the wallet.
Credit accounts (React)
Render a customer’s wallets and ledger in your UI.
Quickstart
Grant, spend, and read the ledger end to end.