Never get surprised by your Claude bill again. Token + cost tracker with hard limits, alerts, and per-project budgets.
npm i -g claude-budget
claude-budget initYou hand Claude Code a big refactor. You step away. You come back to a $73 bill for one afternoon, because Claude looped on a hard problem 200 times.
claude-budget prevents this. It tracks every token, every dollar, in real-time โ and stops Claude when you hit your limit.
# Install
npm i -g claude-budget
# Initialize for current project
claude-budget init
# Set a budget
claude-budget set --daily 5.00 --monthly 100.00 --per-session 2.00That's it. The hook is automatically wired into your Claude Code settings.
Every time Claude completes a tool call, the hook:
- Reads the token count from the response
- Multiplies by the model's per-token cost
- Adds to running totals (session / day / month / project)
- Aborts the session if any limit is exceeded
- Sends an alert at 80% of any limit
$ claude-budget status
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ Claude Code Spend โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ This session: $0.42 / $2.00 (21%) โโโโโ โ
โ Today: $3.18 / $5.00 (64%) โโโโโ โ
โ This month: $47.20 / $100 (47%) โโโโโ โ
โ This project: $19.40 / $50.00 (39%) โโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ By model: โ
โ claude-opus-4-7: $2.10 โ
โ claude-sonnet-4-6: $0.85 โ
โ claude-haiku-4: $0.23 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏHook into Slack/Discord/Telegram/Email:
# ~/.claude-budget/config.yaml
alerts:
- threshold: 80%
channels: [slack]
- threshold: 95%
channels: [slack, email]
- on_hard_stop:
channels: [slack, email, sms]
channels:
slack:
webhook: ${SLACK_WEBHOOK_URL}
email:
to: you@example.com
telegram:
bot_token: ${TELEGRAM_BOT_TOKEN}
chat_id: ${TELEGRAM_CHAT_ID}When a limit is hit, the hook sends a "REFUSE" signal back to Claude Code, which:
- Prevents the next tool call
- Shows you a clear message
- Logs the stop event
- Leaves the project in a clean state (no half-applied edits)
You can override:
claude-budget override --session # Allow this session to exceed
claude-budget override --until tomorrow# Daily summary
claude-budget report --period today
# Detailed breakdown
claude-budget report --since 7d --by project,model
# CSV export
claude-budget report --csv > spend.csv
# Most expensive sessions
claude-budget report --top 10 --sort costFor organizations:
claude-budget team init --org acme-corp
# - Centralizes budgets across all team members
# - Per-user limits
# - Per-project budgets
# - Admin dashboardAdmin dashboard runs at claude-budget dashboard:
Team: acme-corp
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total this month: $1,847 / $5,000
Top spenders:
1. alice@acme.com $412 / $500 โ
2. bob@acme.com $389 / $500 โ
3. carol@acme.com $521 / $500 โ OVER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The CLI ships with up-to-date Anthropic pricing for all current models. Updates automatically every 24h from the official Anthropic API pricing endpoint.
If you use a custom proxy, set:
pricing_override:
claude-opus-4-7:
input_per_million: 15.00
output_per_million: 75.00Pair this with claude-code-prompts's model-selector hook to auto-downgrade trivial tasks to Haiku โ you'll cut your bill by 40-60% with no quality loss on the easy stuff.
MIT.
Star โญ before your next AI bill surprises you.