Why the Same Number of Tokens Can Cost Several Times More
Token pricing is not uniform: uncached input, cache writes, cache reads, and output are billed at very different rates. This article breaks down how LLM API caching works, walks through a real cost calculation for a typical conversation turn, and explains why the same task can produce bills that differ by 5x or more — and how context management, not model choice, makes the difference.
Why Two Identical Tasks Can Produce Very Different Bills
Two engineers at the same company used the same AI coding assistant to fix the same login module. The task complexity was similar, the model was the same, and the number of conversation turns was roughly equal. When they checked their usage afterward, one had spent the equivalent of a little over a dollar, while the other had spent several times more.
The gap came not from model choice or task difficulty, but from which pricing category the tokens fell into. LLM tokens are not billed at a single flat rate — they are settled separately by pricing type. Understanding this is the key to explaining why bills can differ by several times.
This article walks through three steps: first the pricing structure, then the actual cost of a single conversation turn, and finally how to steer more tokens toward the cheaper categories. The key to saving money depends largely on how you make calls and manage context — not on the model itself.
What Each Request Actually Sends
Many people assume each turn only sends the new input. In reality, most conversational APIs re-send the entire conversation history with every turn, including previous user messages, model replies, tool call results, and system instructions. As the conversation grows longer, each request gets progressively larger.
When the server returns a response, it typically reports four categories of usage:
- Uncached input: the small portion of content that did not hit the cache.
- Cache write: content newly added this turn and stored in the cache for the next turn — for example, the new message, the previous model reply, and freshly generated tool results.
- Cache read: historical content that was sent in a previous turn and reused unchanged this turn. This is usually the largest share of the entire request.
- Output: the text the model generates this turn.
These numbers are reported by the server. The client only needs to multiply them by the pricing rules and sum them up to get the total session cost.
How Caching Works
The core idea behind caching is straightforward. The server keeps the content prefix it has already received. When the next request arrives, if its beginning matches the cached content exactly, that prefix can be reused directly without being reprocessed. New content is appended at the end.
This mechanism requires the prefix to remain stable. If any earlier segment is modified, deleted, or reordered, all cached content after it becomes invalid. Cache hits therefore depend on two conditions: the content prefix stays stable, and the interval between two requests does not exceed the cache’s validity period.
Caching is also time-limited. After a session sits idle for a long time, the cache may expire, and the next turn must re-write the entire history.
The Relative Pricing of the Four Categories
The rates for each category differ significantly, but what matters most is the ratio between them. The table below uses a hypothetical base price. Assume the base input price is 3 units per million tokens (illustrative only — actual prices depend on each provider’s published pricing):
| Pricing Category | Multiple of Base Input | Price per Million Tokens (illustrative) |
|---|---|---|
| Uncached input | 1x | 3 |
| Output | 5x | 15 |
| Cache write | 1.25x | 3.75 |
| Cache read | 0.1x | 0.3 |
Output is the most expensive, cache reads the cheapest — a 50x difference. Most mainstream models’ pricing tables follow a similar ratio structure; the main difference between models is the得更 between models lies in the base unit price. So when evaluating cost structure, focus on the multiples rather than comparing a single model’s sticker price.
Doing the Math on a Typical Conversation Turn
Suppose a turn contains roughly 41,000 tokens of history, about 2,000 tokens of new content, and the model outputs about 800 tokens. Using the table above, there are two scenarios.
Scenario 1: Cache hit.
- History of 41,000 tokens billed at cache-read rates: 41,000 ÷ 1,000,000 × 0.3 ≈ 0.0123
- New content of 2,000 tokens billed at cacheelicamente tokens besten tokens billed at cache-write rates: 2,000 ÷ 1,000,000 × 3.75 constructor 3.75 ≈ 0.0075
- Output of 800 tokens: 800 ÷ 1,000,000 × 15 ≈ 0.012
- Total ≈ 0.备案 0.032
Scenario 2: Cache expired.
- Historyceased.**
- History plus new content, 43,000 tokens total, all billed at cache-write rates: 43,000 ÷ 1,000,000 × 3.75 ≈ 0.161
- Output of 800 tokens: ≈ 0.012
- Total ≈ 0.173
The gap between the two scenarios is roughly 5.4x. Same task, same output — yet the bill differs by a factor of several, purely because of whether the cache was hit.
This example also reveals a pattern: the higher the proportion of historical content, the larger the share of cache reads — and the longer the session, the more significant this factor becomes. In long sessions, cache reads typically account for over 90% of a turn’s input.
