Return the user’s balance, computed only from the token_credits ledger.
Unlike the legacy pre-Phase-0 endpoint (which subtracted
SUM(llm_usage_log.total_tokens)), this reads exclusively from
the ledger:
credits_purchased = SUM(amount) over positive rows (grants,
purchases, gamble, dispute wins, migration credits).credits_used = ABS(SUM(amount)) over negative rows
(reservations, deductions, refunds, dispute holds).credits_remaining = net balance.All values are USD microcents (1e-6 USD). See currency field.
Successful Response
Balance, computed entirely from the token_credits ledger.
Phase 2+ (OpenRouter-style billing) stores amounts as USD microcents (1e-6 USD). The legacy token-denominated balance (pre-Phase-0) is rolled forward via a one-time backfill migration.
Clients should read currency to disambiguate — the field name
credits_* is kept for back-compat on the wire, but the unit
changed from tokens to microcents.
Sum of positive ledger rows.
Absolute sum of negative ledger rows.
Net balance (sum of all rows).
Units of the credit counters. USD_microcents = 1e-6 USD (post-Phase-2). Clients SHOULD branch on this field rather than assuming tokens.