Use prompt caching aggressively
Anthropic's prompt caching lets you mark a prefix of your prompt as cacheable. Subsequent requests that share that prefix pay a fraction of the input token cost for the cached portion. For applications that re-send the same system prompt, tool definitions, or document context across many requests, this is the biggest lever: cache reads are billed at a small fraction of the base input rate (10% on most models).
The catch: the default cache lifetime is 5 minutes (a 1-hour option costs more to write), so it pays off on high-frequency workloads. Restructure prompts so the stable, large content sits at the top and the variable parts sit at the bottom.
Pick the right model tier
Claude comes in tiers (Opus, Sonnet, Haiku) at very different price points. Many teams default to the most capable model for everything, when most of their requests would be answered just as well by a cheaper tier. A common pattern is routing: a cheap model for classification, summarization, and simple lookups, and the expensive one for reasoning-heavy tasks. How much that saves depends on your mix, so measure quality on a sample before switching.
Constrain output length
Output tokens cost more than input tokens. Without a tight max_tokens, answers run longer than they need to. For structured outputs, JSON responses, or short answers, set a strict cap. For chat-style applications, prompt the model explicitly for brevity. Output reduction often matters more than input reduction.
Use the Batch API for non-realtime work
The Batch API gives you a 50% discount on requests that can wait up to 24 hours for a response. Anything that runs on a schedule (overnight reports, document summarization pipelines, evaluation runs, dataset labeling) should use it. The discount is automatic; the cost is a little orchestration code.
If you are using Claude Code, take the shortcut
The above levers apply when you control your own API calls. If your spend goes through Claude Code rather than your own application, Claude Code manages caching itself and you cannot batch requests; beyond picking the model with /model, the lever left is how much context it sends.
That is what Headroom does: it intercepts every Claude Code prompt locally, compresses repetitive logs and boilerplate, and forwards a smaller payload. About 50% fewer tokens on the noisy items it compresses, typically 25-50% across a session. Read our Claude Code cost guide for the full breakdown of which workflows benefit most, or the Why is Claude Code so expensive? page if you want to understand the underlying patterns first.