LLM API Cost Evaluation: How Cache Hit Rate Affects Your Real Spending
Estimating LLM API costs based only on the listed price per million tokens often leads to budget overruns. Real spending is determined by a composite formula involving cache hit rate, input/output token ratio, call time distribution, and billing plan selection. This article breaks down each factor with concrete cost scenarios across different cache hit rates, compares pay-as-you-go pricing with subscription plans, and provides a five-step evaluation framework to help technical teams build their own cost monitoring and model selection strategy.
When evaluating technology options, the cost of LLM API calls often determines whether a project can move from prototype to production at scale. However, many teams habitually focus on the “price per million tokens” listed on the vendor’s pricing page during initial evaluation—a practice that easily leads to budget miscalculations. In reality, actual spending is determined by a composite formula that includes cache hit rate, input/output token ratio, call time distribution, and billing plan selection. This article breaks down that formula from multiple dimensions and provides an actionable evaluation framework.
1. Beyond the Sticker Price: Understanding the Billing Architecture
Mainstream LLM API billing systems typically consist of three key factors: the cached-read price, the input processing price when the cache is missed, and the output generation price. Some cloud providers further differentiate between “peak” and “off-peak” billing tiers to encourage load balancing.
Take two common industry models as an example. Suppose Model A’s cached-read price is 0.115 RMB per million tokens, while Model B’s is 0.05 RMB per million tokens. On the surface, Model B has a huge advantage. But this price only applies when requests hit the cache. In real business scenarios, whether a request hits the cache depends on context reuse—for instance, in multi-turn conversations, repository-level code completion, or Q&A over a fixed knowledge base, prefix reuse probability is very high. In contrast, for scattered, independent short-text generation tasks, the cache hit rate may fall below 50%.
Therefore, the true starting point of cost evaluation should be: estimate a reasonable cache hit rate range based on your business scenario, rather than directly comparing listed prices.
2. Building a Dynamic Cost Estimation Model
To obtain data closer to reality, we can build a simple estimation model. Assume that in a single request, input tokens account for 65% of total tokens and output tokens account for the remaining 35%—a ratio representative of long-document summarization and code generation. We then estimate unit costs for Model A and Model B at three cache hit rate levels: 98%, 95%, and 90%.
2.1 High Hit Rate Scenario (98%)
- Model A: Most requests hit the cache; the small portion of missed input and all output are billed at standard rates. The combined cost is approximately 12.57 RMB per million tokens.
- Model B: Although its cache price is lower, its input processing price on cache misses and its output price are slightly higher. The combined cost is approximately 9.40 RMB per million tokens.
In this scenario, Model B still holds a cost advantage of roughly 25%.
2.2 Medium Hit Rate Scenario (95%)
- Model A: Combined cost is approximately 14.92 RMB per million tokens.
- Model B: As the miss ratio rises, the high input processing price begins to dominate. The combined cost is approximately 18.25 RMB per million tokens.
At this point, the ranking reverses. Model A, thanks to its pricing advantage on missed input, undercuts Model B by about 18%.
2.3 Low Hit Rate Scenario (Below 90%)
As the hit rate drops further, the price gap continues to widen. Model B’s cache-miss penalty is extremely high, and its total cost may exceed 1.5 times that of Model A.
Key conclusion: A service that looks highly price-attractive under cache-hit conditions can become a cost trap in low-reuse scenarios. Hit rate must be given core weight in any evaluation.
3. Subscription Plans vs. Pay-as-You-Go
Beyond pay-as-you-go billing, many cloud vendors offer monthly subscription plans (e.g., Lite, Professional, and Flagship tiers). These plans typically distinguish between peak hours (such as specific afternoon periods on workdays) and off-peak hours.
Take one platform’s three-tier plan as an example (hypothetically 118 RMB/month for Lite, 538 RMB/month for Professional, and 1,078 RMB/month for Flagship). At a 98% cache hit rate, the officially estimated weekly token allowances translate to roughly 160 RMB, 955 RMB, and 2,229 RMB worth of standard API usage, respectively. This means the effective per-token price under a subscription is equivalent to 50–70% of the standard rate.
But there is an easily overlooked strategic point: the definition of peak hours varies across platforms. On some platforms, “peak hours” cover only four hours per day (e.g., 14:00–18:00 on workdays), while others may cover longer periods. If your business traffic happens to concentrate in that window, your plan’s token quota will be consumed much faster than expected. Conversely, if your workloads are mostly asynchronous (such as overnight offline batch processing), the plan’s discount efficiency is maximized.
4. A Comprehensive Evaluation and Selection Framework
Based on the models above, we recommend that developers follow these five steps before making a final decision:
- Profile analysis: Measure the input-to-output token ratio in historical requests and the context reuse rate (i.e., prefix reuse proportion).
- Time distribution analysis: Measure request distribution and evaluate the share of traffic during peak hours.
- Simulation: Use both variables (hit rate + time-of-day coefficient) to calculate a realistic total monthly expenditure.
- Buffer for elasticity: Reserve a 20% budget buffer for business peaks to prevent cost drift caused by cache invalidation.
- Dynamic switching mechanism: At the architecture level, design a load-balancing strategy that can switch between pay-as-you-go and weekly/monthly subscription plans based on real-time cost monitoring.
5. Conclusion
Evaluating LLM API costs is never a simple arithmetic problem. It requires combining your business’s context reuse characteristics, call time distribution, and a structural understanding of model input and output. The optimal model choice is always one deeply bound to your specific scenario. We recommend that engineering teams build their own continuously updated cost observability dashboards rather than relying solely on vendor-provided pricing calculators. Only by accounting for dynamics and details can you uncover the true optimal cost solution.
