Overview
ZapDev uses a credit-based system to track AI code generation usage. Each generation consumes credits from your daily allowance, which resets on a 24-hour rolling window.Credit Allocation
Credits are allocated based on your subscription plan:- Free Plan: 5 credits per 24-hour period
- Pro Plan: 100 credits per 24-hour period
- Unlimited Plan: Effectively unlimited credits (9,007,199,254,740,991)
Generation Cost
Each AI code generation request costs exactly 1 credit:- Framework choice (Next.js, Angular, React, Vue, Svelte)
- Complexity of the request
- Size of generated code
- Number of files created
Credit Reset Window
Credits reset on a 24-hour rolling window, not at midnight:- A 24-hour timer starts
- Your credits decrease with each generation
- After 24 hours, your full credit allocation is restored
- The timer resets and a new 24-hour period begins
The rolling window means if you use your first credit at 2:00 PM on Monday, your credits will reset at 2:00 PM on Tuesday, not at midnight.
How Credits Are Consumed
When you request a code generation:1. Credit Check
The system checks if you have sufficient credits:2. Credit Consumption
If you have credits available, one credit is consumed:3. Response
You receive confirmation with remaining credits:Usage Tracking
The system maintains ausage record for each user:
Viewing Your Usage
You can query your current usage stats:Credit Expiration
Credits expire and reset based on your usage pattern:First Usage or Expired Credits
When you haven’t used credits yet, or your 24-hour window has expired:Active Usage Window
While within your 24-hour window:- Credits decrease with each generation
- Expiration time remains the same
- No credits are added back until window expires
Plan-Based Behavior
Free and Pro Plans
- Credits are strictly enforced
- Generations fail when credits are exhausted
- Must wait for 24-hour reset
Unlimited Plan
- Credit checks are bypassed (
isUnlimitedflag) - Infinite credit pool
- No waiting periods
- Still tracks usage for analytics
Usage Data Storage
Credits are stored in the Convexusage table with indexes:
Admin Functions
Administrators can reset usage for any user:Resetting usage immediately restores full credits and starts a new 24-hour window.
Best Practices
Monitor Your Credits
Check your remaining credits before starting large projects:Plan Your Generations
Free plan users should:- Plan complex features carefully to use credits efficiently
- Consider upgrading to Pro for larger projects
- Wait for credit reset if needed
Upgrade When Needed
If you frequently hit credit limits:- Pro plan provides 20x more credits (100 vs 5)
- Unlimited plan removes all restrictions
- Upgrade takes effect immediately
Next Steps
Subscription Plans
Compare plans and upgrade your subscription
Rate Limits
Learn about API rate limiting