Skip to content

Latest commit

 

History

History
425 lines (337 loc) · 30.3 KB

File metadata and controls

425 lines (337 loc) · 30.3 KB

Claude Code Cost Optimization Cheatsheet

One-page quick reference. Print it, bookmark it, pin it. Every strategy links to a detailed guide.

Pricing verified: 2026-07-25. Sources: platform pricing, models overview, model deprecations, migrating to Opus 5, fast mode, prompt caching, introducing Fable 5 / Mythos 5.


Token Pricing At a Glance

Model Input / 1M tokens Output / 1M tokens Cache Hit / 1M 5m Cache Write 1h Cache Write Context Max Output Min cache Relative Cost
Fable 5 (highest capability) $10.00 $50.00 $1.00 $12.50 $20.00 1M 128K 512 2x baseline
Mythos 5 (limited, Glasswing) $10.00 $50.00 $1.00 $12.50 $20.00 1M 128K 512 2x baseline
Opus 5 (Opus flagship) $5.00 $25.00 $0.50 $6.25 $10.00 1M 128K 512 1x (baseline)
Opus 4.8 (legacy) $5.00 $25.00 $0.50 $6.25 $10.00 1M 128K 1,024 1x (baseline)
Opus 4.7 $5.00 $25.00 $0.50 $6.25 $10.00 1M 128K 2,048 1x (baseline)
Opus 4.6 $5.00 $25.00 $0.50 $6.25 $10.00 1M 128K 4,096 1x (baseline)
Opus 4.5 $5.00 $25.00 $0.50 $6.25 $10.00 200K 64K 4,096 1x (baseline)
Opus 4.1 $15.00 $75.00 $1.50 $18.75 $30.00 200K 32K 1,024 3x baseline
Sonnet 5 (Sonnet flagship) $3.00 $15.00 $0.30 $3.75 $6.00 1M 128K 1,024 ~1.7x cheaper
Sonnet 4.6 $3.00 $15.00 $0.30 $3.75 $6.00 1M 64K 1,024 ~1.7x cheaper
Sonnet 4.5 $3.00 $15.00 $0.30 $3.75 $6.00 200K 64K 1,024 ~1.7x cheaper
Haiku 4.5 $1.00 $5.00 $0.10 $1.25 $2.00 200K 64K 4,096 5x cheaper
Opus 5 / 4.8 (Fast Mode) $10.00 (2x) $50.00 (2x) N/A -- -- 1M 128K -- 2x baseline
Mythos Preview (retired 2026-06-30) $25.00 $125.00 $2.50 $31.25 $50.00 1M -- 2,048 5x baseline output

Output tokens cost 5x more than input tokens across all current models. Reducing Claude's verbosity is high-leverage.

1M context on Opus 5 / 4.8 / 4.7 / 4.6 / Sonnet 5 / Sonnet 4.6 is at standard rates -- no long-context premium. (Earlier "2x over 200K" pricing is obsolete.) Haiku 4.5, Sonnet 4.5, Opus 4.5, and Opus 4.1 are 200K-context only. Sonnet 5 (claude-sonnet-5) has introductory pricing of $2/$10 through 2026-08-31, then standard $3/$15.

Cache pricing math: 5m write = 1.25x base input; 1h write = 2x base input; cache hit/refresh = 0.1x base input. So a 5m cache pays off after 1 reuse, a 1h cache after 2 reuses. Multipliers stack with Batch (50% off) and data residency (+10%).

Min cache column = minimum cacheable prompt length. Below it, a cache_control block does nothing -- no error, no discount, full input price every turn. Opus 5 halves Opus 4.8's threshold (1,024 -> 512), so prompts that never cached on 4.8 start caching for free on 5. Haiku 4.5 / Opus 4.6 / Opus 4.5 need 4,096 tokens before caching does anything at all.

Opus 5 / 4.8 / 4.7 tokenizer: The tokenizer introduced with Opus 4.7 uses up to 35% more tokens for the same text. Effective per-task cost is higher than posted pricing implies. Budget accordingly when comparing 5 / 4.8 / 4.7 to 4.6 / Sonnet 4.6.

