The Economics and Engineering of Peak and Off-Peak Pricing for LLM APIs
This article explains why peak and off-peak pricing for large model APIs is a return to marginal cost rather than a simple price increase, and why cache billing is the most sensitive variable in agent workloads. It covers the supply and demand logic behind time-of-day pricing, a cost model based on input tokens, output tokens, cache hit ratio and time-based price coefficients, and five engineering practices such as prefix normalization, cache-friendly segmentation, batch scheduling, context governance and cost observability. The goal is to help developers control unit business cost through higher prefix reuse, smaller context growth and off-peak scheduling.
1. The Phenomenon: Why a “Mild” Price Change Has an Outsized Impact
A cloud provider made a structural change to its LLM API billing and introduced time-of-day peak and off-peak pricing. On the surface, the changes to input and output unit prices were limited. The variable that was actually amplified was cache-related billing.
The reason is that in AI agent scenarios, a request is not a single question-and-answer exchange. It is a long chain of calls repeatedly assembled from “system prompt + tool definitions + conversation history + current instruction.” Almost the same prefix is sent again on every turn, and caching exists precisely to eliminate that repeated computation.
One key observation in the original discussion is that before the change, cache prices for the high-capability tier were nearly the same as those for the low tier, which is “abnormal” from a cost logic standpoint. After the change, the price gradient was restored to a shape that matches compute usage, which is actually more “normal.” The engineering implication is direct: if your system relies heavily on prefix caching, every change in the cache unit price is amplified by the number of calls into a noticeable change on the bill.
2. The Economics: Peak and Off-Peak Pricing Is a Return to Marginal Cost, Not a Price Hike
2.1 Compute Supply Is Rigid Within a Day
The GPUs, GPU memory and network bandwidth of an inference cluster cannot expand elastically in the short term, while demand is highly concentrated within a day. The supply curve is nearly vertical and the demand curve shifts left and right, so the equilibrium price naturally forms peaks and troughs. Peak and off-peak pricing makes this supply-demand gap explicit and uses price signals to shift demand over time.
2.2 The Peak and Off-Peak Spread Is Price Discrimination Along the Time Dimension
The same token consumes scarce resources during peak hours, so its opportunity cost is higher. During off-peak hours, resources sit idle and the marginal cost is close to zero. For users, this is a self-selected “trade time for price.” For the provider, it is a pricing mechanism that improves resource utilization and spreads fixed costs. This is the same principle as off-peak mechanisms in electricity and rail transit.
2.3 Why Cache Pricing Is the Most Sensitive
A cache hit eliminates repeated prefix computation, which is a typical “high fixed cost, low marginal cost” resource. Cache capacity and lifecycle themselves consume GPU memory and storage, so its price must reflect “occupation cost” and cannot stay level with the low tier for long. Once the price gradient is corrected, cache goes back from being a “nearly free acceleration option” to a “cost item that needs careful management.”
2.4 The Real Usage Rhythm of the Demand Side Shapes the Peaks and Troughs
Based on publicly available usage structure, the main load for this kind of service comes from Chinese-speaking developer groups. Their working rhythm is roughly two concentrated periods in the morning and afternoon, with limited effective working hours per day, but more days covered per week. This means the intraday double-peak shape is clear, while weekends do not constitute a real trough. So the room for shifting load mainly falls at night and in the early morning, not on weekends.
3. A Cost Model: Writing the Bill as a Computable Formula
Let the input tokens of a single request be T_in, the output tokens be T_out, the cacheable prefix ratio be r, the coefficient of the cache hit unit price relative to the input unit price be k, and the time-of-day price coefficient be p. The cost of a single call is approximately:
cost = p * ( T_in * (r * k + (1 - r)) * price_in + T_out * price_out )After summing over total call volume N: total = Σ cost_i
Three conclusions can be applied directly:
- r is the first lever: moving stable prefixes such as system prompts, tool schemas and long documents to the front and fixing their order can significantly improve the hit rate.
- Changes in k are amplified by N: in agent scenarios, N is often tens of times that of ordinary question answering, so a small adjustment in the cache unit price is multiplied into a clear difference.
- p is a controllable variable: moving non-real-time tasks to off-peak hours is equivalent to applying a direct discount to
total.
4. Engineering Practice: Five Optimization Paths You Can Apply Immediately
- Prefix normalization: templatize prompts, put stable content first and dynamic content later, and avoid letting volatile fields such as timestamps and random IDs pollute the prefix.
- A cache-friendly segmentation strategy: split long context into a “stable segment + incremental segment” and reuse only the stable segment to reduce ineffective recomputation.
- Batching and asynchrony: schedule tasks such as offline summarization, batch labeling and regression evaluation into off-peak windows, using queues and task scheduling to handle them.
- Context governance: apply summarization and compression and retrieval-based recall to historical turns to control the linear growth of
T_in, which is the main cause of runaway cost in long agent sessions. - Cost observability: instrument three dimensions — business line, time of day and cache hit rate — and build a cost dashboard with logging services and monitoring alerts, with budget thresholds and circuit breaking.
Illustrative strategy pseudocode:
def schedule(task):if task.is_realtime:return run_now(task) # Real-time path, accept peak pricingreturn enqueue(task, window="valley") # Non-real-time task, run off-peak
5. Architecture Advice: Make “Billing Elasticity” a Platform Capability
On a platform-style technology stack such as Baidu AI Cloud, the strategies above can typically be handled by combining general-purpose capabilities: a message queue for load leveling and off-peak scheduling, a container platform for an elastically scaling inference front layer, object storage for reusable context and evaluation sets, and logging services with monitoring alerts for cost attribution. The key is to elevate “time of day” and “cache hit rate” to first-class metrics rather than looking at the bill after the fact.
6. Conclusion
Peak and off-peak pricing is an inevitable result of the supply and demand for compute along the time dimension, and the return of cache billing to a reasonable gradient is a correction of the cost structure. For developers, the real response is not to look for a cheaper unit price, but to increase prefix reuse, compress context growth and move non-real-time workloads to off-peak hours. If you do these three things, unit business cost remains controllable even after a pricing structure change.
