Understanding LLM API Token Costs (and How to Estimate Your Bill)
July 9, 2026 · DevTools
Every major LLM API — OpenAI, Anthropic, Google — bills the same way: per token, metered separately for what you send (input) and what the model generates (output). Understanding the shape of that pricing is the difference between a predictable bill and a surprise.
Input vs. output pricing
Output tokens almost always cost more than input tokens — often 4–5× more. For example, a mid-tier model might charge $3 per million input tokens and $15 per million output tokens. This asymmetry matters a lot depending on your workload:
- Summarization / extraction reads a lot and writes a little → dominated by input cost.
- Generation / chat may read little and write a lot → dominated by output cost.
A rough formula for a single call:
cost = (input_tokens / 1e6) * input_rate
+ (output_tokens / 1e6) * output_rate
What a token actually is
A token is a chunk of text — very roughly ¾ of a word in English, but it varies by language and content. Code, non-English text, and unusual formatting tokenize less efficiently. Don't estimate with a word count; use the provider's token counter for anything you're budgeting seriously.
Levers that change the bill
- Prompt caching — reusing a large fixed prefix (system prompt, docs) can cut input cost dramatically on repeated calls.
- Model choice — a smaller model at a fraction of the price is often plenty for classification or routing.
- Max output tokens — capping generation bounds the expensive half.
- Batching — some providers offer ~50% off for asynchronous batch jobs.
Estimate before you ship
Before rolling a feature out to thousands of users, multiply one request's cost by your expected volume. The Token Cost Calculator does exactly this: pick a model (or enter custom per-million rates), plug in typical input and output token counts and a request count, and see the per-request and total cost. Because list prices drift, it keeps Anthropic prices current and lets you type in any provider's exact rates.