Growth Kit 2.0 is here! CRO, Paid Ads & more! Code Kit v4.6 released for CC's new Task System.
Claude FastClaude Fast
Development

Claude Code Pricing: Optimize Your Token Usage & Costs

Master Claude Code pricing and token optimization to reduce costs by 70%. Learn proven strategies to maximize value from your API or subscription.

Problem: Claude Code costs adding up fast, hitting usage limits, or unsure which subscription tier fits your workflow. Strategic model selection and usage tracking can cut costs by 70%.

Quick Win: Install ccusage to see exactly where your tokens go:

npm install -g @ryoppippi/ccusage
ccusage daily

This shows your daily token consumption and cost breakdown immediately.

Understanding Claude Code Pricing

Claude Code requires at least a Pro subscription ($20/month) since the free tier lacks terminal access.

Claude Pro ($20/month) - 5x usage limits vs free, Sonnet access, ~45 messages per 5-hour window. Best for learning and hobby projects.

Claude Max 5x ($100/month) - 5x Pro limits (~225 messages/5hr), generous Opus access. Best for professional developers.

Claude Max 20x ($200/month) - 20x Pro limits (~900 messages/5hr), full Opus access. Best for heavy daily usage and complex engineering.

API Pay-per-Use - Sonnet: $3/$15 per million input/output tokens. Opus: $15/$75 per million tokens. Best for predictable high-volume work.

Real Optimization Commands

Model Switching with /model

Switch models based on task complexity to control costs:

/model sonnet   # Default for 80% of tasks
/model opus     # Complex architecture decisions only

Rule: Start every session with Sonnet. Only switch to Opus when you need deep analysis or complex refactoring.

Context Control Commands

/compact    # Compress conversation when context gets long
/clear      # Start fresh for unrelated tasks

Long conversations consume more tokens with every message. Use /compact when you notice Claude losing track, and /clear when switching to completely different work.

Planning Mode (Shift+Tab)

Press Shift+Tab twice in the terminal to enter plan mode before expensive operations. Planning first prevents costly rework - Claude outlines the approach before writing code, so you catch issues early. Learn more in our planning modes guide.

Track Your Usage

Monitor consumption with ccusage reports:

ccusage daily              # Daily breakdown (default)
ccusage monthly            # Monthly aggregation
ccusage blocks --live      # Real-time 5-hour billing windows
ccusage daily --breakdown  # Per-model cost breakdown

Filter by date range when investigating spikes:

ccusage daily --since 20250101 --until 20250131

Cost-Saving Patterns

Specific prompts beat vague ones. Compare:

# Expensive (wastes tokens on clarification)
claude "make this better"
 
# Efficient (immediate results)
claude "optimize readability in src/auth.js - extract constants, add error handling"

Batch related tasks to maximize context efficiency:

claude "update error handling in auth.js, user.js, and api.js"

Watch for expensive patterns:

  • Long debugging sessions - break into smaller, focused requests
  • Repeated explanations - save them in CLAUDE.md
  • Full codebase reviews - use targeted file analysis instead

Environment Variable Cost Controls

Beyond model switching, several environment variables give you direct control over token spending:

Reduce Non-Essential Token Usage

# Suppress background model calls that aren't critical to your task
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1

This disables model calls used for non-critical features like suggestions and tips. It won't affect your core workflow but reduces background token consumption.

Disable Cost Warnings

# Suppress cost warning messages in the CLI
export DISABLE_COST_WARNINGS=1

Useful if you've already budgeted for your usage and don't want interruptions. Not recommended until you've established a baseline with ccusage.

Prompt Caching Controls

Claude Code uses prompt caching by default to reduce costs and latency. If you need to disable it for specific models (for debugging or benchmarking), use these variables:

# Disable prompt caching globally
export DISABLE_PROMPT_CACHING=1
 
# Or disable per-model
export DISABLE_PROMPT_CACHING_HAIKU=1
export DISABLE_PROMPT_CACHING_SONNET=1
export DISABLE_PROMPT_CACHING_OPUS=1

The global setting overrides per-model settings. Keep prompt caching enabled for production use since it significantly reduces costs on repeated context. See the model selection guide for the full prompt caching reference.

The opusplan Strategy

If you need Opus-level reasoning but want to control costs, the opusplan model alias provides an automated hybrid approach:

claude --model opusplan

With opusplan, Claude uses Opus during plan mode for complex reasoning and architecture decisions, then automatically switches to Sonnet for code generation and implementation. You get Opus reasoning quality where it matters most (planning) without paying Opus rates for every line of code written.

This is one of the most effective cost optimization strategies for developers who regularly use planning mode.

When Things Go Wrong

Approaching limits? Switch models and compact:

/model sonnet
/compact

Hit rate limits? Wait for hourly reset, batch requests instead of rapid calls, or consider upgrading your plan.

Next Steps

Track weekly and adjust based on data. Most developers reduce costs 40-70% with these strategies.

Last updated on

On this page

Claude Code ready in seconds.