The Economics and Engineering of Peak and Off-Peak Pricing for LLM APIs

    This article breaks down why cloud providers are shifting LLM API billing from a single price list to a two-dimensional model based on time of day and cache state. It explains the load-scheduling economics behind peak and off-peak pricing, why cache pricing is being recalibrated for AI agent workloads, and how to express the resulting bill as a formula. Six practical engineering actions cover prefix normalization, layered session context, off-peak scheduling, observability, budget guardrails, and two-dimensional capacity planning, followed by common pitfalls to avoid.

    1. Framing the Change: From a Single Price List to a Two-Dimensional Model of Time and Cache

    A cloud provider recently adjusted its LLM API pricing, introducing peak and off-peak rates by time period and recalibrating cache-related billing items. Treating this as a simple price increase or decrease misses the real information content. A more accurate framing is that the billing model has moved from one dimension, unit price times usage, to two dimensions, unit price(time period, cache state) times usage. Cost is therefore no longer determined by business volume alone; it is also shaped by when requests arrive and how well context is reused.

    From an engineering standpoint, this expands the dimensions along which cost must be observable. Capacity and budget planning used to require only an estimate of average daily call volume and average input and output length. Two additional distributions are now required: how request volume is distributed across time periods, and how the prefix context hit rate is distributed across those same periods. Without both distribution charts, any budget is only a rough guess.

    2. Economic Rationale One: Peak and Off-Peak Pricing Is Load Scheduling

    Peak and off-peak pricing is not unique to the AI industry. It is a mature mechanism long used in electricity, rail transit, and telecom bandwidth. Its economic basis rests on two points.

    First, short-term supply is rigid. Inference cluster capacity cannot scale linearly with instantaneous traffic in the short term, because expansion carries delays for procurement, deployment, and warm-up. Second, demand is concentrated in particular time periods. When many users submit requests in the same window, the system must provision redundant capacity for the peak, and that capacity sits idle during the trough.

    A single flat price creates two distortions at once: during peak hours the price sits below true marginal cost, driving overconsumption and queuing; during off-peak hours the price sits above marginal cost, leaving resources idle. Peak and off-peak pricing uses a price signal to push deferrable demand into the trough, shaving the peak and filling the valley to raise overall utilization. For users, this converts waiting, a non-price cost, into a cost tier they can choose for themselves.

    It is worth stressing that load is not simply a matter of day and night. The source material notes that a platform’s main user base is concentrated in the Chinese-speaking region, with a pattern of two working periods in the morning and afternoon, roughly seven working hours per day, and activity across all seven days of the week. That structure directly determines the shape of the peak and off-peak curve: twin peaks appear in the morning and afternoon work blocks, a clear dip occurs around midday, night falls into the trough, and the weekend curve flattens so the peak-to-trough spread narrows. In other words, the same pricing rules leave completely different optimization room under different regional and working-culture conditions.

    3. Economic Rationale Two: Why Recalibrating Cache Pricing Is a Return to Normal

    The most important judgment in the original material is that the variable truly being amplified is the cache item, not input and output unit prices. This holds especially in AI agent scenarios.

    The typical agent call pattern is a long, stable prefix plus short, changing increments. System prompts, tool definitions, conversation history, and retrieved reference material form a large block of repeated context, while each turn appends only a small amount of new content. Without cache billing, the provider must recompute the same prefix on every request, and that compute is pure duplication. If cache pricing sits close to regular input pricing, the cache mechanism loses almost all economic meaning: users have no incentive to optimize, and the provider cannot recover the cost of cache storage and consistency maintenance.

    Widening the gap between cache pricing and regular input pricing is therefore a correction that aligns the price structure with actual resource consumption. The signal it sends is clear: reusable context is a shared resource, and recomputing it is waste. For developers, this is a rule where better discipline means lower cost, not simply bad news.

    4. Cost Model: Writing the Bill as a Formula

    Let p_c be the cache hit unit price in a given period, p_i the miss input unit price, p_o the output unit price, h the hit rate, I the number of input tokens, and O the number of output tokens. The cost of a single request in that period is:

    1. cost = I * (h * p_c + (1 - h) * p_i) + O * p_o

    Under peak and off-peak pricing, p_c, p_i, and p_o are all functions of the time period t. Three corollaries follow:

    1. Cost sensitivity to h depends on (p_i - p_c). The wider the spread, the greater the payoff from raising the hit rate, which turns cache governance from an optional optimization into a mandatory one.
    2. When p_c is raised, a blanket cache-everything strategy may no longer pay off, so eviction and selective caching become necessary.
    3. The total bill is a weighted sum of per-period cost over the request distribution, which makes peak shaving and hit-rate improvement two multiplicative levers.

    A schematic policy check can be written as:

    1. def should_cache(prefix_tokens, hit_prob, p_i, p_c, p_store):
    2. # Expected saving = hit probability * price spread * token count
    3. saving = hit_prob * (p_i - p_c) * prefix_tokens
    4. return saving > p_store # Compare against cache storage and maintenance cost

    5. Implementation: Six Actionable Steps

    First, normalize the context prefix. Put stable content first and volatile content last so the prefix stays byte-for-byte identical; timestamps, random IDs, floating-point precision, and dictionary iteration order all break hits and should be handled uniformly at assembly time.

    Second, layer session context. Split system constraints and tool descriptions, long-term knowledge, and short-term dialogue into three layers, each with its own lifecycle and eviction policy, so short-term content does not pollute the long-term prefix.

    Third, schedule requests away from the peak. Move batch jobs, offline summarization, evaluation regressions, and data cleaning into off-peak windows, use a message queue for peak shaving and retries, and trade queue latency for a lower unit price.

    Fourth, close the observability gap. Instrumentation must capture time period, hit or miss, input and output length, and cache read and write latency, producing hourly hit-rate and cost dashboards; without them, optimization effects cannot be verified.

    Fifth, set budgets and circuit breakers. Define quotas and alert thresholds separately for peak and off-peak periods, and automatically fall back to smaller context or a lower-cost tier during peak windows.

    Sixth, plan capacity and cost on two dimensions. Use off-peak sustainable throughput as the baseline capacity and tolerable peak queuing time as the elastic ceiling, avoiding long-term waste from provisioning purely for the peak.

    6. Common Pitfalls

    The first is looking only at unit price and not at structure. A 20% change in unit price may move the bill by only 5%, while raising the hit rate from 0.4 to 0.8 often has a larger effect. The second is treating the cache as free storage and retaining unlimited history, which instead incurs high storage and consistency costs. The third is ignoring regional working-hour differences and copying another region’s off-peak schedule directly. The fourth is doing a one-off optimization with no ongoing dashboard, so cost quietly climbs back as the business evolves.

    7. Conclusion

    Peak and off-peak pricing together with cache price recalibration are, in essence, a way of using price signals to make compute, a resource that is rigid in the short term, used more efficiently. For developers, this partly returns control over cost to the quality of the engineering implementation. Building models, dashboards, and scheduling strategies around the two main threads of time-period distribution and prefix hit rate turns a change in billing rules into a stable, reproducible cost benefit. On top of that, using the general-purpose container platform, message queue, and monitoring and alerting capabilities offered by Baidu AI Cloud to carry the scheduling and observability pipeline can further reduce self-built cost, letting optimization focus on context governance itself.