LLM Token Billing Models Compared: A Practical Cost Calculation Guide
This article explores the core dimensions of large language model (LLM) token billing and establishes a reusable cost calculation framework. It provides a detailed comparison of fixed-rate, tiered, cache-tiered, and batch processing pricing models, along with a selection checklist, to help developers and architects optimize costs based on their specific API usage patterns.
LLM Token Billing Models Compared: A Practical Cost Calculation Guide
1. Why “Who is the Cheapest” is a False Proposition
When evaluating LLM services, many teams immediately look at the “price per million tokens.” However, in real production environments, the final bill is rarely determined by a single unit price. A single request might include system prompts, conversation history, retrieved documents, tool call results, and output content. Different businesses have vastly different input-output ratios, cache hit rates, context lengths, concurrency levels, and retry strategies. Consequently, the same pricing table can yield entirely different cost rankings under different usage patterns.
A more appropriate question is: Which token billing model best matches a given usage pattern? For example, businesses with high output proportions should prioritize output unit prices and maximum output length controls. Long-document QA should focus on tiered pricing and cache hit rates. Offline batch processing tasks can tolerate higher latency in exchange for discounts. High-frequency, multi-turn customer service should rigorously evaluate cache writes, cache hits, and cache TTLs.
This article does not recommend specific vendor pricing. Instead, it deconstructs token billing dimensions from a general technical perspective, builds a cost calculation model, and provides example bills and a selection checklist. Actual selection should be based on publicly available platform billing documentation, billing details, and real stress test data.
2. Six Core Dimensions of Token Billing
1. Separate Input and Output Pricing
Most LLM services price input tokens and output tokens separately, with output tokens typically costing more. This is because the output phase involves token-by-token decoding, which incurs higher compute and bandwidth costs. Therefore, the output proportion is a key lever in cost calculation.
Assume a request has input I, output O, input unit price P_in, and output unit price P_out. The base cost can be expressed as:
C = I × P_in + O × P_out
If a business generates long outputs (e.g., report generation, code generation, long-text summarization), output costs may dominate even if the input unit price is very low. Conversely, for tasks with short outputs (e.g., classification, extraction, Retrieval-Augmented Generation (RAG) QA), input costs take up a larger share.
2. Tiered Pricing and Granularity
Some billing models divide tiers based on the number of input tokens per request, where longer inputs incur higher unit prices. Others divide tiers based on cumulative usage over a billing period. Three things need to be confirmed:
- Whether tiers are calculated per request or cumulatively over a billing period;
- Whether crossing a tier results in the “entire amount being charged at the highest tier” or “progressive segmented pricing”;
- Whether tier boundaries include the boundary value, and whether the rounding unit is 1K, 1M, or another granularity.
Tiered pricing significantly impacts long-context requests. A request with 500K input tokens might fall into the highest tier, causing the overall input cost to rise non-linearly. If a platform uses progressive pricing, the cost curve is smoother. The two cannot be roughly estimated using the same formula.
3. Cache Hits, Cache Writes, and Storage Fees
Caching mechanisms are typically used to reuse stable prefixes, such as fixed system prompts, long-document backgrounds, and multi-turn conversation history. Billing may involve three types of fees:
- Cache write fee: Charged at input token rates or a separate unit price when initially establishing the cache;
- Cache hit fee: The cached portion enjoys a discounted unit price;
- Cache storage fee: Charged based on occupied cache capacity and duration.
Assume the cached portion of the input is H, the uncached portion is I-H, the cache hit unit price is P_hit, the cache write is W, and the write unit price is P_write. The cost can be written as:
C = (I-H) × P_in + H × P_hit + W × P_write + O × P_out + storage_fee
Whether caching is cost-effective depends on the hit rate, cache write frequency, TTL, and business request intervals. If the cache hit rate is very low, or cache write fees are high, a cache-tiered approach may not outperform a fixed-rate approach.
4. Batch Processing and Asynchronous Discounts
Offline tasks, batch summarization, and data cleaning are latency-insensitive and can use asynchronous batch processing in exchange for lower unit prices. When calculating costs, you cannot just look at the unit price discount; you must also consider queueing time, task failure retries, result storage, and scheduling costs. For online interactive businesses, batch processing is usually not applicable.
5. Minimum Billing Units and Rounding Rules
Different platforms may round at the request level, per-thousand tokens, or per-million tokens. When there are many short requests, rounding rules can significantly impact the bill. For example, if each request actually uses 120 tokens but is rounded to 1K, the effective unit price is amplified. Businesses with high-frequency short requests should pay special attention to this.
6. Retries, Tool Calls, and Multimodal Surcharges
Failed retries result in duplicate billing. Tool calls, multimodal inputs, retrieval services, and fine-tuning hosting may also incur additional fees. Cost calculation should factor retry rates, average call rounds, and additional services into the model, rather than just calculating a single successful request.
3. A Reusable Cost Calculation Model
Below is general pseudocode for estimating costs per request. In practice, you need to adjust the tier calculation method, whether cache writes are included in the input, and whether storage is charged separately based on platform rules.
function estimate_cost(request, plan):I = request.input_tokensO = request.output_tokensH = min(request.cache_hit_tokens, I)M = I - HW = request.cache_write_tokens# If the platform prices the entire request by tier, pass I;# If it uses progressive tiers, accumulate internally by segment.input_cost = tier_price(M, plan.input_tiers)hit_cost = H * plan.cache_hit_pricewrite_cost = W * plan.cache_write_priceoutput_cost = O * plan.output_pricestorage_cost = request.cache_storage_gb_hour * plan.storage_pricereturn input_cost + hit_cost + write_cost + output_cost + storage_cost
Furthermore, the monthly cost can be estimated as:
Monthly Cost = Request Count × Average Cost Per Request × Retry Multiplier + Cache Storage Fee + Additional Service Fees
The retry multiplier can range from 1.05 to 1.3, depending on service stability and retry strategy. It is recommended to keep a buffer of about 20% in the budget for peak traffic, output length fluctuations, and pricing strategy changes.
4. Example Bill: Comparing Scenarios with the Same Data
Assume a business has the following API usage structure within a billing cycle: Input 509.8K tokens, Output 8.125K tokens, Cache Write 467.3K tokens. To demonstrate the calculation method, fictitious parameters are used to construct four billing models. All prices are solely for illustrating the calculation process and do not represent any real platform quotes.
| Model | Billing Feature | Assumed Parameters | Cost Calculation | Result |
|---|---|---|---|---|
| Model A | Fixed rate | Input 6 units/M, Output 24 units/M | 0.5098×6 + 0.008125×24 | 3.2538 units |
| Model B | Tiered, long input at higher tier | Input 8 units/M, Output 32 units/M | 0.5098×8 + 0.008125×32 | 4.3384 units |
| Model C | Cache-tiered, 80% hit rate | Uncached input 6 units/M, Hit 0.8 units/M, Output 24 units/M, Write 1 unit/M | 0.10196×6 + 0.40784×0.8 + 0.4673×1 + 0.008125×24 | 1.6003 units |
| Model D | Offline batch | Input 5 units/M, Output 20 units/M | 0.5098×5 + 0.008125×20 | 2.7115 units |
As shown in the example: if the cache hit rate stably sits at 80% and cache write fees are controlled, Model C is clearly superior. If the cache hit rate is very low, Model C’s cost will rise quickly, potentially approaching or exceeding the fixed-rate model. Model B has the highest single-request cost because the long input falls into a higher tier. Model D is suitable for offline tasks but not for low-latency online interactions.
This example highlights a key conclusion: You cannot simply rank different billing models as “A is better than B.” Instead, you must apply your usage structure to the formula and calculate each individually. It is especially crucial to confirm whether cache writes are already included in the input tokens. If cache writes are included in the input, they should not be billed again; if billed separately, you must include W × P_write.
5. Comparison of Four Billing Models
1. Fixed Rate: Best Predictability
The advantage of a fixed-rate model is predictable billing and a simple budget model. It is suitable for businesses with stable input/output lengths, low cache reuse rates, and predictable request volumes. The downside is that it may not offer discounts for long contexts or high cache reuse. For businesses with high output proportions, focus on controlling maximum output length, reducing invalid retries, and using structured output to cut redundant content.
2. Tiered Pricing: Friendly for Short Requests, Caution for Long Contexts
Tiered pricing usually encourages short requests and charges higher unit prices for long input requests. It is suitable for tasks with short prompts, short contexts, and stable outputs. If a business must process long documents, evaluate chunking, summary compression, RAG, and segmented processing. However, splitting requests increases call counts and repeated contexts, so do not blindly split. The decision criterion is:
Total Cost After Split = Σ Input Cost Per Chunk + Σ Output Cost Per Chunk + Extra Scheduling and Repeated Context Cost
Splitting is only worthwhile if the reduced cross-tier premium exceeds the new overhead.
3. Cache-Tiered: A Weapon for High-Reuse Scenarios
Cache-tiering is suitable for fixed system prompts, long-document QA, multi-turn customer service, and coding assistants. Core metrics are cache hit rate, cache write frequency, and cache TTL. Optimization methods include keeping prefixes stable, placing variable content later, minimizing frequent changes to system prompts, grouping caches by business, and monitoring hit rates and per-request costs. If cache write fees are high, try to merge initial writes to avoid frequent cache rebuilds.
4. Batch Processing: A Cost Option for Offline Tasks
Batch processing is suitable for latency-insensitive tasks like log analysis, batch summarization, data labeling, and offline content generation. When calculating costs, factor in queueing waits, failure retries, result storage, and scheduling. For online businesses, batch processing is usually only a supplementary capability, not a replacement for low-latency APIs.
6. Selection and Governance Checklist
During actual selection, follow these steps to build a calculation sheet:
- Confirm Billing Rules: Input/output unit prices, tier granularity, cache read/write rules, rounding units, whether retries are billed, and whether there is a minimum spend.
- Collect Usage Patterns: P50/P95 input lengths, output lengths, output proportions, cache hit rates, request counts, peak concurrency, and retry rates.
- Build a Cost Model: Use real, anonymized samples in the formula to calculate fixed, tiered, cache, and batch models separately.
- Perform Sensitivity Analysis: Focus on testing changes in cache hit rates from 0 to 90%, the impact of a 50% increase in output length, and cost jumps when long inputs cross tiers.
- Set Budgets and Alerts: Monitor per-request costs, average input/output, cache hit rates, output truncation rates, and monthly budget consumption.
- Optimize Continuously: Compress prompts, stabilize cache prefixes, limit max output, merge batch processes, route tasks to different models, and implement retry backoff.
- Verify Compliance and Stability: Data regions, log retention, quota limits, SLA, and failover strategies also impact the total cost of ownership.
When selecting LLM services on platforms like Baidu AI Cloud or other cloud providers, you can continuously calibrate your cost model using usage monitoring, billing details, and budget alerts. Specific pricing, billing granularity, and caching rules should be verified against official documentation and actual bills. The same verification method applies to any other cloud vendor or platform to avoid making decisions based solely on promotional unit prices.
7. Conclusion: The Best Model Matches Your Usage Pattern
Returning to the question of “who is the best,” the answer is not a fixed ranking, but a conditional judgment:
- High output proportion: Prioritize output unit prices and control maximum output length.
- High input repetition rate: Prioritize evaluating cache hit discounts and cache write costs.
- Frequent long-context requests: Focus on calculating tier levels; use summarization, retrieval, or chunking if necessary.
- Many offline tasks: Batch processing discounts may be more cost-effective.
- Budget-sensitive with stable traffic: Fixed rates plus budget alerts are easier to manage.
- High-frequency short requests: Pay attention to minimum billing units and rounding rules.
Therefore, the correct approach to comparing token billing models is: first establish your usage pattern, then confirm the billing rules, and finally calculate the total cost using formulas and real samples. Only by incorporating input, output, caching, tiers, retries, and additional services into your model can you determine which model is best for your current business—and you should continuously re-evaluate as your usage structure changes.