Opus 5 (GA 2026-07-24): the Opus-tier flagship and Anthropic's recommended default for complex agentic coding. $5/$25 -- identical to Opus 4.8, so the upgrade is free at the posted rate, but three behaviors change your bill: (1) adaptive thinking is ON by default when you omit the thinking param, and reasoning tokens bill as output at $25/1M with max_tokens capping thinking plus text (raise it to 64K+ at xhigh/max); (2) thinking: {type:"disabled"} is legal only at effort high or below -- combining it with xhigh/max returns a 400; (3) min cacheable prompt is 512 tokens. Output also runs longer than 4.8 by default, so re-tune verbosity instructions, and drop any "verify your work" instruction you carried over (it self-verifies). Ships cybersecurity classifiers -- pair with the server-side fallbacks param (beta server-side-fallback-2026-07-01) to auto-retry cyber refusals on Opus 4.8. Batch $2.50/$12.50. Knowledge cutoff May 2026. New beta mid-conversation-tool-changes-2026-07-01 lets tools change between turns without busting the cache.

Fable 5 (GA 2026-06-09): Anthropic's highest-capability model -- a Mythos-class tier above Opus at $10/$50 (2x Opus 5). Always-on adaptive thinking (no disabled; control depth with effort, low through xhigh/max). Safety classifiers may decline requests: HTTP 200 + stop_reason: "refusal"; pre-output refusals cost $0; the beta fallbacks param retries on another model server-side, and fallback credit refunds the cache-switch cost. No Fast Mode; Batch supported ($5/$25). Requires 30-day data retention. Cost note: for cost-sensitive work, Opus 5 at half the rate is the sweet spot -- reach for Fable 5 when the task genuinely needs the extra capability (hardest reasoning, longest agentic runs).

Mythos 5: same model, specs, and price as Fable 5 but without safety classifiers. Limited availability via Project Glasswing only. Successor to Mythos Preview (retired 2026-06-30).

Opus 4.8 status: moved to legacy by the Opus 5 launch. Same $5/$25 price, so there is no cost reason to stay -- migrate unless your prompts are tuned to this snapshot or you need thinking off at xhigh/max (which Opus 5 rejects). Still the server-side fallback target for Opus 5 cyber refusals. Earliest retirement 2027-05-28.

Fast Mode (research preview): Opus 5 and Opus 4.8 only, via the fast-mode-2026-02-01 beta header (speed: "fast"). Both at 2x ($10 / $50 per MTok). Up to 2.5x output tokens/second -- the gain is on OTPS, not time-to-first-token. Opus 4.7 now errors on speed: "fast" with no fallback; Opus 4.6 silently runs standard speed at standard rates (usage.speed returns "standard"). The old 6x Opus 4.7 / 4.6 Fast Mode tier no longer exists. Claude API + Managed Agents only: NOT on Claude Platform on AWS, Bedrock, Vertex AI, Microsoft Foundry, Batch API, or Priority Tier. Switching speeds invalidates prompt cache. Dedicated rate limits via anthropic-fast-* response headers. Join the waitlist.

Subscriptions: Pro $20/mo (or $200/yr ≈ $16.67/mo, ~17% off). Max 5x $100/mo. Max 20x $200/mo. Batch API: 50% off both input and output. Regional endpoints (Bedrock / Vertex AI / Claude API inference_geo: "us", scope = Sonnet 4.5+, Haiku 4.5+, Opus 4.5+, and all future models): +10% premium.

Thinking Modes by Model

Model Extended thinking Adaptive thinking Default state
Fable 5 No Yes (always on) On, cannot disable
Mythos 5 No Yes (always on) On, cannot disable
Opus 5 No Yes On by default
Opus 4.8 No Yes Off unless requested
Opus 4.7 No Yes Off unless requested
Opus 4.6 Yes Yes Off unless requested
Opus 4.5 Yes -- Off unless requested
Sonnet 5 No Yes Off unless requested
Sonnet 4.6 Yes Yes Off unless requested
Sonnet 4.5 Yes -- Off unless requested
Haiku 4.5 Yes No Off unless requested

Extended thinking adds explicit reasoning tokens you pay for as output. Adaptive thinking lets the model decide when and how much to think based on task difficulty -- no separate billing flag. Opus 4.7 replaced extended thinking with adaptive thinking + the xhigh effort level; Opus 4.8 keeps the same surface and defaults effort to high.

Opus 5 flips the default: omit the thinking param and it thinks adaptively, billing those tokens as output at $25/1M. max_tokens caps thinking plus text, so a value carried over from 4.8 can be consumed by thinking before the answer starts -- budget 64K+ if you run xhigh/max. To turn it off, send thinking: {type: "disabled"}, but only at effort high or below: pairing disabled with xhigh or max returns a 400.

On Fable 5 / Mythos 5 thinking is always on -- omit the thinking param (an explicit disabled returns a 400) and control depth purely with effort.

Model Lifecycle (verified 2026-07-25)

Recently retired (requests will fail):

Model Retired on Migrate to
Opus 3 (claude-3-opus-20240229) 2026-01-05 Opus 5
Sonnet 3.7 (claude-3-7-sonnet-20250219) 2026-02-19 Sonnet 5
Haiku 3.5 (claude-3-5-haiku-20241022) 2026-02-19 (still on Bedrock + Vertex AI) Haiku 4.5
Haiku 3 (claude-3-haiku-20240307) 2026-04-20 Haiku 4.5
Sonnet 4 (claude-sonnet-4-20250514) 2026-06-15 Sonnet 5
Opus 4 (claude-opus-4-20250514) 2026-06-15 Opus 5
Mythos Preview (claude-mythos-preview) 2026-06-30 Mythos 5 (Glasswing)

Upcoming retirements:

Model Retirement date Migration target
Opus 4.1 (claude-opus-4-1-20250805) August 5, 2026 Opus 5
Sonnet 4.5 (claude-sonnet-4-5-20250929) Not before 2026-09-29 Sonnet 5
Haiku 4.5 (claude-haiku-4-5-20251001) Not before 2026-10-15 (current)
Opus 4.5 (claude-opus-4-5-20251101) Not before 2026-11-24 Opus 5
Opus 4.6 (claude-opus-4-6) Not before 2027-02-05 Opus 5
Sonnet 4.6 (claude-sonnet-4-6) Not before 2027-02-17 Sonnet 5
Opus 4.7 (claude-opus-4-7) Not before 2027-04-16 Opus 5
Opus 4.8 (claude-opus-4-8) Not before 2027-05-28 Opus 5
Fable 5 (claude-fable-5) Not before 2027-06-09 (current)
Sonnet 5 (claude-sonnet-5) Not before 2027-06-30 (current)
Opus 5 (claude-opus-5) Not before 2027-07-24 (current)

Opus 4.1 is the only near-term forced migration left -- it retires August 5, 2026 (about 11 days out) and costs 3x current Opus rates until then. Everything else on this list is a year or more away.

Off-Peak 2x Usage: Anthropic periodically runs promotional events that double usage limits outside peak hours (typically 8 AM - 2 PM ET) and on all weekends. If you're outside the US, your entire workday likely falls in the 2x window. Watch the Anthropic blog for announcements.

CLI Cost Controls: --max-budget-usd <amount> caps spending per session. --fallback-model <model> auto-switches to a cheaper model when the primary is overloaded.


Legacy & Retired Models (reference only)

Migration context for code still pinned to older model IDs. Do not use these for new work -- prices, IDs, and capabilities are kept here for archive value only.

Recently retired (requests now fail)

