Skip to main content

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 Start

The window starts at the windowStart 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):

Cost Estimation

Budget Strategies

Tiered Access

Pay-as-you-go

For users with payment methods, allow higher limits:

Cost Alerts

Best Practices

Begin with small budgets and increase based on actual usage patterns. It’s easier to increase limits than to deal with unexpected charges.
Even with generous user budgets, set session limits to prevent single queries from consuming all resources.
Track usage patterns to optimize your pricing tiers and identify cost outliers.
When budgets are near limits, offer alternatives rather than hard failures: