Reduce Claude Code Costs with ccusage (2026)
Your Claude Code bill is higher than expected. Here’s how to find where tokens are wasted and add rules that cut spend without reducing output quality.
The Problem
Common cost drivers:
- Long sessions that drift from the goal (goal drift → extra tool calls)
- Generating then reverting wrong implementations (assumption waste)
- Over-reading files for context that isn’t needed
- Generating overly verbose explanations between tool calls
- Re-reading the same files multiple times in a session
Root Cause
Claude Code doesn’t optimize for cost. It optimizes for helpfulness, which means reading broadly, explaining thoroughly, and generating complete solutions. Without constraints, this maximizes tokens consumed per task.
The Fix
1. Install ccusage for Visibility
npx ccusage session --limit 10
Identify your most expensive sessions. Look for:
- Sessions over $5 (usually contain a stuck loop or massive drift)
- Sessions where duration exceeds 1 hour (likely drift)
- Projects that consistently cost more than others
2. Add Cost-Conscious CLAUDE.md Rules
## Token Efficiency
- Read only the files you need. Don't scan entire directories "for context."
- Keep explanations brief — 1-2 sentences between tool calls, not paragraphs.
- If a task requires more than 15 tool calls, pause and ask if the approach is right.
- Don't regenerate code that was already written. If a small change is needed, edit the specific lines.
- When searching for code, use targeted grep patterns, not broad file reads.
3. Break Large Tasks
Instead of:
Rewrite the entire authentication system
Use:
Phase 1: Replace bcrypt with argon2 in the password service only
Smaller tasks = fewer tool calls = less spend.
CLAUDE.md Rule to Add
## Cost Guard
- Maximum 20 tool calls per task. If you reach 20, summarize progress and ask how to proceed.
- Prefer editing specific lines over rewriting entire files.
- Don't read files larger than 500 lines in full — read targeted line ranges.
- Avoid re-reading files already in context.
Verification
Run npx ccusage session before and after adding rules. Compare:
- Average cost per session
- Average tool calls per session
- Frequency of sessions over $5
Expect a 20-40% reduction in per-session cost with these rules active.
| Related: ccusage Cost Tracking Guide | Claude Code Best Practices | The Claude Code Playbook |
- Claude API pricing — every plan and model priced
- Claude extra usage cost — what overages actually cost
- Claude 5-hour usage limit — understand the rolling limit
- OpenRouter setup for Claude Code — alternative pricing via OpenRouter
- Claude Pro subscription price — when Pro saves money
See Also
Frequently Asked Questions
Do I need a paid Anthropic plan to use this?
Claude Code works with any Anthropic API plan, including the free tier. However, the free tier has lower rate limits (requests per minute and tokens per minute) that may slow down multi-step workflows. For professional use, the Build or Scale plan provides higher limits and priority access during peak hours.
How does this affect token usage and cost?
The token cost depends on the size of your prompts and Claude’s responses. Typical development tasks consume 10K-50K tokens per interaction. Using a CLAUDE.md file and skills reduces exploration tokens by 50-80%, which directly lowers costs. Monitor your usage at console.anthropic.com/settings/billing.
Can I customize this for my specific project?
Yes. All Claude Code behavior can be customized through CLAUDE.md (project rules), .claude/settings.json (permissions), and .claude/skills/ (domain knowledge). The most impactful customization is adding your project’s specific patterns, conventions, and common commands to CLAUDE.md so Claude Code follows your standards from the start.
What happens when Claude Code makes a mistake?
Claude Code creates files and edits through standard filesystem operations, so all changes are visible in git diff. If a change is wrong, revert it with git checkout -- <file> for a single file or git stash for all changes. Claude Code does not make irreversible changes unless you explicitly allow destructive commands in settings.json.
Build yours → Create a custom CLAUDE.md with our Generator Tool.
Related Guides
Estimate tokens → Calculate your usage with our Token Estimator.
Try it: Estimate your monthly spend with our Cost Calculator.