Model Retired on Last priced at (input / output per 1M) Migrate to
Claude Opus 3 (claude-3-opus-20240229) 2026-01-05 $15 / $75 Opus 5
Claude Sonnet 3.7 (claude-3-7-sonnet-20250219) 2026-02-19 $3 / $15 Sonnet 5
Claude Haiku 3.5 (claude-3-5-haiku-20241022) 2026-02-19 (still on Bedrock + Vertex AI) $0.80 / $4 Haiku 4.5
Claude Haiku 3 (claude-3-haiku-20240307) 2026-04-20 $0.25 / $1.25 Haiku 4.5
Claude Sonnet 4 (claude-sonnet-4-20250514) 2026-06-15 $3 / $15 Sonnet 5
Claude Opus 4 (claude-opus-4-20250514) 2026-06-15 $15 / $75 Opus 5
Claude Mythos Preview (claude-mythos-preview) 2026-06-30 $25 / $125 Mythos 5 (Glasswing)
Claude Sonnet 3.5 v1 (claude-3-5-sonnet-20240620) 2025-10-28 $3 / $15 Sonnet 5
Claude Sonnet 3.5 v2 (claude-3-5-sonnet-20241022) 2025-10-28 $3 / $15 Sonnet 5
Claude Sonnet 3 (claude-3-sonnet-20240229) 2025-07-21 $3 / $15 Sonnet 5
Claude 2 / 2.1 (claude-2.0, claude-2.1) 2025-07-21 $8 / $24 Opus 5
Claude Instant 1.x 2024-11-06 $0.80 / $2.40 Haiku 4.5
Claude 1.x 2024-11-06 $8 / $24 Haiku 4.5

Deprecated (still working, retiring soon)

Model Deprecated on Retirement date Last priced at (input / output per 1M) Migrate to
Claude Opus 4.1 (claude-opus-4-1-20250805) 2026-06-05 2026-08-05 $15 / $75 Opus 5

Historical pricing patterns (no longer in effect)

The following pricing constructs were real but have since been retired or restructured. Listed here for migration context if you're reading older guides:

  • "2x input, 1.5x output above 200K" long-context premium -- applied to Opus 4.1 and older. Obsolete on Opus 5 / 4.8 / 4.7 / 4.6, Sonnet 5, and Sonnet 4.6, which bill 1M context at standard rates.
  • Opus 4.1 ($15/$75) -- original "Opus 4.x" pricing. Deprecated (retires 2026-08-05) and priced at 3x current Opus rates. Migrate to Opus 5 unless you have a specific compatibility need.
  • 6x Fast Mode on Opus 4.7 / 4.6 ($30/$150) -- removed at the Opus 5 launch. Opus 4.7 now errors on speed: "fast"; Opus 4.6 silently serves standard speed at standard rates. Fast Mode is Opus 5 / 4.8 only, both at 2x.
  • Bedrock-only ARN-versioned IDs like anthropic.claude-opus-4-20250514-v1:0 -- still resolve via the legacy InvokeModel/Converse path, but the new Mantle endpoint uses cleaner provider-prefixed IDs (anthropic.claude-opus-5).
  • Single endpoint type on Bedrock -- pre-Sonnet-4.5, all Bedrock traffic was effectively "global". The +10% regional premium is a 4.5+ generation construct.

Snapshots that are still active (not retired, but not the headline tier)

These models are GA and priced but generally not the recommended target for new work -- listed under "Legacy" because they're previous-generation snapshots:

Snapshot Pricing (input / output per 1M) Context Earliest retirement Why use
Opus 4.8 $5 / $25 1M 2027-05-28 Previous flagship -- same price as Opus 5. Pin only if prompts are tuned to it or you need thinking off at xhigh/max. Fallback target for Opus 5 cyber refusals
Opus 4.7 $5 / $25 1M 2027-04-16 Pinned workloads. Fast Mode removed (errors)
Opus 4.6 $5 / $25 1M 2027-02-05 Stable snapshot of the previous-tokenizer Opus. Fast Mode silently downgrades
Opus 4.5 $5 / $25 200K 2026-11-24 Pinned workloads only
Opus 4.1 $15 / $75 200K 2026-08-05 Compatibility only -- 3x more expensive, deprecated
Sonnet 4.6 $3 / $15 1M 2027-02-17 Pinned workloads -- migrate to Sonnet 5
Sonnet 4.5 $3 / $15 200K 2026-09-29 Pinned workloads only

Authoritative source for all dates: Anthropic model deprecations page.


All Strategies - Ranked by Impact

Tier 1: High Impact (Do These First)

