LLM Token Pricing and Peak-Off-Peak Billing: A Practical Guide
This guide explains how large language model (LLM) billing works and how engineering teams can control costs. It covers token-based metering, input versus output pricing, cache-hit discounts, and peak/off-peak time-of-use pricing, along with a practical cost governance loop of metering, attribution, optimization, scheduling, and alerting. Readers will learn how to estimate token usage, structure prompts to improve cache hit rates, defer batch workloads to off-peak hours, and avoid common cost estimation mistakes.
1. From Upfront Investment to Pay-Per-Use: A Structural Shift in Cost Expectations
Historically, the high cost of AI services came from three sources: large-scale R&D investment, the compute resources required for training and inference, and the price charged for external API calls. Together, these created a de facto barrier to entry. As model architectures improved and engineering efficiency increased, the market has come to accept a new view: high-level intelligent services and high prices are not necessarily bound together.
Public industry research shows that for models reaching a given capability benchmark, the price per million tokens dropped by roughly two orders of magnitude within two years. As prices fell quickly, competition shifted from “can it be built” to “how to lower the barrier to use.” The two most engineering-relevant mechanisms are precise per-token metering and time-based differentiated pricing. The former makes costs attributable; the latter makes costs schedulable.
2. Tokens: The Unit of Measurement for Intelligent Services
A token is the smallest unit into which a model splits text. Chinese, English, and code have different splitting densities, so cost cannot be estimated by “word count.” In practice, three rules of thumb usually apply:
- Chinese is roughly 1 token per Chinese character; English is roughly 1 token per 4 characters.
- Structured text (JSON, logs, code indentation) is split more finely, resulting in a higher token count.
- Billing usually distinguishes input (prompt) from output (completion), and the output unit price is higher than the input price.
Illustrative estimation code:
def estimate_cost(input_tokens, output_tokens,in_price, out_price):# Price unit: CNY per million tokensreturn (input_tokens * in_price +output_tokens * out_price) / 1_000_000
3. Cache-Hit Pricing: Turning Repeated Context into a Discount
Mainstream billing schemes split the input price into two tiers: “cache hit” and “cache miss,” where the hit price is usually far lower than the miss price. The principle is that when a request prefix matches already-cached content, the server can reuse intermediate computation results and save repeated compute.
Key practices:
- Place stable content such as system prompts, tool definitions, and long documents at the very front of the prompt to keep the prefix stable.
- Avoid inserting volatile fields such as timestamps or random IDs into the stable prefix.
- In multi-turn conversations, keep the history order unchanged and only append new content.
- Submit batch tasks grouped by “same prefix” to improve the hit rate.
4. Peak-Off-Peak Time-of-Use Pricing: Aligning Load with Price
Time-of-use pricing divides a day into peak and idle periods. The idle-period price is usually half of the peak price. Peak intervals are clearly defined (for example, several hours in the morning and afternoon on workdays), while all other times, weekends, and public holidays use the idle price. This essentially brings the load-scheduling thinking of the power industry into compute supply: using price signals to shift deferrable loads.
Distinguishing deferrable from non-deferrable tasks:
- Deferrable: offline summarization, batch labeling, data cleaning, regression evaluation, log analysis.
- Non-deferrable: online customer service, real-time risk control, interactive code completion.
Scheduling strategy example:
def schedule(task, now, peak_hours):if task.deferrable and now in peak_hours:return queue_for_offpeak(task) # Run during off-peak hoursreturn run_now(task) # Run immediately
5. The Engineering Loop of Cost Governance
- Metering: For each call, record input/output tokens, cache-hit status, time-period labels, and business identifiers.
- Attribution: Aggregate by business line, scenario, and user dimension to locate high-consumption sources.
- Optimization: Compress prompts, trim context, cap maximum output length, and split routing between large and small models.
- Scheduling: Migrate batch tasks to idle periods, and set a daily token budget with a circuit breaker for overages.
- Alerting: Set monitoring and alerting thresholds for per-request cost, cache hit rate, and peak/off-peak ratio.
6. Common Pitfalls
- Looking only at unit price and not hit rate: cache optimization often saves more than switching models.
- Using word count instead of token estimation, leading to budget deviations.
- Treating long context as free context; input cost grows linearly with length.
- Ignoring output length control; the output unit price is higher, and long outputs are a major cost source.
7. Conclusion
When intelligence is fitted with a “meter” like electricity, cost shifts from a vague black box into an observable, optimizable engineering metric. What enterprises truly need to build is not cheaper calls, but a closed-loop capability of “metering—attribution—optimization—scheduling—alerting.” Built on top of general-purpose cloud platform capabilities such as containers, message queues, object storage, and monitoring and alerting, this loop can be implemented smoothly, keeping the unit cost of intelligence continuously under control.
