Free · WaitlistJoin the waitlist for the free 2-day Vibecoding & AI Agents Intensive (autonomous Hermes + DeepSeek agent · led by Jemal Hamidun, Head of AI at Alpina Digital & MIPT)Join the waitlist →
ReleaseAPI / Product · ActionableХабр: NLP→ original

Your LLM Bill Is Off by Multiples From Your Estimate: The Five Components It's Made Of

The back-of-the-envelope formula, "input × price + output × price," often misses: the bill comes in several times higher or lower. An author on Habr reduced the cost of a call to five components: uncached input, cache reads, cache writes, visible output and hidden model reasoning. Output usually costs 4–8 times more than input, and reasoning is billed at the output rate even though you never see it in the response. That's why budgets should be calculated from the usage fields in the API response, not from text length.

AI-processed from Хабр: NLP; edited by Hamidun News
Your LLM Bill Is Off by Multiples From Your Estimate: The Five Components It's Made Of
Source: Хабр: NLP. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceХабр: NLP ↗
Editor-in-Chief
Key metric #1Cache writes cost 1.25× the input price (5 minutes at Anthropic) or 2× (1 hour).
Key metric #2Cache reads are usually 10 times cheaper than regular input.
Key metric #3On tiered pricing, crossing the threshold makes the entire input more expensive at once.

Most teams estimate the cost of an LLM request the same way: they open the price list, take the price per million tokens for input and output, and multiply by the expected volumes. Then the bill arrives, and it differs from the estimate by several times. Sometimes it's lower, because some requests quietly hit the cache. The author of a recent Habr breakdown ran into this situation several times, so they decomposed the cost of a single call into its components. They checked the terms against the documentation of OpenAI, Anthropic and Google as of October 18, 2026. Pricing changes often, so check the figures against the official pages.

Five components instead of two

Providers charge for tokens, not for requests or characters. Leaving aside surcharges for special modes and server-side tools such as web search, the cost of a call consists of five parts: regular uncached input, input read from the cache, input written to the cache, the visible response, and reasoning tokens.

The formula looks like this: cost equals the sum of tokens of each type, multiplied by their respective price, divided by one million. Each component has a multiplier. Reading from the cache usually costs about 0.1 of the input price, and some newer models charge even less. Writing to the cache costs more than regular input: Anthropic's 5-minute cache and OpenAI models with paid writes carry a 1.25 multiplier, and Anthropic's 1-hour cache has a multiplier of 2. Where writes are free, you simply pay the normal input rate.

The formula shows where to look first. Output almost always costs more than input: for most models from the three major providers, the gap is four to eight times. A long answer costs more than a long question. Reasoning tokens are also counted as output, so they fall into the most expensive component. That's why a three-line answer can cost as much as a page of text: the model may have "thought" through thousands of tokens you never see, but you pay for them at the output rate.

Caching: a discount that doesn't always apply

Prompt caching multiplies the largest part of the input by a small coefficient, but only if the beginning of the request matches the cached prefix up to the last token. For example, an agent has a long system instruction and tool descriptions amounting to 10,000 tokens. If they sit at the start and don't change between calls, each repeated read costs roughly one-tenth as much. But if something variable lands at the start, such as the current time or a user identifier, the prefix is new every time, and you pay the cache-write surcharge of 1.25 or 2 without getting the read discount. In that case, caching only adds cost.

This also explains the reverse surprises. If the bill comes in below the estimate, it's likely that some requests accidentally matched on prefix and the platform applied the discount.

Where to read the numbers, and long context

All token counts arrive in the API response, in the usage object. The problem is that providers name the fields differently and, worse, count them differently. For some, the cached portion is included in the total input count; for others, it's reported separately. A developer who simply sums the fields risks counting the same thing twice or missing reasoning tokens altogether. The author suggests mapping the fields of the three providers into a correspondence table and calculating from it.

Models with tiered pricing have a separate trap. If the total input volume, including the cached portion, exceeds the threshold, all prices in the formula switch to the higher tier, and not just for tokens above the threshold but for the entire request. So, as the author writes, a few extra thousand input tokens can double the cost of a call. The specific thresholds are not given in the available part of the material; they need to be checked in the pricing for the chosen model.

What to do in practice

  • Calculate budgets from the actual usage fields, not from text length.
  • Put the unchanging part of the prompt at the beginning and variable data at the end, so the cache prefix matches.
  • Limit the amount of reasoning where the model doesn't need to think for long.
  • Watch the long-context threshold: exceeding it makes the whole request more expensive.

The breakdown's limitation is simple: prices were verified as of one publication date, and the multipliers may change within a month. But the five-component structure doesn't depend on that, and it's a convenient way to check any new price list.

Story

Key Questions Answered

What are the key details on Five components instead of two?

Providers charge for tokens, not for requests or characters. Leaving aside surcharges for special modes and server-side tools such as web search, the cost of a call consists of five parts: regular uncached input, input read from the cache, input written to the cache, the visible response, and reasoning tokens. The formula looks like this: cost equals the sum of tokens of each type, multiplied by their respective price, divided by one million. Each component has a multiplier.

What are the key details on Caching: a discount that doesn't always apply?

Prompt caching multiplies the largest part of the input by a small coefficient, but only if the beginning of the request matches the cached prefix up to the last token. For example, an agent has a long system instruction and tool descriptions amounting to 10,000 tokens. If they sit at the start and don't change between calls, each repeated read costs roughly one-tenth as much.

Where to read the numbers, and long context?

All token counts arrive in the API response, in the usage object. The problem is that providers name the fields differently and, worse, count them differently. For some, the cached portion is included in the total input count; for others, it's reported separately. A developer who simply sums the fields risks counting the same thing twice or missing reasoning tokens altogether. The author suggests mapping the fields of the three providers into a correspondence table and calculating from it.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…