Understanding LLM API Tiered Pricing and Context Caching: A Cost Optimization Guide
A practical breakdown of how large language model API pricing works—covering input/output rates, standard vs. speed tiers, and context cache billing—and how to combine prompt design, traffic routing, and caching strategies to cut inference costs by 50% or more without sacrificing quality.
LLM API Tiered Pricing and Context Caching: A Cost Optimization Guide
From “It Works” to “It’s Affordable”
Over the past few years, LLM API services have evolved from experimental tools into production-grade infrastructure. For enterprise users, model capability matters—but what ultimately determines whether large-scale deployment is viable is inference cost. That’s why mainstream model providers design their pricing with care: lowering unit prices through version iterations, and offering dual tiers (standard/speed) plus context caching so that workloads with different characteristics can each choose what fits best.
A recent model release illustrates this well: compared with the previous generation, the standard tier saw a price reduction, and a new speed tier was added for latency-sensitive scenarios at roughly 2x the standard price. This article uses this typical pricing structure as an example to break down how LLM API billing works, and offers practical ideas for cost optimization.
Pricing Structure Overview
The new version’s pricing falls into two categories: base token billing and context cache billing, as shown below:
| Model Tier | Input | Output | Cache Hit | Cache Write (5min) | Cache Write (1h) |
|---|---|---|---|---|---|
| New Standard | ¥13.00 / MTok | ¥68.00 / MTok | ¥1.30 / MTok | ¥13.00 / MTok | ¥26.00 / MTok |
| New Speed | ¥26.00 / MTok | ¥136.00 / MTok | ¥1.30 / MTok | ¥26.00 / MTok | ¥52.00 / MTok |
| Previous Generation | ¥20.00 / MTok | ¥100.00 / MTok | ¥2.00 / MTok | ¥20.00 / MTok | ¥40.00 / MTok |
A few key takeaways from the table:
1. Output is significantly more expensive than input. Output prices are roughly 5x input prices. This aligns with industry consensus: generative inference carries far higher compute overhead than input processing, which only performs forward encoding. In architecture design, avoid redundant output—for example, have the model return structured results rather than long prose.
2. Version iterations lower unit prices. The previous generation cost ¥20/MTok for input and ¥100/MTok for output; the new standard tier drops to ¥13/MTok and ¥68/MTok—reductions of about 35% and 32%. Cache hit pricing also fell from ¥2.00 to ¥1.30. For businesses with stable call volumes, simply upgrading the model version delivers meaningful cost savings.
3. The speed tier is uniformly 2x. Input, output, and cache write prices in the speed tier are all double the standard tier’s, but cache hit pricing stays the same (¥1.30/MTok). This design hints that the speed tier targets low-latency interactions, not just “the same thing at a higher price.”
Standard vs. Speed: How to Choose
The dual-tier pricing essentially trades money for inference resource priority and throughput guarantees. Decision factors include:
Scenario fit
- Standard tier: best for latency-insensitive workloads like offline batch processing, asynchronous tasks, data analysis, and content generation. Lowest unit cost—the go-to choice for cost-sensitive applications.
- Speed tier: best for real-time chat, online customer support, code completion, and multi-turn Agent loops. In these scenarios, waiting time directly affects user experience and retention; paying 2x for lower queuing latency and more stable response times is a worthwhile trade-off.
Cost model for mixed traffic
Most applications aren’t a single scenario. Route traffic at the gateway level: send real-time requests to the speed tier and background tasks to the standard tier. A simplified monthly cost estimate:
Monthly cost = (realtime input × 26 + realtime output × 136+ offline input × 13 + offline output × 68) / 1,000,000
In practice, if real-time traffic accounts for less than 30% of total volume, mixed routing saves more than half compared with sending everything through the speed tier.
Context Caching: An Underrated Cost Lever
The three cache billing columns in the table deserve a closer look:
- Cache hit (¥1.30/MTok): when a request’s prefix exactly matches cached content, that portion of input is billed at the hit rate—just 1/10 of the standard input price.
- Cache write (5min): the first write costs the same as standard input, and the cache is valid for 5 minutes.
- Cache write (1h): the write costs 2x standard input, but the cache is valid for 1 hour.
What belongs in a cached prefix?
- Long system prompts: fixed prefixes containing role definitions, rule constraints, and few-shot examples;
- Large knowledge documents or codebase context: reference material repeatedly cited in RAG scenarios;
- Multi-turn conversation history: in multi-turn sessions, earlier turns naturally form a stable prefix.
Estimating cache hit savings
Consider a typical RAG application: system prompt plus reference documents total about 50K tokens, processing 1,000 requests per day. Without caching, the input cost for that 50K prefix alone is:
50,000 × 1,000 × 13 / 1,000,000 = ¥650/day
If the prefix is stable and the cache hit rate reaches 90%, the cost drops to roughly:
50,000 × 1,000 × (0.9 × 1.3 + 0.1 × 13) / 1,000,000 ≈ ¥124/day
That’s a savings of over 80%. For applications with highly stable prefixes—customer support bots, coding assistants—context caching is the highest-ROI optimization available, often beating even a version upgrade.
Choosing a write tier
The 5-minute tier suits high-frequency, consecutive calls (e.g., live sessions); the 1-hour tier suits scenarios with longer call intervals but high prefix reuse (e.g., periodic batch jobs). If call intervals are unpredictable, start with the 5-minute tier, monitor the hit rate, and then decide whether upgrading to the 1-hour tier makes sense.
Engineering Best Practices
Based on these billing rules, here are some actionable recommendations:
- Structured prompt design: put static content (system settings, rules, examples) at the beginning of the prompt and dynamic content (user input, retrieved results) at the end, maximizing cached prefix length and hit rate.
- Output length control: explicitly request structured output such as JSON in prompts, and set reasonable max output token limits to keep output-side costs under control.
- Monitoring and attribution: log input/output/cache-hit token counts for every call at the application layer, attribute costs by business module, and identify “cost black holes” (e.g., a high-frequency endpoint whose prefix changes every time, so the cache never hits).
- Smooth version upgrades: leverage the new version’s price advantage over the old one, upgrade via canary rollout, and run regression tests on output quality to confirm capability parity before full migration.
- Parameterized routing: make tier selection a configuration item adjusted dynamically based on latency SLAs, rather than hardcoding it into business logic.
Conclusion
LLM API pricing is becoming increasingly granular: version iterations push unit prices down, dual tiers separate latency requirements, and caching rewards prefix reuse. For developers, understanding these billing rules—and designing prompt structure, call routing, and caching strategy accordingly—can compress inference costs by 50% or more without sacrificing quality. Cost optimization isn’t a one-time decision; it’s an ongoing engineering practice that spans the entire application lifecycle.