# Strategy Savings Effort Explanation Guide
1 Use cheaper models for simple tasks 20-40% 1 min Run claude --model haiku for formatting, simple fixes, file lookups, and boilerplate - Haiku handles ~70% of routine work at 1/5th the cost of Opus Model Selection
2 Delegate work to subagents 20-40% 5 min Subagent tool calls get their own isolated context; large file searches and multi-file reads happen outside your main conversation, keeping your primary context small Workflow Patterns
3 Use Plan Mode before coding 15-25% 0 min Press Shift+Tab to toggle Plan Mode - Claude thinks through the approach before writing code, preventing expensive trial-and-error cycles that waste output tokens Workflow Patterns
4 Trim CLAUDE.md to under 4,000 characters 10-20% 15 min Every line loads as input tokens on every turn. Content beyond 4,000 chars/file is silently truncated. Total budget across all instruction files: 12,000 chars. Cut ruthlessly Context Optimization
5 Preserve prompt cache 10-25% 5 min Cached input tokens cost 90% less; keep CLAUDE.md and system context stable between turns - avoid editing CLAUDE.md mid-session, and keep conversation flow linear Understanding Costs

Tier 2: Medium Impact (Set Up Once)

# Strategy Savings Effort Explanation Guide
6 Configure .claudeignore 5-15% 2 min Prevent Claude from indexing node_modules/, dist/, .git/, lock files, and build artifacts - these add thousands of tokens when Claude searches your project Context Optimization
7 Use /compact regularly 10-20% 0 min Run /compact when conversation gets long (20+ turns) to summarize history and reset context window - prevents the exponential cost growth of long sessions Context Optimization
8 Set budget caps 0%* 1 min Use claude --max-budget-usd 5 or configure in settings to prevent runaway sessions - does not save tokens directly but prevents surprise bills Understanding Costs
9 Create custom slash commands 10-15% 10 min Define reusable commands in .claude/commands/ for repeated workflows - avoids re-explaining the same instructions across sessions, saving input tokens each time Workflow Patterns
10 Use batch operations 15-30% 5 min Group related changes into single prompts instead of one-at-a-time requests - "rename X in all 12 files" beats 12 individual "rename X in this file" turns Workflow Patterns

Tier 3: Ongoing Habits (Compound Over Time)

# Strategy Savings Effort Explanation Guide
11 Write concise prompts 5-10% Ongoing Be specific and direct - "Add null check to processOrder in src/orders.ts line 47" beats "Can you look at the orders file and maybe add some error handling?" Context Optimization
12 Avoid reading entire large files 5-15% Ongoing Point Claude to specific line ranges or functions instead of letting it Read a 2000-line file - use "read lines 100-150 of X" or reference functions by name Context Optimization
13 Start new sessions for new tasks 10-20% Ongoing Fresh sessions have minimal context; a 50-turn session carries all prior history as input - start clean when switching tasks to avoid paying for irrelevant context Understanding Costs
14 Use memory files over inline repeats 5-10% 5 min Put project conventions in CLAUDE.md once rather than repeating "use single quotes" or "always add tests" in every prompt - say it once, reference forever Context Optimization
15 Monitor with /usage Awareness 0 min Run /usage periodically to see token consumption in your current session - knowing where tokens go is the first step to reducing them Understanding Costs

Model Selection Quick Decision

Is the task...
├── Absolute hardest reasoning, longest agentic runs, budget allows 2x? → Fable 5
├── Complex architecture, long agentic run, or hardest coding?         → Opus 5
├── Standard feature work, code review, writing tests?                 → Sonnet 5
├── Simple fix, formatting, boilerplate, file lookup?                  → Haiku 4.5
└── Not sure?                                                          → Start with Sonnet 5

Switch models mid-session: Type /model and select, or start with claude --model sonnet.

Note: Opus 5 is priced at $5/$25 - the same as Opus 4.8 / 4.7 / 4.6, and the same price Sonnet used to be. The gap between models is smaller, so switching down to Haiku ($1/$5) provides a 5x savings, not 19x as it was historically. The Opus 4.7+ tokenizer can bump effective cost up to 35%, narrowing the gap further.

Watch thinking on Opus 5: it thinks by default, and reasoning tokens bill as output at $25/1M. For mechanical work where you would previously have used plain Opus 4.8, send thinking: {type: "disabled"} (effort high or below) or drop to Sonnet 5 instead of paying for reasoning you don't need.


Platform Comparison

