Cost Management
Claude Code charges by API token consumption. Here’s how to track, manage, and reduce your costs.
Typical Costs (Enterprise Reference)
Section titled “Typical Costs (Enterprise Reference)”- Average: ~$13 per developer per active day
- Monthly: $150–250 per developer
- 90th percentile: under $30 per active day
These vary widely based on model choice, codebase size, and how many parallel sessions you run.
Track Your Costs
Section titled “Track Your Costs”/usage command
Section titled “/usage command”/usageShows:
- Token usage for current session
- Dollar estimate (computed locally — check Claude Console for authoritative billing)
- On Pro/Max/Team/Enterprise: breakdown by skills, subagents, MCP servers
- Press
dfor last 24h,wfor last 7 days
Status line (continuous)
Section titled “Status line (continuous)”Configure your status line to show context window usage at all times. See Keyboard Shortcuts & Status Line.
Claude Console (authoritative)
Section titled “Claude Console (authoritative)”For authoritative billing: https://platform.claude.com/usage
For Teams (API users)
Section titled “For Teams (API users)”Set workspace spend limits at: https://platform.claude.com/workspaces
Rate Limit Recommendations for Teams
Section titled “Rate Limit Recommendations for Teams”| Team size | TPM per user | RPM per user |
|---|---|---|
| 1–5 | 200k–300k | 5–7 |
| 5–20 | 100k–150k | 2.5–3.5 |
| 20–50 | 50k–75k | 1.25–1.75 |
| 50–100 | 25k–35k | 0.62–0.87 |
| 100–500 | 15k–20k | 0.37–0.47 |
| 500+ | 10k–15k | 0.25–0.35 |
TPM per user decreases with team size because fewer users use Claude concurrently in larger orgs.
Reduce Token Usage
Section titled “Reduce Token Usage”1. Clear Between Tasks
Section titled “1. Clear Between Tasks”/clearStart fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message.
Before clearing, rename the session so you can resume later:
/rename auth-module-debugging/clear# ... later .../resume auth-module-debuggingCustom compaction instructions:
/compact Focus on code samples and API usageOr in CLAUDE.md:
# Compact instructionsWhen compacting, preserve test output and code changes.2. Choose the Right Model
Section titled “2. Choose the Right Model”| Model | Best for |
|---|---|
| Haiku | Simple subagent tasks, lookups, fast checks |
| Sonnet | Most coding tasks — best cost/quality balance |
| Opus | Complex architectural decisions, multi-step reasoning |
Switch mid-session: /model
Set default: /config
For subagents: add model: haiku in the subagent frontmatter
3. Reduce MCP Server Overhead
Section titled “3. Reduce MCP Server Overhead”MCP tool definitions are deferred by default (only names in context until used). But unused servers still add overhead.
/mcp # See configured servers/context # See what's consuming context spacePrefer CLI tools when available (gh, aws, gcloud, sentry-cli) — they don’t add any context overhead vs MCP servers.
4. Move Workflow Instructions to Skills
Section titled “4. Move Workflow Instructions to Skills”Problem: CLAUDE.md is loaded into context at session start — even when you’re doing unrelated work.
Solution: Move specialized instructions (PR review checklists, deploy steps, migration patterns) into skills — they only load when invoked.
Rule of thumb: Keep CLAUDE.md under 200 lines. Only put always-needed context there.
5. Use Hooks to Preprocess Data
Section titled “5. Use Hooks to Preprocess Data”Instead of Claude reading a 10,000-line log file, a hook can grep for ERROR and pass only matching lines:
{ "hooks": { "PreToolUse": [{ "matcher": "Bash", "hooks": [{"type": "command", "command": "~/.claude/hooks/filter-test-output.sh"}] }] }}#!/bin/bashinput=$(cat)cmd=$(echo "$input" | jq -r '.tool_input.command')
if [[ "$cmd" =~ ^(npm test|pytest|go test) ]]; then filtered_cmd="$cmd 2>&1 | grep -A 5 -E '(FAIL|ERROR|error:)' | head -100" echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"updatedInput\":{\"command\":\"$filtered_cmd\"}}}"else echo "{}"fi6. Delegate Verbose Operations to Subagents
Section titled “6. Delegate Verbose Operations to Subagents”Running tests, fetching docs, or processing logs generates verbose output. Delegate these to subagents — the verbose output stays in the subagent’s context, and only a summary returns.
7. Write Specific Prompts
Section titled “7. Write Specific Prompts”- Vague: “improve this codebase” → broad scanning, many file reads
- Specific: “add input validation to the login function in auth.ts” → minimal file reads
8. Use Plan Mode for Complex Tasks
Section titled “8. Use Plan Mode for Complex Tasks”Press Shift+Tab to enter plan mode. Claude explores first and proposes an approach for your approval — preventing expensive re-work when the initial direction is wrong.
9. Course-Correct Early
Section titled “9. Course-Correct Early”If Claude starts going in the wrong direction:
- Press Escape to stop immediately
- Press Escape twice (or
/rewind) to restore to a previous checkpoint - Redirect before Claude does more work in the wrong direction
10. Adjust Extended Thinking
Section titled “10. Adjust Extended Thinking”Extended thinking improves quality but costs more (thinking tokens billed as output tokens).
For simpler tasks:
/effort low # Reduce thinking effort/model # Disable thinking in model settingsOr set environment variable: MAX_THINKING_TOKENS=8000
Note: Fable 5 always uses extended thinking — can’t be disabled.
11. Agent Team Cost Control
Section titled “11. Agent Team Cost Control”Agent teams use ~7x more tokens than standard sessions (each teammate has its own context window).
Tips:
- Use Sonnet for teammates (not Opus)
- Keep teams small
- Keep spawn prompts focused (CLAUDE.md + MCP load automatically — don’t duplicate in prompts)
- Shut down teammates when their work is done
Enable agent teams: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
Background Token Usage
Section titled “Background Token Usage”Even when idle, Claude Code uses a small amount of tokens:
- Conversation summarization for
/resume - Some command processing (
/usage, etc.)
Typical background cost: under $0.04 per session — minimal.
How Prompt Caching Reduces Costs
Section titled “How Prompt Caching Reduces Costs”Claude Code automatically uses prompt caching to reduce costs for repeated content:
- System prompts
- CLAUDE.md files
- Tool definitions
- Conversation history that hasn’t changed
You don’t need to do anything — it’s automatic. See how prompt caching works.
🧠 Quick Recall
Section titled “🧠 Quick Recall”- Trick: the four levers — “cache, model mix, delegation, lean CLAUDE.md.”
👨🏫 Teach It
Section titled “👨🏫 Teach It”- Show:
/usageplus a statusline with cache counters. - They’ll trip on: blaming the model for cost when the cache prefix is churning (see file 54).
Learning path: ⬅ 40-agent-sdk.md · Index · ➡ 42-large-codebases.md
Written by Fenil Patel