Peak and Off-Peak LLM API Pricing: A Practical Guide to Off-Peak Scheduling
This guide explains how time-based, tiered pricing for large language model APIs changes the way developers should estimate costs and design inference workloads. It breaks down pricing across three dimensions—time of day, cache hit status, and input versus output—shows how total cost can be modeled as a simple function of peak traffic share, and demonstrates how cache hit rate becomes the primary cost lever. It also covers classifying workloads for off-peak scheduling, keeping prompt prefixes stable to preserve cache reuse, managing long-context constraints, and building governance around reliability and budget controls, with a final deployment checklist.
1. From Flat Pricing to Off-Peak Tiers: What Actually Changed
Large model APIs have traditionally used a single flat rate: every million tokens costs the same regardless of when the request is made. That model is simple enough when compute supply is ample and load is steady, but once a platform enters its daytime high-load window, resource contention becomes obvious. All users compete for the same pool of inference capacity at the same time, queueing delays rise, and at the same time a large amount of capacity sits idle overnight.
A new pricing scheme introduced by a cloud provider in mid-August targets exactly this structural mismatch. Instead of a flat rate, the provider now charges by tiers based on compute supply and demand. The official peak windows are 9:00–12:00 and 14:00–18:00 each day; all other hours are treated as off-peak, priced at half the peak rate. Billing is uniformly measured in currency per million tokens. On the input side, pricing is further split into cache-hit and cache-miss lines, while output is priced separately.
The technical implication deserves attention from developers: price is no longer a “single scalar” but a three-dimensional function of time of day × cache status × input/output direction. Any team that still budgets, calculates costs, or makes architecture decisions based on a fixed unit price will produce systematic bias under the new mechanism.
2. Breaking Down the Price Structure: Three Dimensions That Determine the Bill
Using two publicly listed model tiers as an example (all prices are per million tokens, shown as off-peak/peak pairs):
- Lightweight tier: cache-hit input 0.05 / 0.10; cache-miss input 1.5 / 3.0; output 4.5 / 9.0
- High-performance tier: cache-hit input 0.15 / 0.30; cache-miss input 4.5 / 9.0; output 13.5 / 27.0
Three patterns have the largest impact on cost.
First, the cache-hit input price is one to two orders of magnitude lower than the cache-miss price. In multi-turn conversations, repeated question answering over long documents, and fixed system prompts, prefix reuse is not a nice-to-have—it is the main factor determining the bill.
Second, output prices are significantly higher than input prices; the high-performance tier’s output unit price is about three times its cache-miss input price. For any task that produces long text (report generation, batch code generation, long-document summarization), the cost center of gravity naturally falls on the output side, so compressing output length is more effective than compressing input.
Third, peak is strictly twice off-peak, consistently across all tiers and all billing items. This yields a very useful property: cost optimization and scheduling optimization are independent of each other and can be solved separately, then combined.
3. Cost Modeling: Turning the Bill into a Computable Function
Suppose a task has cache-hit input volume $H$, cache-miss input volume $M$, and output volume $O$ (in millions of tokens) over a billing period, with a peak traffic share of $p$ and off-peak unit prices $c_h, c_m, c_o$. The expected total cost can be written as:
Cost = (1 - p) * (H*c_h + M*c_m + O*c_o)+ p * (H*2c_h + M*2c_m + O*2c_o)= (1 + p) * (H*c_h + M*c_m + O*c_o)
This simplification is very practical: total cost equals the off-peak baseline cost multiplied by $(1+p)$. In other words, reducing the peak traffic share from 0.6 to 0.2 lowers overall spend by roughly 25%, and this gain is entirely orthogonal to cache hit rate and output length optimization, so the effects can be stacked.
Furthermore, defining the cache hit rate as $r = H / (H + M)$, the input-side unit cost is highly sensitive to $r$. Taking the high-performance tier during off-peak as an example, with cache-miss input at 4.5 and cache-hit input at 0.15, raising the hit rate from 0 to 0.8 drops the input-side unit cost from 4.5 to about 1.02, a reduction of nearly 77%. This is also why long-context scenarios must treat “prefix stability” as a first-class design concern.
4. Off-Peak Scheduling: Moving Deferrable Tasks to the Valley
Off-peak scheduling starts with classifying tasks. In practice, workloads fall into three categories:
- Strongly interactive: online Q&A, code completion, conversational continuation. Users perceive latency, so forced off-peak scheduling is generally not applied, but reducing batch concurrency during peak hours can help avoid congestion.
- Deferrable: offline report generation, batch classification of logs and tickets, knowledge base reindexing, nightly regression testing, batch code review. These are the primary targets for off-peak scheduling.
- Elastic fallback: burst traffic and abnormal retries. Peak quota should be reserved, but with budget caps and degradation strategies in place.
A minimal viable scheduler skeleton is shown below (illustrative, not tied to a specific platform API):
PEAK = [(9, 12), (14, 18)]def is_peak(now):h = now.hour + now.minute / 60return any(a <= h < b for a, b in PEAK)def submit(task, queue_idle, queue_peak):if task.deferrable and is_peak(now()):queue_idle.put(task) # run off-peak, half the costelse:queue_peak.put(task) # interactive or urgent tasks
Three supporting measures are also needed in engineering: set a maximum wait deadline for deferrable tasks to avoid business timeouts caused by backlog in the off-peak queue; set a queue-length threshold during peak hours that automatically routes new tasks to the off-peak queue when exceeded; and report “whether execution happened during peak” as a metric to continuously observe the trend of $p$.
5. Cache Reuse: Hit Rate Is the First Lever for Cost
The new pricing splits input into hit and miss tiers, which is essentially pricing “prefix reuse.” To improve the hit rate, request prefixes must remain byte-level stable:
- Fix the system prompt and tool descriptions, and move all dynamic content (timestamps, random IDs, user nicknames, current paths) to the end of the request;
- Avoid inserting debug information that changes on every call into the prompt, as such content invalidates the entire prefix;
- For long-document Q&A, concatenate in “document first, question after” order so that multiple questions about the same document share a prefix;
- For templated output, use controlled generation to reduce unnecessary long output.
Illustrative comparison:
# Bad example: dynamic content first, prefix changes every time, hit rate approaches 0prompt = f"Current time {now()}, user {uid}, system rules: {RULES}\nDocument: {doc}\nQuestion: {q}"# Good example: stable prefix first, volatile content lastprompt = f"{RULES}\nDocument: {doc}\nTime: {now()} User: {uid}\nQuestion: {q}"
It is worth emphasizing that cache hits depend on the platform’s prefix reuse capability. What developers can do is “not break reusability,” rather than declaring a hit themselves. Therefore, monitoring should track cache hit rate and cache-miss input volume as independent metrics, instead of only looking at total tokens.
6. Context and Interface Capabilities: Engineering Constraints for Long Contexts
New models generally offer long context windows (the public information here lists a maximum context and output length of 384K) and natively support tool calling, conversational continuation, code completion (FIM), and compatibility with multiple interface types. Long context brings capability but also cost risk: the longer the context, the larger the absolute volume of cache-miss input, and a single cold-start request’s input cost can far exceed its output cost.
The corresponding engineering strategy is “layered context”: place stable, unchanging knowledge in the reusable prefix, retrieved relevant snippets in the middle, and the current turn’s instructions at the end; for very long materials, split and retrieve first, sending only the necessary snippets to the model; for code completion scenarios, keep file headers and dependency declarations stable and place the content near the cursor as a suffix, aligning with FIM’s fill-in semantics.
7. Stability and Governance: Low Cost Does Not Mean Low Reliability
Off-peak scheduling concentrates load at night, and without governance the valley can become congested too. At least four measures are recommended: set timeouts and retry limits for each task type, with retries using exponential backoff that avoids exact top-of-hour times; use a message queue for peak shaving and decoupling, ensuring writes during peak and consumption during off-peak; build dashboards via logging services and monitoring alerts for failure rate, queueing duration, cache hit rate, and peak traffic share; and set budgets and quotas for different business lines to prevent a single failure from inflating the bill.
Two common pitfalls should also be avoided: pushing all tasks blindly to off-peak to save money, causing critical business timeouts; and optimizing only unit price without optimizing structure, ignoring output length and cache hit rate, which are the two larger variables.
8. Deployment Checklist
- Has task classification been completed, making clear which tasks are deferrable and which must be real-time?
- Has the current peak traffic share $p$ been measured, and a reduction target set?
- Have prompts been restructured so the prefix is stable and dynamic content comes last?
- Have length constraints and structured output been applied to long-output scenarios?
- Has a cost dashboard centered on cache hit rate, cache-miss input volume, and peak share been established?
- Have deadline, threshold switching, and budget alerts been configured for the off-peak queue?
Overall, tiered off-peak compute pricing turns “when to call” into an architectural decision as important as “how to call.” By understanding the three-dimensional price structure, quantifying gains with a computable model, and then applying scheduling and caching, developers can keep service quality while pushing inference costs below what was achievable in the flat-rate era. If an enterprise wants to build similar capabilities in its own environment, it can use general cloud product capabilities such as those offered by Baidu AI Cloud—container platforms, message queues, logging services, and monitoring alerts—to build its own scheduling and governance system and form a continuously optimizable cost loop.