Feature Anthropic API Claude Platform on AWS AWS Bedrock Google Vertex AI Claude Code
Standard pricing Base rates Same (CCU billing) Same (global) / +10% (regional) Same (global) / +10% (regional) Included in plan
Opus 5 availability GA GA GA (anthropic.claude-opus-5) GA Via /model
Sonnet 5 availability GA GA GA GA Via /model
Haiku 4.5 availability GA GA GA GA Via /model
1M context Yes (Opus 5/4.8/4.7/4.6, Sonnet 5/4.6) Yes Yes Yes Yes
Fast Mode (research preview) Yes (Opus 5 + 4.8, 2x) No No No (depends on plan)
Batch API (50% off) Yes No Yes Yes N/A
Prompt caching Yes Yes Yes Yes Automatic
Data-residency premium +10% (inference_geo: "us", 4.6+ models) +10% (inference_geo: "us") Bedrock regional pricing Vertex regional pricing --
Fable 5 availability GA GA GA GA Via /model (plan/API-key dependent)
Mythos 5 Glasswing only Glasswing only Glasswing only Glasswing only --

Bedrock / Vertex: Same models, same capabilities. Global (cross-region) inference matches API pricing. Regional inference profiles add ~10%. The +10% premium scope is Sonnet 4.5+, Haiku 4.5+, Opus 4.5+, and all future models; older models retain their existing pricing.

Opus 5 on Bedrock: Generally available via Claude in Amazon Bedrock (the Messages-API endpoint) with model ID anthropic.claude-opus-5. The legacy InvokeModel/Converse path with the us.anthropic.claude-opus-5 cross-region inference profile works for backward compatibility. Google Cloud uses claude-opus-5. (Fast Mode is Claude API + Managed Agents only -- not on Bedrock or Vertex.)

Claude Platform on AWS: Anthropic-operated alternative on AWS Marketplace, billed in Claude Consumption Units (CCU) at $0.01 per CCU. Token usage is rated in USD at standard per-model rates, then converted to CCUs. Typically gets same-day feature parity with the Anthropic API. Fast Mode and Batch API are NOT available on this platform.


Cost Formula

Turn Cost = (Input Tokens x Input Price) + (Output Tokens x Output Price)

Where Input Tokens =
    System Prompt (~3,500 tokens, fixed)
  + CLAUDE.md (~7 tokens/line x number of lines)
  + Conversation History (grows each turn)
  + Tool Results (file contents, search results, command output)
  + MCP Responses (if using MCP servers)

Session Cost = Sum of all turns
             - Prompt Cache Savings (up to 90% on repeated input)

Quick Copy-Paste Configs

Minimal .claudeignore

node_modules/
dist/
build/
.next/
coverage/
*.lock
package-lock.json
yarn.lock
pnpm-lock.yaml
*.min.js
*.min.css
*.map
.git/
*.pyc
__pycache__/
.env
.env.*
*.log

Budget-Conscious Launch Command

# Daily development with budget cap
claude --model sonnet --max-budget-usd 5

# Quick fixes with cheapest model
claude --model haiku --max-budget-usd 1

# Complex work with Opus but capped
claude --model opus --max-budget-usd 20

Cost-Saving CLAUDE.md Header

# Project: MyApp

Tech: TypeScript, React 19, Node 22, PostgreSQL
Style: ESLint + Prettier (run `npm run lint` before committing)
Tests: Vitest - run `npm test` for unit, `npm run e2e` for Playwright
Build: `npm run build` - must pass before PR

## Key Rules
- Prefer editing existing files over creating new ones
- Always add tests for new functions
- Use existing patterns from nearby files as reference

That is 10 lines. It gives Claude everything it needs. Every extra line costs you tokens on every turn.


Session Workflow for Minimum Cost

1. Start session       → claude --model sonnet --max-budget-usd 5
2. Complex problem?    → /model opus (switch up temporarily)
3. Plan first          → Shift+Tab to toggle Plan Mode
4. Be specific         → Reference exact files, line numbers, function names
5. Batch changes       → Group related edits into one prompt
6. Monitor             → /usage (check token consumption)
7. Getting long?       → /compact (summarize and reset context)
8. Simple task?        → /model haiku (switch down temporarily)
9. New topic?          → Start a fresh session
10. Done               → Check /usage - learn your patterns

