Billing & Payments
AIUS bills usage in AIUS tokens. Stripe handles payment processing (subscriptions, top-ups, the customer portal, invoices); the token balance and its per-org allocation are owned by the accounts backend.AIUS tokens — the unit
The user-facing currency is AIUS tokens, never dollars-of-usage or provider cost.- **Grants are at par: 200/mo) grants 210,000 tokens per month (a deliberate bonus over the 200,000 you’d get at par).
- Usage debits tokens at a spend rate that hides the platform margin: a call
costing
cost_centsof real compute debitsround(cost_cents * 1000 / 90)tokens. You never see dollars-of-usage or the margin — only a token balance going down.
For backward compatibility some balance responses still carry legacy
*_usd and
monthly_quota_* fields. They are vestigial — the meaningful unit is the
AIUS-token field (balance_credits). Read tokens, ignore the dollar/quota
fields.Owner-held, allocatable balance (ADR-0060)
The token balance belongs to the account owner (theUser), not to one
organization. The owner allocates their balance across the orgs (clients)
they created:
402 even while the owner still holds
unallocated tokens — the owner re-allocates to refill it. The conservation
invariant (Σ org allocations ≤ global) reduces to unallocated ≥ 0, enforced
hard-atomically at allocation time.
Get the owner balance
200:
global_credits is derived (unallocated_credits + Σ of the owner’s live
orgs’ allocations) — never a stored mutable counter.
Set an org’s allocation
Set an org’s allocation to an absolute token amount (this covers both funding an org and reclaiming from it). Only the org’s owner may allocate — a plain member cannot.200: the updated owner balance (same shape as
GET /v1/owner/balance).
Raising an allocation beyond the unallocated pool returns 402
INSUFFICIENT_UNALLOCATED. Allocating to an org you don’t own returns
403 NO_ACCESS.
Subscriptions
Create a subscription checkout
Create a Stripe checkout session for a subscription (e.g. Pro).200:
Get the subscription
200:
Top-ups
Create a token top-up
Buy more tokens at par ($1 = 1,000 tokens) via Stripe checkout.amount_usd is in cents (so 1000 = $10 → 10,000 tokens at par).
Response 200:
Balance & transactions
Get the token balance
200:
balance_credits is this org’s current AIUS-token balance; allocation_credits
is the budget the owner last allocated to it (the dashboard’s progress bar scales
against this, draining as the org spends).
List transactions
200:
trial (free-trial grant), subscription_credit (a
subscription period’s grant), topup (purchased tokens), usage (tokens
consumed by a run), refund.
Billing portal
Open Stripe’s self-service customer portal.{ "return_url": "https://aius.co/account/clients/{client_id}/billing" }
Response 200: { "portal_url": "https://billing.stripe.com/..." }
Payment methods
200:
Invoices
200:
Webhooks
Stripe webhooks keep billing in sync (token grants are applied here, to the owner pool):checkout.session.completed— processes a successful payment (top-up or subscription start); credits tokens.invoice.paid— syncs a paid invoice; a Pro renewal grants the period’s 210,000 tokens.invoice.payment_failed— handles a failed payment.customer.subscription.created/updated/deleted— syncs subscription state.
Error handling
Billing endpoints return the standard error envelope:INSUFFICIENT_UNALLOCATED— allocation exceeds the owner’s unallocated pool.NO_ACCESS— you don’t own the org you tried to allocate to.insufficient_credits/402— an org’s allocation is exhausted; re-allocate or top up.payment_failed— Stripe payment processing error.subscription_not_found— no active subscription for the client.