ai_images or tokens) has a wallet per customer. Usage events draw the wallet down as they arrive.
Concepts
- Credit type: what the credits are for, with a name, a unit label, and an
overagerule.blockstops usage when the balance reaches zero.allowlets usage continue and bills the overage. - Grant: credits given to a customer for free, as a promotion, or as part of a plan. Grants can expire.
- Purchase: credits the customer buys. They are paid for by the card on file, or by an emailed invoice.
- Auto top-up: buy more credits automatically when the balance falls to a threshold.
Grant credits
source is grant, promotional, or purchase. Reusing an idempotencyKey grants the credits once.
Sell a credit pack
collection is charge (the card on file, the default) or send_invoice (the customer pays an emailed invoice). If you omit unitPrice, the credit type’s price is used. A purchase starts as pending_payment and becomes active once paid.
Configure auto top-up
threshold, Orvlin buys credits against the card on file. maxPerMonth (default 5) caps the number of top-ups per calendar month.
Check a balance before work
Use the SDK’scheckCredits to confirm a customer can pay for an action:
track() is drawn from the wallet as it arrives.
Read balances and history
GET /v1/customers/:id/wallets: balances for every credit type.GET /v1/customers/:id/wallets/:type/ledger: every grant, purchase, and draw-down.