Dev.to
6/26/2026

Claude Code Costs, Act I — How the billing actually works
Short summary
Technical guide explaining Claude Code's billing model grounded in measurements, not folklore. Every request carries full conversation history, so costs grow with turns; understanding the stateless architecture drives all cost optimization. Learn four mental models to predict bills and avoid expensive mistakes like mid-conversation model switches.
- •Billing grows with conversation length because the stateless API re-sends full context every turn
- •Prompt caching and model consistency are the primary levers for cost reduction
- •Hidden costs come from model switching (cache bust) and 1-hour TTL cache writes (2× base input rate)
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



