Credits are the usage meter across your apps. Payments top them up, and app routes check balances before expensive actions run. Simple as that.
Where You’ll See Credits
Credits show up in several places:- The dashboard sidebar
- The account center
- Purchase flows
- API routes for paid generation features
How Credits Work
Users start with a default balance
When a new user signs up, they get a starting credit balance from the database setup. Enough to explore the app.
Actions consume credits
AI generation features check the user’s balance before running. If they have enough, credits are deducted. If not, they’re prompted to buy more.
Failed generations can refund
If a generation fails, the app can refund the credits so users aren’t charged for nothing.
Credit Packs
The repo ships with two default packs:| Pack | Credits |
|---|---|
credits-small | 50 credits |
credits-large | 100 credits |
lib/payments/types.ts. Display metadata (labels, prices, descriptions) lives in lib/payments/public-config.ts.
The Billing Flow
Verify It Works
Your billing setup is working if:
- Checkout completes successfully
- The purchase appears in the database
- The credits number updates in the UI

