Peak and Off-Peak LLM API Pricing with Million-Token Context: A Practical Guide
This guide explains how peak and off-peak pricing for large language model APIs changes application architecture, and how to combine time-based scheduling with context engineering to control token costs. It covers a practical cost model, task tiering into rigid and elastic workloads, queue and scheduling patterns, strategies for using long context without overloading prompts, capacity planning for off-peak windows, and a migration checklist. The approach is vendor-neutral and applies to model services such as Baidu AI Cloud as well as self-hosted inference clusters.
1. Background: What a Late-Night Release Signals
A large model platform completed a version update late at night and announced the next day that the new version was available across three entry points: a mobile app, a web interface, and an API. Alongside the model, the platform introduced a billing change that matters more to developers: starting at midnight on a Monday, the API would adopt peak and off-peak time-of-use pricing.
The time windows are simple. Each day, 9:00–12:00 and 14:00–18:00 are defined as peak hours; all remaining hours are off-peak, priced at half the peak rate.
The stated reason was more rational allocation of compute resources, and developers were encouraged to schedule tasks flexibly around their business needs. Translated into engineering terms: inference capacity supply fluctuates noticeably within a day, and the platform wants to use price signals to shift deferrable workloads from the peak to the valley.
The late-night release timing was also a practical choice. Third-party traffic data shows that this class of platform draws highly international traffic, with mainland China accounting for roughly half and the remainder spread across Russia, the United States, Brazil, and many other regions. A late-night release lets developers in different time zones get the new version during their local morning, while pushing the traffic spike of the release moment into the quietest window across the network — which aligns with the intent of peak and off-peak pricing.
The new version’s capability parameters are also worth recording: context length on the order of one million tokens, maximum output length of roughly 384,000 tokens, support for both thinking and non-thinking modes, plus capabilities such as tool calling and structured output interfaces. For developers, the real question is not how large the parameters are, but how these capabilities and time-of-use pricing together determine the bill.
2. The Essence of Peak and Off-Peak Pricing: Passing Cloud Resource Fluctuation Up to the Application Layer
Traditional API billing uses a single flat rate that does not change over time, so the application layer has no incentive to be aware of time at all. Time-of-use pricing changes that by explicitly exposing the supply-side utilization curve as a price curve.
From the resource side, intraday load has a bimodal shape: the morning and afternoon work windows are the densest for interactive requests, while nights and midday are long-tail valleys. Machines are not idle during the valleys; they are occupied by a small number of requests holding a large amount of allocated capacity, so the marginal cost per token is very low. A 50% discount pulls load into that window: the platform raises overall utilization and developers gain a cost dividend, making it a win-win pricing design.
The impact on the application layer is decisive: time shifts from an irrelevant variable to an optimizable one. Architecture design gains a new dimension — the time elasticity of requests. The test is straightforward: if a request returning a few hours later does not affect business correctness, it is movable load; if a user is waiting in front of a screen, it is rigid load.
3. Cost Model: Quantify First, Then Optimize
Any optimization should start from a computable model. Let the peak rate be P, so the off-peak rate is 0.5P. Expanding the day’s requests by time distribution, daily cost can be written as:
Cost_daily = P * (N_peak + 0.5 * N_offpeak) * T_avg
where N is the number of requests and T_avg is the average billed token volume. If we define the movable ratio as r (all movable requests land in off-peak hours), the savings relative to the original cost is approximately 0.5 * r. In other words, every 10 percentage point increase in the movable ratio reduces daily cost by about 5%.
This model yields two clear conclusions. First, reducing per-request token volume (T_avg) and shifting load (r) are two independent and stackable optimization paths. Second, given that unit price is not controllable, all engineering effort should land on these two variables.
One caveat: platforms differ in how they bill cache hits, batching, and thinking tokens. The specific rules should follow the provider’s official documentation, and the architecture should abstract billing rules into a replaceable policy module rather than hard-coding them.
4. Task Tiering: Split the Business into Rigid and Elastic Layers
The first step is an inventory. List every call site and tag it by result timeliness requirement:
- Rigid layer: online Q&A, code completion, real-time risk control, voice conversation pipelines. A user or system is waiting, so these must run in peak hours; the optimization focus is token compression and caching.
- Elastic layer: offline summarization, log and ticket classification, batch translation, data cleaning and labeling, model evaluation, regression testing, report generation, embedding re-computation. These tasks are unaffected in substance if completed a few hours later and should move into off-peak hours as a whole.
- Semi-elastic layer: scheduled pushes and periodic reports. Shifting the trigger time via a scheduler produces immediate cost gains.
After tiering, the scheduling policy is no longer “execute as soon as possible” but “execute at the right time within constraints.” A minimal working queue implementation:
PEAK_HOURS = {9, 10, 11, 14, 15, 16, 17} # Peak hours (local time zone)def is_peak(now):return now.hour in PEAK_HOURSdef submit(job, queue_peak, queue_offpeak, now):# Elastic jobs enter the delayed queue during peak hours, waiting for off-peak releaseif job.elast == "hard":queue_peak.put(job)else:(queue_peak if is_peak(now) else queue_offpeak).put(job)
A more robust engineering approach combines delayed delivery with priority queues in a message queue: during peak hours, send elastic jobs to a delayed queue with delivery time set to the start of the next off-peak window, and set a maximum wait limit for elastic jobs to avoid task starvation in extreme cases.
5. Context Engineering: A Million-Token Context Does Not Mean Stuffing Everything In
Ultra-long context is a double-edged sword. It can hold an entire code repository or hundreds of pages of documents at once, but it carries three costs: linearly growing billed tokens, attention dilution that lowers recall of key information, and higher time-to-first-token and memory consumption.
The right approach is therefore loading on demand rather than full injection. Composable strategies include:
- Retrieval first: use vector or keyword retrieval to fetch the top-K fragments from a knowledge base, then hand them to the long-context model for reasoning, keeping token volume within a much smaller order of magnitude.
- Layered summarization: produce a structured summary of very long documents first (sections, interfaces, conclusions), retain positional indexes back to the original text, and fetch details a second time when needed.
- Context compression: remove repeated templates, redundant whitespace, and comment noise; for log-type data, trim fields first.
- Stable prefix and caching: place the system prompt, tool definitions, and long-lived invariant knowledge blocks at the very front of the prompt and keep them byte-level stable to hit prefix caching; put volatile content later.
- Structured output constraints: constrain output fields with an explicit schema to reduce wasted generated tokens.
An illustrative prompt layout:
[Stable prefix: system role + tool definitions + output schema notes] ← keep unchanged to favor cache hits[Semi-stable block: domain knowledge, glossary][Volatile block: this round's retrieved fragments + user question] ← keep the changing part as short as possible
A frequently overlooked detail is thinking mode. Enabling deep reasoning consumes additional reasoning tokens, which is sensitive for both latency and cost. The sensible approach is to restrict thinking mode to high-value, high-uncertainty requests, run the rest in non-thinking mode, and log the cost difference between the two modes on the client so that data decides the threshold.
6. Stability and Capacity Planning: The Valley Is Not Unlimited Capacity
A steep off-peak discount does not mean unlimited resources. When many teams shift tasks into the night at the same time, the valley fills quickly and queuing, rate limiting, and even timeouts appear. Three countermeasures:
- Stagger rather than synchronize: spread load further within off-peak hours, for example by assigning different minute offsets per business line to avoid an on-the-hour flood.
- Elastic quotas and backpressure: set concurrency caps and token-bucket rate limits for elastic jobs, and automatically reduce batch size when the queue backs up, yielding resources to rigid traffic.
- Degradation and retry: define timeouts, exponential backoff, and idempotency keys explicitly to avoid retry amplification; allow non-critical tasks to fail into a compensation queue.
Observability is equally indispensable. At minimum, collect request counts by time window and business line, distributions of input/output/reasoning tokens, cache hit rate, time-to-first-token, end-to-end P95/P99, failure and rate-limit rates, and tag unit price by time window to produce reports where cost is attributable to a business line. Without attribution, cost optimization cannot be sustained.
7. Migration and Rollout Checklist
- Inventory call sites and tag rigid/elastic attributes and timeliness constraints.
- Establish a cost baseline and compute N_peak, N_offpeak, T_avg, and the current r using the model above.
- Introduce a delayed queue and priority scheduling, migrating low-risk tasks first (batch summarization, offline evaluation).
- Add retrieval-first and context compression, then watch token reduction and quality metric changes.
- Enable prefix caching and structured output to cut wasted generation.
- Build a time-window cost dashboard with alerts and set budget thresholds.
- Review r and quality metrics every two weeks, gradually widening the migration scope.
8. Conclusion
Time-of-use billing turns “when to compute” into an architecture problem, and ultra-long context turns “how much to compute” into an engineering problem. Together, they shift the focus of cost optimization from price negotiation to scheduling and context governance: keep rigid requests in the peak, let elastic load sink into the valley, and make every token carry useful information. This method depends on no particular vendor; it can be applied on model services such as Baidu AI Cloud and to resource orchestration in self-hosted inference clusters. What truly creates separation is not model parameter count, but the application layer’s fine-grained control over time and context.