Numbers Worth Memorizing

Fact Number
Fable 5 output is ___ per 1M tokens $50 (2x Opus 5)
Opus 5 output is ___ per 1M tokens $25 (same as 4.8)
Haiku 4.5 is ___ cheaper than Opus on input 5x (10x vs Fable 5)
Opus 5 minimum cacheable prompt 512 tokens (half of Opus 4.8's 1,024)
Output tokens cost ___ more than input 5x
Prompt cache discount 90%
CLAUDE.md loads on every ___ turn
CLAUDE.md max size per file 4,000 characters (truncated beyond)
Total instruction file budget 12,000 characters (across all CLAUDE.md files)
1 line of code is roughly ___ tokens ~10
Token estimation rule of thumb ~1 token per 4 bytes of text
Opus 4.7+ tokenizer overhead vs older models up to +35%
150-line CLAUDE.md per turn is roughly ~1,050 tokens
50-turn session CLAUDE.md cost (Sonnet 4.6) ~$0.16
50-turn session CLAUDE.md cost (Opus 5, pre-cache) ~$0.26 (factor +35% for new tokenizer)
Average tool result size 500-5,000 tokens
Compaction trigger threshold ~10,000 tokens of compactable content
Messages preserved after /compact 4 most recent
Fable 5 / Opus 5 / 4.8 / 4.7 / 4.6 / Sonnet 5 max output per turn 128K tokens
Sonnet 4.6 / 4.5 / Haiku 4.5 max output per turn 64K tokens

Output Token Optimization

Output tokens cost 5x more than input across all models. Most strategies above target input -- these target the expensive side.

Strategy Savings (output) How
Use a brevity skill (e.g. caveman) 50-75% System prompt that strips filler, pleasantries, and hedging from responses. Technical accuracy unchanged. See caveman
"Be concise" in CLAUDE.md 20-40% Add "Be concise. Skip explanations unless asked." to your CLAUDE.md. Simple but effective
Batch outputs 10-20% "Rename X in all files" (one response) vs 12 individual rename requests (12 responses)
Suppress explanations 15-30% "Just show the code, no explanation" or "diff only" for mechanical tasks
Use Plan Mode wisely 10-20% Plan Mode output is cheaper than failed code generation + correction cycles

Research backing: A March 2026 study (arXiv:2604.00025) found that brevity constraints actually improved model accuracy by 26 percentage points on certain benchmarks. Less verbose does not mean less correct.

CLAUDE.md Compression

Your CLAUDE.md loads on every turn as input tokens. Applying brevity rules to it compounds savings:

BEFORE (68 chars):
"This project uses React with TypeScript. Always use functional components."

AFTER (42 chars, same info):
"React + TypeScript. Functional components only."

Every character saved in CLAUDE.md saves tokens on every turn of every session. At 30 turns/session and 3 sessions/day, a 1,000-character reduction saves ~165,000 input tokens/month.


Emergency Cost Reduction

Already spending too much? Do these right now:

  1. Switch to Haiku for the rest of the session: /model haiku
  2. Run /compact to shrink conversation history
  3. Start a new session if context is bloated beyond recovery
  4. Set a hard cap: claude --max-budget-usd 2 for the next session
  5. Audit your CLAUDE.md - delete anything Claude does not need on every turn

Links

Resource Link
Getting Started (5 min) guides/00-getting-started.md
Understanding Costs (deep dive) guides/01-understanding-costs.md
Context Optimization guides/02-context-optimization.md
Model Selection Guide guides/03-model-selection.md
Workflow Patterns guides/04-workflow-patterns.md
Team Budgeting guides/05-team-budgeting.md
Three-Tier Task Routing guides/10-task-routing.md
Speed vs Cost guides/11-speed-vs-cost.md
CLAUDE.md Templates templates/CLAUDE.md/
Token Estimator Tool tools/token-estimator/
Usage Analyzer Tool tools/usage-analyzer/
claude-rate (local setup rater) tools/claude-rate/
Caveman skill (output tokens) github.com/JuliusBrussee/caveman

This cheatsheet covers the strategies. For the reasoning and benchmarks behind each one, read the full guides.