Five-Fold LLM Price Increase: How to Calculate and Reduce Inference Costs
This article explains how to calculate the cost of each LLM API call under per-million-token pricing, why inference costs rise with model size and context length, and how to reduce spending through cache hits, model selection, and cost monitoring. It includes a worked example and a practical rollout plan.
1. Looking at the Pricing
According to the source material, the model is priced at 100 CNY per million output tokens, 20 CNY per million input tokens, and 1 CNY per million tokens for cache hits. The output-to-input price ratio is 5:1, and the cache-hit price is one-twentieth of the uncached input price. The source material states that both input and output prices rose about fivefold compared with the previous generation. Check the exact previous prices on the official pricing page, because pricing bases may differ across periods. All calculations in this article use the prices above.
2. Technical Reasons Behind the Price Increase
Three factors mainly determine LLM pricing: model scale and architecture, the compute and GPU memory consumed during inference, and the provider’s judgment of market supply and demand. This article does not speculate about the model’s parameter count. It only discusses general mechanisms.
For a Mixture-of-Experts (MoE) model, two numbers matter. The total parameter count determines the size of the weights that must be loaded into GPU memory. The active parameter count determines how much computation each token actually uses. These two values do not grow in lockstep, but both raise costs.
A rough estimate of weight memory is: weight memory ≈ parameter count × bytes per parameter. For a model with 1 trillion parameters, FP8 precision requires about 1 TB, and FP16 requires about 2 TB. These figures exclude the KV Cache (key-value cache) and activation values. Larger models need more GPUs, and communication between GPUs adds overhead. As effective throughput per GPU drops, the cost per unit rises.
Longer context windows also increase KV Cache memory use. This reduces the number of requests a single GPU can serve at once, which also appears in the price. If the provider invests in cache systems and scheduling logic, those development costs are also reflected in pricing.
3. Calculating the Cost of a Single Call
The formula is:
Cost per call = input tokens × input price ÷ 1,000,000 + output tokens × output price ÷ 1,000,000
Consider a call with 500 input tokens and 1,000 output tokens, where the input misses the cache:
- Input: 500 × 20 ÷ 1,000,000 = 0.01 CNY
- Output: 1,000 × 100 ÷ 1,000,000 = 0.1 CNY
- Total: about 0.11 CNY
If all 500 input tokens hit the cache, the input cost becomes 500 × 1 ÷ 1,000,000 = 0.0005 CNY. The total is about 0.1005 CNY, a reduction of about 9%. Cache hits apply only to input. Output tokens are still billed at the output price.
This example shows that output is the main cost under this pricing. Caching delivers larger savings when inputs are longer. Assume 5,000 input tokens and 1,000 output tokens. Without a cache hit, the input cost is 0.1 CNY and the total is 0.2 CNY. With a full cache hit, the input cost is 0.005 CNY and the total is 0.105 CNY, which nearly halves the cost. Caching works best for long, repeated prefixes. Controlling output length is a more direct way to save money.
4. Choosing Models by Task Type
Call frequency, output length, and quality requirements vary widely across tasks, so the right model differs for each.
| Task type | Typical characteristics | Recommended approach |
|---|---|---|
| High-frequency, low-value tasks (classification, sentiment analysis, keyword extraction) | High call volume, short outputs | Use a lightweight model or a rule-based engine |
| Low-frequency, high-value tasks (complex code generation, solution design, key reports) | Few calls, high quality requirements | Use a large model and focus on evaluating output quality |
| Long-context tasks (document Q&A, codebase understanding) | Long inputs, reusable prefixes | Keep a fixed prefix and use caching fully |
| Multi-turn conversations | Conversation history repeats across turns | Keep the session continuous and avoid rebuilding the full context on every turn |
To decide whether a task justifies a large model, check three conditions. First, the labor time the large model saves, multiplied by labor cost, must exceed the call cost. Second, output quality must meet business requirements. Third, the extra cost of retries and human review must be manageable. If any condition fails, consider moving to a smaller model or keeping a manual process.
5. Making Caching Work
Cache hits are the most overlooked way to save money. The main practices are:
- Place the system prompt, tool definitions, and fixed business context at the start of the request, and put dynamic content after them.
- Keep the prefix identical at the byte level. Timestamps, random IDs, or user-specific information in the prefix will invalidate the cache.
- Wrap requests in a shared gateway template so that different services do not build prompts separately and create inconsistent prefixes.
- Keep multi-turn sessions continuous instead of rebuilding the entire history on every turn.
- The minimum prefix length, expiration time, and hit rules vary by provider. Confirm each one in the official documentation.
- Track the actual cache hit rate in logs. A low hit rate wastes savings, no matter how low the list price is.
6. Setting Up Cost Monitoring
Without monitoring, you cannot tell whether an optimization works. Record at least the following fields for each call:
- Call date, model name, and task type
- Input tokens, output tokens, and cache-hit tokens
- Number of retries
- Cost of the call
- Output quality score, from manual spot checks or automated evaluation
Each month, review three metrics. The first is the cache hit rate, which shows whether the prefix design works. The second is average output length, which largely determines most of the cost. The third is the retry rate. Retries are billed again, so a 10% retry rate raises the average cost by roughly 10%.
7. Price Trends and Usage Risks
LLM prices may change for several reasons, including lower inference hardware costs, model distillation that lets mid-sized models approach the performance of large models, improvements in inference efficiency, and competition among providers. The timing and size of each effect are hard to predict.
Developers should follow two practical principles. First, do not hardcode today’s prices or model names in code. Make model selection, unit prices, and routing rules configurable. Second, when a smaller model with similar results appears and passes evaluation, move the matching tasks to it. Conversely, if a new model delivers a real capability gain and the quality benefit exceeds the added cost, continuing to use it is also reasonable.
Prices cited in this article come from the source material. Check the official pricing before using them.
8. Suggested Rollout Steps
Proceed in the following order:
- Select two or three representative task types for a small-scale trial.
- Route real traffic through the setup and record costs, cache hit rates, and output quality.
- Compare the large and small models on the same tasks, and calculate the combined cost per task.
- Based on the data, decide whether to switch fully, use tiered routing, or keep the current setup.
After a price increase, whether a model is worth using depends on the cost and quality per task, not on the unit price alone. Building the billing formula, cache design, and cost monitoring into your code lets a team respond quickly when prices change.
