10 Million Tokens Consumed: Three Pleasant Surprises and One Unexpected Finding from Testing LLM Long-Running Tasks
We ran a continuous real-world test consuming roughly 10 million tokens across long-document understanding, multi-round code editing, and agent-style tool calling. The results: prefix caching dramatically cut costs, long-context stability exceeded expectations, and agent tool-calling reliability improved markedly. The surprise? Despite an API price increase for newer models, our final bill rose far less than the unit price did. This article breaks down each finding with practical guidance on prompt structuring, architecture choices, and cost estimation for teams doing technical evaluations.
10 Million Tokens Consumed: Three Pleasant Surprises and One Unexpected Finding from Testing LLM Long-Running Tasks
1. Background: Why We Ran a 10-Million-Token Test
In real business scenarios, developers’ understanding of LLM APIs often stops at short conversational tests: asking a few questions, generating a few code snippets, and then concluding “the quality is fine” or “the cost is manageable.” But such lightweight testing rarely exposes the real problems of long-running tasks—context bloat, cache hit-rate fluctuations, stability across many rounds of tool calls, and how the bill curves upward once things scale.
To answer the question “how do LLMs actually perform in tasks that run for hours, and how does the cost really grow,” we designed a continuous test consuming approximately 10 million tokens in total, covering typical scenarios: long-document understanding, multi-round code modification, and agent-style tool calling. This article distills the findings into three pleasant surprises and one unexpected result, analyzed one by one.
2. Surprise #1: Context Caching Significantly Reduced Long-Task Costs
The biggest cost characteristic of long tasks is the “repeated prefix”: in multi-turn conversations, continuous code editing, and repeated document Q&A, every request carries large amounts of identical historical context. Without caching, this repeated content must be re-prefilled every time—slow and expensive.
Mainstream serving frameworks have generally introduced prefix caching: when a new request shares the same prompt prefix as a previous request, the system can directly reuse the already-computed key-value cache and only compute incrementally for the new portion. This brings two direct benefits:
- Much lower first-token latency: cached portions skip repeated prefill, so responses speed up noticeably;
- Lower billing costs: most platforms charge a lower unit price for cache hits, or apply a discount at billing time.
In our testing, for a typical “long document + multi-round follow-up questions” task, the first request was billed at full price, but from the second round onward the cache hit rate stayed consistently high. A rough estimate shows that a significant proportion of total token consumption went through the cached path, and the actual cost paid was far lower than the naive calculation of “total tokens × standard unit price.”
A best practice worth highlighting: put stable, unchanging content at the front of the prompt, and dynamic content at the end. For example, system instructions, reference documents, and code repository context should come first and stay stable, while user inputs and ad-hoc instructions go last. This maximizes the prefix cache hit range. The recommended structure looks like this:
[System instructions (stable)][Long document / code context (stable)][Conversation history (append-only growth)][Current user input (dynamic)]
Conversely, if you modify the system instructions at the beginning on every request, or randomly shuffle the context order, the cache is almost entirely invalidated and costs return to full price. This is frequently overlooked in real-world engineering.
3. Surprise #2: Output Stability Under Long Context Exceeded Expectations
The second surprise was the model’s performance with very long contexts. We repeatedly pushed context to tens of thousands or even hundreds of thousands of tokens, observing three dimensions:
- Instruction following: whether constraints placed at the beginning of the context (output formats, naming conventions) are still respected late in a long conversation;
- Information recall: whether key details buried in the middle of a document can be accurately extracted in follow-up questions;
- Consistency: whether, after multiple rounds of code changes, the model stays logically self-consistent without contradictory edits.
The results showed that, as long as the context is well organized, the model maintained a high standard across all three dimensions. Combined with caching, long context is no longer “usable but painful”—the dual optimization of latency and cost makes it engineering-feasible to put an entire technical document or an entire code module directly into the context, without over-relying on complex external retrieval pipelines.
This does not mean retrieval-augmented approaches have no value. Our practical conclusion: for medium-sized domain documents (up to a few tens of thousands of tokens), putting the full text directly into the context with caching often delivers a better experience and lower cost than retrieval; only when the knowledge base far exceeds the context window do you need to introduce retrieval. This is a judgment many teams get wrong during architecture selection.
4. Surprise #3: Agent-Style Tool-Calling Reliability Has Clearly Improved
The third surprise came from function calling scenarios. We simulated a typical developer-agent workflow: read file → analyze → modify → execute → iterate on errors, looping for dozens of rounds.
The biggest pain point of these long-chain agents used to be “the longer the chain, the more likely it breaks”—after round 20, the model would forget tool parameter formats, repeat already-completed steps, or fall into infinite loops after errors. In this test, thanks to improved long-context stability and instruction following, the model’s performance in long chains improved markedly:
- Parameter formats stayed stable: after dozens of rounds of calls, the JSON structure of tool inputs remained well-formed, with no format drift;
- Better state awareness: the model correctly judged from conversation history which steps were already completed, and repeated calls dropped sharply;
- More rational error recovery: faced with execution errors, the model tended to analyze the cause and adjust its approach, rather than mechanically retrying.
For developers building agent applications, our advice is: even with improved model capabilities, engineering-side safeguards remain necessary—perform structured validation on every tool call, set a maximum number of loop iterations, and summarize execution results before feeding them back into the context (to avoid raw logs blowing up the context). These measures further raise the success rate of long-running tasks.
5. The Unexpected Finding: API Prices Went Up, But the Bill Rose Far Less Than Expected
The final finding was an “unexpected” one: with the release of a new model generation, the standard API unit price increased compared to the previous generation. At first glance at the price sheet, we expected the bill to rise proportionally.
But the final bill broke that expectation—the total cost increase was significantly smaller than the unit-price increase. Three reasons:
- Caching offsets it: as noted above, a large share of tokens in long tasks goes through the cached path at lower prices, directly diluting the impact of the price increase;
- Efficiency gains reduce total tokens: with stronger model capabilities, completing a task requires fewer round trips, and wasted output (retries, corrections, redundant explanations) also shrinks, so the same task consumes fewer total tokens;
- Higher first-pass success rate: improved one-shot code pass rates mean fewer rework rounds, and thus fewer repeated-context billing charges.
This yields an important methodology for cost evaluation: don’t do static calculations of “unit price × estimated token volume”; instead, run small-scale tests on real business traffic and incorporate cache hit rate, average round trips, and task success rate into your model. A simplified cost estimation formula:
Actual cost ≈ Σ(cache-miss tokens × standard price+ cache-hit tokens × cached price)÷ task success rate correction factor
The task success rate indirectly amplifies cost—failed tasks must be rerun, and their context costs are pure waste.
6. Summary and Recommendations
The core conclusions of this 10-million-token test can be condensed into four points:
- Prefix caching is the lifeline of long-task costs; prompt structure design must follow cache-friendly principles;
- Long-context capability has entered the practical zone; medium-sized knowledge bases can go directly into the context, and architecture choices should be re-weighed;
- Engineering reliability of long agent chains has improved significantly, but structured validation, loop limits, and other safeguards remain standard practice;
- Evaluate costs through dynamic testing, not static unit prices; caching mechanisms and capability gains often offset nominal price increases.
For teams making technology decisions, we recommend first running a small-scale benchmark with real business samples, tracking three key metrics—cache hit rate, average task rounds, and cost per task—before deciding on architecture and budget. A paper comparison of prices is far less reliable than one carefully designed real-world test.
