DEV Community
Why is my Claude API bill so high? 9 things to check
Originally published at neverpaytwice.pages.dev. Short answer: the usual causes are thinking tokens you never see but pay for as output, a prompt cache that silently never hits, the whole conversation being sent again on every turn, and paying a premium you didn't need (fast mode, a bigger model, real-time instead of batch). Every response tells you exactly what you paid for in its usage block. Save those blocks, and the free script below shows where the money went, which requests skipped the cache, and which ones it can't price. 1. Thinking you never see is billed as output On current models thinking is on by default, and on Claude Opus 5.5 it can't be switched off. The thinking happens and is billed the same whether or not you display it, and on the newest models the default display shows nothing, so it is easy to miss. Thinking tokens are counted inside output_tokens, at the output price, which is five times the input price. usage.output_tokens_details.thinking_tokens tells you how much of the output was thinking. Fix: use the effort setting (output_config.effort). It controls how deeply the model thinks and how many tokens it spends overall. Simple tasks such as classification or short chat often do fine at low. Measure quality on real requests before and after. More on thinking costs. 2. The prompt cache never hits Caching works on an exact prefix: any change anywhere early in the prompt makes everything after it miss. A timestamp or request ID in the system prompt, JSON written with keys in a different order, or a tool list that changes between calls will each stop the cache from ever hitting, without any error. Prompts shorter than the model's minimum cacheable length (between 512 and 4,096 tokens, depending on the model) are not cached either. Check: if cache_read_input_tokens stays at zero on requests that share a long beginning, something is changing the prefix. Put stable content first and anything that varies after the last cache breakpoint. The caching break-even math shows when caching pays off. 3. Every turn sends the whole conversation again The API keeps no memory between requests, so a chat or agent loop sends the full history every time. Turn 30 pays for turns 1 to 29 again as input. Without caching, the cost of a long conversation grows much faster than its length. Fix: cache the conversation so earlier turns are read from the cache at a fraction of the price, keep tool results short, and start fresh conversations when the old context no longer matters. 4. Cache writes cost more than plain input Writing to the cache costs 1.25 times the input price for the 5-minute cache and 2 times for the 1-hour cache. If you write a lot to the cache and rarely read it back, caching costs you more than it saves. The 1-hour cache only pays off when the same prefix is read at least twice. 5. Fast mode doubles the price Fast mode on Claude Opus 5.5 costs $8 per million input tokens and $40 per million output tokens, twice the standard rate. If usage.speed says "fast" on requests where nobody is waiting, you are paying double for speed you don't need. 6. Work that could wait isn't batched The Message Batches API runs requests asynchronously at half the price. Nightly summaries, bulk classification, evaluations and backfills rarely need an answer in seconds. Batch prices and limits. 7. A bigger model than the job needs Claude Opus 5.5 costs $4 / $20 per million input / output tokens; Claude Sonnet 5.5 costs $2 / $10, half as much; Claude Haiku 5.5 costs $0.10 / $0.50. But judge cost per finished task, not per request: a cheaper model that needs more retries or turns isn't cheaper. Lowering effort on the model you already use is often worth trying first. 8. Long prompts on Haiku 5.5 Claude Haiku 5.5's $0.10 / $0.50 price covers prompts up to 100,000 tokens. Above that it is $0.50 / $2.50, five times as much. A pipeline that occasionally sends a huge document to Haiku can cost far more than expected. 9. Paying twice for the ...
Powered by Readybot.io
External Link
Platform
You are about to visit:
https://example.comThis will open in a new tab. Make sure you trust this link.