Budget Management
Chucky provides granular budget controls to help you manage costs and prevent unexpected charges.Budget Types
AI Budget
Controls spending on Claude API calls:- Measured in dollars (or microdollars in the raw API)
- Covers input tokens, output tokens, and cache usage
- Resets based on the window period
Compute Budget
Controls sandbox execution time:- Measured in seconds (or hours in the helper)
- Covers time the sandbox is running
- Useful for preventing runaway processes
Setting Budgets
Using the Helper
Raw Format
Budget Windows
| Window | Duration | Use Case |
|---|---|---|
hour | 60 minutes | Rate limiting, trial users |
day | 24 hours | Daily quotas |
week | 7 days | Weekly allowances |
month | Calendar month | Subscription billing |
Window Start
The window starts at thewindowStart time in the token:
Budget Enforcement
Per-User Limits
Each user gets their own budget based on their token:Session Budget Limits
Additionally limit individual sessions:Cost Tracking
In Results
Usage Details
Budget Exceeded Handling
When a user exceeds their budget:Pricing Guide
Approximate costs (check Anthropic pricing for current rates):| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| claude-sonnet-4-5 | $3.00 | $15.00 |
| claude-opus-4-5 | $15.00 | $75.00 |
| claude-3-5-haiku | $0.25 | $1.25 |
Cost Estimation
Budget Strategies
Tiered Access
Pay-as-you-go
For users with payment methods, allow higher limits:Cost Alerts
Best Practices
Start conservative
Start conservative
Begin with small budgets and increase based on actual usage patterns. It’s easier to increase limits than to deal with unexpected charges.
Use session limits
Use session limits
Even with generous user budgets, set session limits to prevent single queries from consuming all resources.
Monitor usage
Monitor usage
Track usage patterns to optimize your pricing tiers and identify cost outliers.
Graceful degradation
Graceful degradation
When budgets are near limits, offer alternatives rather than hard failures: