Peak and Off-Peak Pricing for LLM APIs: A Practical Guide to Load Scheduling

    This article explains how peak and off-peak pricing works for large model inference APIs and why weekend discounts reflect a return to real supply and demand rather than a promotion. It breaks down a sample price structure with a flat 2x peak multiplier, shows which workloads are suitable for time arbitrage, and provides a minimal time-aware queue implementation with idempotency keys, deadlines, and observability. It also covers prefix caching and batching as higher-value cost levers, includes a cost calculation example, lists common mistakes, and ends with an action checklist.

    1. The Pricing Logic Behind the Change: Weekend Discounts Are a Return to Real Supply and Demand

    A large model inference platform added a rule on top of its existing peak/off-peak pricing: starting on a given date, weekends are no longer split into peak and off-peak periods and are billed at the off-peak rate all day. On the surface this looks like a “weekend perk,” but it is closer to a return of prices to the real supply-demand relationship.

    Understanding this requires looking at how peak periods are defined. The platform classifies part of the weekday daytime as peak, and the remaining hours plus nighttime as off-peak, with the off-peak unit price at roughly half the peak price. The peak window happens to cover the hours when enterprises and institutions are concentrated at work and need real-time responses; weekends, by contrast, are precisely when this rigid load is at its lowest.

    There is a clear counterintuitive point here. The common assumption is that weekends are the real AI usage peak: students are on break, individual developers catch up on their projects, and hobbyists experiment for long stretches. If compute demand were truly driven by the consumer side, weekends should be the most expensive. Instead, the platform classifies the entire weekend as off-peak, which shows that the pricing baseline is not scattered consumer requests but institution-level workloads that must return results in real time during weekday daytime. What gets discounted is the platform’s own idle hours, not the hours when the general public most wants to use it.

    This leads to a general conclusion: the essence of the peak/off-peak gap is time arbitrage, using price signals to move movable compute workloads from scarce windows to surplus windows. Only workloads that “can change their timing” can capture this benefit.

    2. Breaking Down the Price Structure: What a 2x Spread Means

    Take the public pricing structure of a certain class of lightweight models as an example (per million tokens, in CNY):

    Billing item Off-peak Peak Multiplier
    Cached input 0.05 0.10 2x
    Uncached input 1.5 3.0 2x
    Output 4.5 9.0 2x

    Three points are worth noting:

    1. The spread is a flat 2x, not a discount applied to only one class of tokens. This means optimization cannot focus only on input or only on output; the time of day has to be considered across the whole chain.
    2. The cached-input unit price is extremely low, about 30 times lower than uncached input. This suggests the first priority in cost optimization is always the hit rate, and only then the time window.
    3. Output is about 3 times more expensive than input (at the same off-peak price, 4.5 versus 1.5), so the payoff from suppressing redundant output length is often higher than from compressing prompts.

    Putting these three points together, cost is approximately:

    1. cost ≈ input tokens × input unit price × (1 - hit rate) loss
    2. + output tokens × output unit price
    3. + input tokens × hit unit price × hit rate
    4. (unit prices switch with peak/off-peak periods)

    3. Which Workloads Are Suitable for Time Arbitrage

    There is only one criterion: whether the result has a hard real-time constraint. This splits workloads into three categories.

    • Freely movable (highest payoff): offline batch summarization, log and ticket clustering, dataset cleaning and labeling, evaluation regression, batch translation, embedding rebuilds, weekly and monthly report generation. Delivering these a few hours later has no impact.
    • Partially movable: customer support suggestions, non-urgent code review, asynchronous AI agent tasks. The approach is to set an acceptable latency ceiling (such as 15 minutes) and queue at the edge of the window.
    • Not movable: online chat, real-time risk control, production alerting pipelines. These workloads should not sacrifice experience to save money; the right approach is to control context length and output length, not to shift timing.

    4. Scheduling Implementation: A Minimal Time-Aware Queue

    The core idea is to tag tasks as “deferrable” and have a scheduler decide, based on the current period, whether to run them immediately or enqueue them to wait.

    1. PEAK = {(9, 12), (14, 18)} # Peak windows (local time)
    2. def is_peak(ts, weekend_all_offpeak=True):
    3. if weekend_all_offpeak and ts.weekday() >= 5:
    4. return False
    5. hm = (ts.hour, ts.minute)
    6. return any(a <= hm < b for a, b in PEAK)
    7. def submit(task, now):
    8. if task.deferrable and is_peak(now):
    9. queue.push(task, run_at=next_offpeak(now)) # Defer to off-peak
    10. else:
    11. run(task) # Run immediately

    Three more things are needed in engineering practice:

    • Idempotency keys: after migration, retries may occur, so the write side must deduplicate to avoid duplicate billing and duplicate database writes.
    • Deadlines: set a deadline for each task; if deferring would exceed it, force execution during peak hours to prevent “saving money at the cost of breaking an agreement.”
    • Observability: report the period, token usage, and cache hit status as dimensions to the logging and monitoring/alerting system; only then can you verify whether the strategy actually saves money.

    5. Caching and Batching: Two Blades Worth More Than Time Windows

    Time arbitrage can cut cost by at most half, while raising the cache hit rate from 30% to 70% yields a comparable payoff in scenarios where input dominates. Practical points:

    • Put stable system prompts, tool descriptions, and long document prefixes at the very front of the request, and keep the prefix byte-for-byte identical to hit the prefix cache.
    • Avoid putting volatile content such as timestamps or random IDs in prompts; such fields will break the cache.
    • Merge requests for batch tasks to reduce repeated prefix transmission; for non-interactive scenarios, appropriately lower the output length limit.

    Illustrative pseudocode:

    1. prompt = [stable_system_prefix, stable_doc_context, volatile_user_input]
    2. # Keeping the first two segments stable → prefix cache hit; put the changing part at the tail

    6. A Cost Calculation Example

    Suppose an offline task needs to process 10 million input tokens and 3 million output tokens per day, with a 40% input cache hit rate.

    • All executed at peak: uncached input 6M × 3.0 / 1e6 = 18 CNY, cached 4M × 0.10 / 1e6 = 0.4 CNY, output 3M × 9.0 / 1e6 = 27 CNY, totaling about 45.4 CNY.
    • All moved to off-peak: about 22.7 CNY.
    • Moved to off-peak and raising the hit rate to 70%: about 13.5 CNY.

    This shows that time window × hit rate is a multiplicative relationship; only stacking the two produces an order-of-magnitude difference, and changing just one yields limited gains.

    7. Common Mistakes

    1. Interpreting the weekend discount as demand-side peak having passed. The real reason is the absence of institutional load; scattered consumer-side requests are not enough to support peak pricing.
    2. Adding latency to all tasks to save money. Once an interactive path times out, the experience loss far exceeds the money saved.
    3. Ignoring the cache being broken by volatile fields. In that case, no amount of shifting time windows will bring the bill down.
    4. Not doing bill attribution. Without a usage view split by business and by task type, there is no way to start optimizing.

    8. Action Checklist

    1. Inventory existing calls and label each task type with its real-time level and deadline;
    2. Integrate time-aware scheduling so deferrable tasks are automatically postponed;
    3. Restructure prompt structure, put stable prefixes first, and improve cache hits;
    4. Build a cost dashboard and alerts by token and time-period dimensions;
    5. Review peak/off-peak rules and price spreads every two weeks; rules may change, so the strategy must be configurable rather than hard-coded.

    Treating the pricing mechanism as a schedulable resource signal rather than a price tag you passively accept is the most valuable takeaway this rule change offers developers.