Peak and Off-Peak Pricing for Large Language Models: A Practical Guide to Task Scheduling
This guide explains how peak and off-peak pricing works for large language model inference and how to build scheduling around it. It covers the parameters to confirm before changing anything, a cost model for estimating savings, a framework for classifying tasks by latency tolerance, and a persistent queue implementation with rate control and idempotency. It also lists complementary ways to cut token usage and common mistakes to avoid.
1. Why Time-of-Day Pricing Exists
Inference load for large language models is highly uneven. During daytime work hours and the early evening, interactive requests arrive in dense waves and cluster utilization approaches saturation. Late at night and in the early morning, interactive traffic drops off, yet the expensive accelerators keep depreciating and drawing power. Replacing a flat rate with two tiers, peak and idle, where idle is priced at half the peak rate, uses a price signal to shift deferrable compute demand into the trough, so the same hardware produces more effective throughput.
For developers, this is both a cost opportunity and an architectural constraint: the bill is no longer determined by token count alone, but also by when a request happens. The optimization focus therefore expands from “use fewer tokens” to “use tokens at the right time.”
2. How the Mechanism Works: Three Parameters to Confirm
- Time window boundaries: in the example rules, 9:00–12:00 and 14:00–18:00 each day count as peak, and all other hours are idle, priced at 50% of peak. A midday trough sits between the two peak windows and is a good fit for medium-length batch jobs.
- Time reference: boundaries follow the provider’s time zone (for example, Beijing time). Distributed teams across time zones must convert consistently, or they end up with doubled costs or mistimed scheduling.
- Scope of effect: a pricing switch typically applies only to newly created requests. How long-lived connections, streaming output, and long tasks that span a boundary are billed must follow the official documentation; do not make assumptions in code.
3. Cost Model: Do the Math First
Let the peak rate be P, the average daily token volume be T, and the share of peak hours be r. The original cost is roughly T × P; with time-of-day pricing, the cost becomes T × P × (1 - 0.5r). At r = 0.6, the theoretical saving is about 30%; if half of the peak load can be moved to the trough, savings can approach more than 40%.
Log every call as a structured record with at least a timestamp, a scenario tag, input and output tokens, whether the cache was hit, and the billing tier applied. Then aggregate by day to get the real value of r. Without that r, any scheduling strategy is guesswork.
4. Task Classification: Deciding What Can Wait
- Online interactive: code completion, chat, and retrieval question answering. Latency-sensitive, so these must stay in peak hours, degrading to a smaller or shorter-context model when necessary.
- Near-line: document summarization, log root-cause analysis, and unit test generation. These tolerate delays of a few minutes, so put them in a queue and run them during the midday trough and the overnight idle window.
- Offline: batch data cleaning, full code base indexing, regression evaluation, and report generation. Fully deferrable, so push all of it into idle hours.
The test is simple: is a user waiting at the screen for this output? If not, there is no reason to consume peak capacity.
5. Scheduling Implementation: Queues, Rate Control, and Idempotency
Use a persistent queue for near-line and offline tasks, and have consumers adjust their rate dynamically based on the current tier:
PEAK = {(9, 12), (14, 18)} # provider time zoneLOW_RATE = 0.5 # idle rate discountdef is_peak(now):return any(a <= now.hour < b for a, b in PEAK)def worker_loop(queue, client):while True:task = queue.get(timeout=60)if task.deadline_soon() or is_peak(now_in_provider_tz()):run(task, client) # urgent or peak: run immediatelyelse:run(task, client) # idle: run normally, cost halvedqueue.task_done()
Four engineering points matter. First, idempotency keys: deduplicate on the business primary key plus a content hash so retries do not cause duplicate billing. Second, timeouts and requeueing: use exponential backoff to avoid saturating the trough in a burst. Third, priority and quota isolation: offline tasks must not crowd out online capacity. Fourth, observability: track peak share, cache hit rate, and per-task cost separately for each scenario, and produce a daily report.
6. Supporting Measures: Cut Volume Before Negotiating Price
Time-of-day pricing changes only the unit rate; token usage is still the multiplier. Shorter prompts, context trimming, reranking retrieval results and keeping only the most relevant fragments, caching identical prefixes, and merging batched requests all stack multiplicatively with off-peak scheduling. For very long context scenarios, running an offline pre-summarization pass before online inference is often more economical than pushing a million-token context into a peak-hour request.
7. Common Mistakes
- Shifting everything off-peak: delaying interactive requests too, which collapses the experience and costs more than it saves.
- Ignoring time zones: scripts that judge the tier using local time distort the bill for teams spanning continents.
- Unbounded retries: a single hiccup during the trough triggers an avalanche of duplicate calls.
- Looking only at unit price and not at structure: a model’s structure can stay unchanged while additional post-training alone delivers new capabilities, which means selection should be driven by evaluation results rather than parameter count. The waste from a wrong choice far outweighs any time-of-day savings.
8. Implementation Checklist
- Define the latency tolerance of each business scenario and tag it. 2. Collect one week of real call distribution and compute the peak share. 3. Add a persistent queue and an idempotency mechanism. 4. Configure tier-aware concurrency and degradation policies. 5. Set up a cost dashboard and alerts. 6. Review every two weeks and reassess model selection against the latest public evaluations. General-purpose capabilities on cloud platforms such as Baidu AI Cloud (message queues, container platforms, logging services, monitoring and alerting) can carry this whole pipeline directly, with no need to build the entire infrastructure stack in-house.
