LLM API Peak and Off-Peak Pricing: Cutting Costs by Scheduling Calls in Off-Peak Hours

    This article explains how peak and off-peak pricing, borrowed from electricity tariffs, applies to large language model APIs. It covers how providers typically define time windows, which workloads suit off-peak execution, and how to route tasks, run off-peak workers, and combine precomputation with caching. It also explains why developers report different cost experiences and recommends profiling usage before adopting this pricing model.

    1. What Peak and Off-Peak Pricing Means: From Power Grids to LLM APIs

    Peak and off-peak pricing is not new. It was first widely used in the electricity industry. Electricity prices rise during peak demand hours and fall during late-night off-peak hours. This encourages users to shift their consumption and smooths the load on the grid.

    Large model inference has scaled up in recent years, and compute resources now show a similar pattern. Requests are dense during daytime work hours, and GPU resources are tight. At night, a large share of compute sits idle.

    To improve resource utilization, some model service providers have started to adopt this approach. They divide API calls into two pricing tiers: peak hours (high-demand periods) and off-peak hours (idle periods). For the same model and the same interface, the off-peak unit price can be as low as about half the peak price. For cost-sensitive developers and companies, this means that adjusting only the call time, within the flexibility their business allows, can save a meaningful amount of money.

    2. How Peak and Off-Peak Hours Are Defined: Typical Rules and Design Logic

    Common peak and off-peak pricing schemes usually define time windows as follows:

    • Peak hours: 9:00–12:00 and 14:00–18:00 Beijing time (UTC+8). These windows cover most office and production workloads.
    • Off-peak hours: All other times, including the lunch break, evenings, and the entire night.

    These windows reflect a typical load curve:

    1. Morning peak: Office work and content production tasks start in bulk, and request volume climbs quickly.
    2. Midday dip: Load drops briefly between 12:00 and 14:00.
    3. Afternoon second peak: Load rises again between 14:00 and 18:00.
    4. Deep night valley: After 18:00, request volume keeps falling, and GPU clusters have a lot of idle capacity.

    Off-peak discounts work because the provider uses price to steer tasks that are not time-sensitive toward idle periods. The provider can then handle more total volume without adding hardware.

    3. Which Tasks Suit Off-Peak Execution

    Not every call should move to off-peak hours just to save money. The main test is how sensitive a task is to real-time response and latency.

    Task types that suit off-peak hours

    • Offline batch processing: For example, summarizing historical documents, cleaning corpora, or precomputing embeddings for knowledge bases.
    • Scheduled report generation: Daily and weekly reports can run overnight, so they are ready in the morning.
    • Data labeling and review: Content safety and quality review requests can be handled asynchronously through a queue.
    • Model evaluation and regression testing: Batch evaluation jobs in CI pipelines fit naturally into overnight runs.
    • Cache warming: Generate frequently asked question pairs or popular content in advance during off-peak hours, so peak-hour requests hit the cache directly.

    Tasks to keep in peak hours

    • Real-time conversations and interactions with end users.
    • Online services with strict latency SLAs.
    • Scenarios that need immediate human decision support.

    A practical rule: keep tasks that interact with people in real time during peak hours, and move tasks that process data in bulk to off-peak hours.

    4. Implementation: Scheduling Strategies and Code Examples

    1. Time-window-based task routing

    Add a simple time check in the application layer to route tasks to different priority queues:

    1. from datetime import datetime, time
    2. PEAK_WINDOWS = [
    3. (time(9, 0), time(12, 0)),
    4. (time(14, 0), time(18, 0)),
    5. ]
    6. def is_peak(now: datetime) -> bool:
    7. t = now.time()
    8. return any(start <= t < end for start, end in PEAK_WINDOWS)
    9. def route_task(task):
    10. if task.realtime or is_peak(datetime.now()):
    11. return execute_immediately(task) # Peak hours or real-time task: execute immediately
    12. return enqueue_offpeak(task) # Non-real-time task: enqueue for off-peak processing

    2. Off-peak batch worker

    Paired with a message queue service, the worker keeps consuming tasks at a controlled rate during the off-peak window:

    1. def run_offpeak_worker(queue):
    2. while in_valley_window():
    3. task = queue.fetch(timeout=5)
    4. if task is None:
    5. continue
    6. result = call_model_api(task.prompt, batch=task.batchable)
    7. save_result(task.id, result)

    The key points are:

    • Window boundary handling: Before peak hours begin, stop submitting new tasks. A task that spans two pricing tiers creates ambiguity about how it is billed.
    • Retry handling: Retries for off-peak tasks should also stay inside the off-peak window, so retried requests do not drift into peak hours.
    • Idempotent design: Batch tasks must be idempotent. Otherwise, the scheduler may deliver the same task twice and cause duplicate charges.

    3. Combining caching to cut costs further

    Off-peak hours offer lower unit prices, and they can also be used to create peak-hour cache hits that need no additional API calls:

    • Analyze peak-hour request logs and identify frequently repeated prompt patterns.
    • Batch-generate results during off-peak hours and write them to a cache layer.
    • At peak hours, check the cache first. Return the cached result on a hit, and call the model in real time only on a miss.

    This combination of off-peak precomputation and peak-hour cache hits can reduce peak-hour API calls to a minimum.

    5. Why the Same Service Feels Cheap to Some Users and Expensive to Others

    Two seemingly contradictory views circulate in the community. Some users find their call costs still manageable. Others clearly see their spending rise. Both groups may be calculating correctly. The difference usually comes from three variables:

    1. Time window differences: Teams that run batch jobs overnight place most of their calls in off-peak hours, so their average price is low. Teams that make interactive calls during the day pay full peak prices.
    2. Model tier differences: Different model tiers have different base prices. When tiers are mixed, the weighted average price can vary widely.
    3. Task type differences: Batch tasks can spread costs through batching and caching. Scattered real-time requests get neither the discount nor the caching benefit.

    Before adopting a peak and off-peak pricing service, companies should perform a usage profile analysis. Measure request volume by time window, the split between real-time and deferrable tasks, and the share of cacheable requests. Use these figures to estimate the true blended average price, rather than relying only on the list price of a single tier.

    6. Checklist and Summary

    • Inventory current calls and separate real-time tasks from deferrable ones.
    • Move deferrable tasks to an off-peak queue, paying attention to window boundaries and idempotency.
    • Build a caching layer and use off-peak precomputation to offset peak-hour costs.
    • Tag billing records by time window, and keep tuning the scheduling strategy.
    • Agree on SLAs with business teams, so cost savings do not come at the expense of critical user experience.

    Peak and off-peak pricing essentially trades scheduling for cost. Compute capacity is uneven over time. Whoever can shift flexible tasks into off-peak windows can complete more work with the same budget. For developers, mastering time-aware scheduling is useful beyond the current pricing model. It is a general skill for handling differentiated pricing of compute resources in the future.