Docs / Core Concepts
Core Concepts
Understand the building blocks behind Chargly's credit-first AI billing model.
Credits
Credits are the unit users buy and spend. They hide raw token economics and let developers price AI actions clearly.
Wallets
Each customer has a wallet balance. Top-ups and grants add credits; metered usage deducts them.
Usage Events
AI actions are usage events: chat.reply, image.generate, ai.summary, agent.run. Each deducts a defined number of credits via meterEvent.
Example mappings
Pricing rules & recommendations
Credit costs per event are defined by pricing rules. Chargly's Pricing Advisor evaluates provider cost, margin targets, and usage to suggest rule changes. Recommendations are deterministic, explainable, and versioned. When you apply one, a new immutable pricing rule version is created — no silent overwrites.
Deductions
When an event is recorded, Chargly deducts credits and updates the balance in real time.
Top-ups
Users buy credits through Stripe. Successful purchases add credits to the wallet. Balances become immediately usable.
Mental model
The Chargly loop:
Example flow