Why LLM Inference Costs Drop to Just Tens of Yuan
This article breaks down why a complex math task consuming roughly 160 million tokens can cost only a little over thirty yuan. It explains that the bill is driven not by the number of rounds but by how many tokens are billed at higher price tiers, covering input, output, and cache-hit tokens, why coding and reasoning tasks are especially cheap, four general cost-reduction techniques, three common pricing misconceptions, and a practical cost observability dashboard.
Why LLM Inference Costs Drop to Just Tens of Yuan
Solving a single complex math problem consumed roughly 160 million tokens in total, yet the final bill was only a little over thirty yuan. The number seems counterintuitive, but it exposes the cost structure of LLM inference very clearly: what really determines the bill is not “how many rounds were run,” but “how many tokens were billed at higher price tiers.”
1. Break Down the Bill First: Tokens Are Not One Thing
Many people treat tokens as a single billing unit. In reality, a single request involves at least three types of tokens:
- Input (prompt) tokens: system prompts, conversation history, tool return results, and code context.
- Output (generation) tokens: content the model produces token by token, which is the most expensive to compute.
- Cache-hit tokens: when the prefix matches already-cached content, intermediate computation results can be reused, usually billed at a significant discount.
A simplified cost model can be written as:
cost = (in_tokens * p_in+ out_tokens * p_out+ cached_tokens * p_cached) / 1_000_000
Spending only a little over thirty yuan on 160 million tokens means the vast majority of tokens fell into discounted tiers, and output tokens made up a very small share. Agent-style tasks repeatedly read the same problem statement and the same set of tool descriptions, so the prefix is highly repetitive and naturally suited to cache reuse.
2. Why Coding and Reasoning Tasks Are Especially Cheap
These tasks share three characteristics in the shape of their requests:
- Stable prefix. System instructions, tool schemas, and repository context barely change across dozens of calls.
- Sparse output. Each step produces only a small amount of structured decisions, such as “which tool to call and what parameters to pass.”
- Retries are allowed. A single call is cheap, so more rounds can be traded for a higher success rate.
Put together, the result is a large total token count but very few high-priced tokens. Cost shifts from “growing linearly by round” to “growing by effective new content.”
3. Four General Ways to Bring Costs Down
- Context governance: inject only the necessary fragments and summarize and compress earlier rounds to avoid unbounded context growth.
- Caching and prefix reuse: place stable content at the very front of the prompt to improve the hit rate.
- Tiered model routing: send simple judgments to smaller models and escalate to larger models only for complex reasoning.
- Batching and asynchrony: merge requests for offline tasks to improve resource utilization per unit.
The routing logic can be implemented minimally:
def route(task):return "small" if task.difficulty < 0.4 else "large"
4. Don’t Look at Unit Price Alone: Three Common Misconceptions
First, looking only at the per-million-token unit price while ignoring the cache hit rate often overestimates cost by several times. Second, ignoring output tokens means the bill will be dominated by output in long-form generation scenarios. Third, ignoring retries and loops means tokens silently accumulate when an agent falls into repeated calls.
5. Practical Cost Observability
It is advisable to build a minimal viable cost dashboard with fields including: number of requests, breakdown of input/output/cached tokens, average rounds, task success rate, and cost per task. With this breakdown data, you can tell whether the optimization direction should be compressing context, adjusting routing, or fixing loop defects.
When deploying on the cloud, you can combine a container platform to host inference services, object storage to save context snapshots, a message queue to smooth request peaks, and logging services with monitoring and alerting for cost attribution. These are all common industry capability categories.
Conclusion
Running 160 million tokens for a little over thirty yuan is not magic; it is the combined result of cache reuse, context governance, and tiered model routing. Understanding the tiered structure of tokens matters more for the final bill than chasing unit prices.
