Peak and Off-Peak Pricing for LLM APIs: How to Calculate and Reduce Costs

    As LLM API usage surges, providers are introducing peak and off-peak pricing to smooth demand. This article explains how time-of-day pricing works, how to calculate its impact on your bill, and practical strategies—such as deferring batch jobs, caching, request merging, and traffic shaping—to keep costs under control without sacrificing critical workloads.

    Why Peak and Off-Peak Pricing Emerged

    LLM API call volumes are growing rapidly, but compute capacity cannot scale instantly. Expanding infrastructure requires hardware procurement and data center construction, which take time and cannot accommodate sudden spikes in request traffic. As a result, daytime workdays see concentrated requests, slower response times, and even queuing, while nighttime and weekends often leave resources largely idle.

    A flat unit price cannot reflect this supply-demand imbalance. When users pay the same rate regardless of when they make calls, there is no incentive to shift non-urgent tasks to off-peak hours. Peak and off-peak pricing addresses this through price signals: higher unit prices during peak hours discourage unnecessary requests, while lower prices during off-peak hours attract deferrable batch workloads. This approach is similar to time-of-use electricity pricing, with the goal of smoothing resource utilization rather than simply increasing revenue.

    How Time Windows Are Defined

    The following example uses publicly available rules from a typical provider. Actual time windows and prices may vary by vendor—always refer to the official pricing page, as rules may change.

    • Peak hours: Weekdays, 9:00–12:00 and 14:00–18:00 (Beijing Time).
    • Off-peak hours: Weekdays, 12:00–14:00 and 18:00–next day 9:00.
    • Weekends: All day billed at the off-peak rate.

    The rationale is that these two windows cover the primary working hours for most teams—development, debugging, business calls, and data analysis are most concentrated during these periods. Weekend discounts encourage testing and exploratory tasks to be scheduled on non-working days.

    Before integrating, confirm three things: whether the time zone is based on Beijing Time, whether public holidays are treated as workdays, and whether usage is billed per request, per token, or per duration. Misunderstanding any of these can lead to unexpected bills.

    How Peak Usage Ratio Affects Your Bill

    Assume a flat-rate unit price of 1, a peak-hour unit price of 2× the off-peak price, and an off-peak price of 1, ignoring other fees. If peak-hour calls account for a fraction p of total daily calls, the relative daily cost is:

    Cost = p × 2 + (1 − p) × 1 = 1 + p

    In other words, the bill increase equals the peak-hour call ratio p. If the peak multiplier is r, the increase is p × (r − 1).

    Peak Call Ratio Cost Relative to Flat Pricing Bill Increase
    30% 1.3× ~30%
    50% 1.5× ~50%
    60% 1.6× ~60%

    Teams should first analyze their own call time distribution to determine the peak-hour ratio, then assess the actual impact of peak/off-peak pricing on their budget. If the peak-hour ratio is low, this pricing model may actually save money.

    How Developers Can Adapt

    1. Move Non-Real-Time Tasks to Off-Peak Hours

    Data cleaning, batch content moderation, offline analysis, and data preprocessing for fine-tuning can usually tolerate delays of a few hours. Use message queues or task scheduling frameworks to run these jobs during off-peak or weekend hours. Set a maximum completion time in the scheduler to prevent tasks from being delayed past business deadlines.

    2. Strengthen Caching—But Maintain Consistency

    For requests with high repetition rates, cache results locally or in a distributed cache. Key considerations:

    • Cache keys should include the model name, version, prompt template version, and key parameters; otherwise, results from different configurations may overwrite each other.
    • Set expiration times based on data freshness requirements—highly real-time content should not be cached.
    • Content involving user privacy or sensitive business data must pass compliance review before being stored.
    • After model or prompt updates, proactively invalidate related cache entries.

    3. Merge Requests—But Set Boundaries

    Many providers offer batch endpoints that allow combining multiple small requests into one call, reducing the number of requests. Before using them, check the documentation for limits, including maximum batch size, maximum tokens per request, timeout, and rate-limit rules. These values differ by provider and cannot be assumed based on experience.

    Batch calls also require handling partial failures. Track the status of each sub-task, retry only failed items, and include idempotency keys with each submission to avoid duplicate billing or duplicate writes.

    4. Classify Requests by Real-Time Requirements

    Dividing requests into three categories makes them easier to manage:

    • Critical requests—such as real-time conversations where users are waiting—execute immediately, even during peak hours.
    • Normal requests—such as report generation—can be delayed when time permits.
    • Background requests—such as log analysis and statistical aggregation—default to off-peak hours.

    5. Shape Traffic with a Gateway

    Implement rate limiting, such as a token bucket, at the gateway or middleware layer to smooth request spikes. When peak hours are detected, reduce the sending rate of background requests to reserve resources for critical ones.

    Scheduling Logic Illustration

    The pseudocode below is for conceptual illustration only and is not suitable for production use. A real deployment would require replacing it with an actual calendar service, task queue, and vendor SDK.

    1. from datetime import datetime, timedelta
    2. from zoneinfo import ZoneInfo
    3. TZ = ZoneInfo("Asia/Shanghai") # Use Beijing Time consistently
    4. PEAK_RANGES = [(9, 12), (14, 18)] # Weekday peak hour ranges, half-open intervals
    5. MAX_DELAY = timedelta(hours=12) # Maximum allowed delay; execute immediately if exceeded
    6. MAX_SEARCH_HOURS = 72 # Upper bound for finding an off-peak slot, prevents infinite loops
    7. def is_workday(t):
    8. # Should integrate a public holiday calendar; this is only a rough Mon-Fri check
    9. return t.weekday() < 5
    10. def is_peak(t):
    11. if not is_workday(t):
    12. return False
    13. return any(start <= t.hour < end for start, end in PEAK_RANGES)
    14. def next_off_peak_time(now):
    15. # Peak boundaries are at full hours; search hour by hour for the first off-peak moment
    16. t = now.replace(minute=0, second=0, microsecond=0) + timedelta(hours=1)
    17. for _ in range(MAX_SEARCH_HOURS):
    18. if not is_peak(t):
    19. return t
    20. t += timedelta(hours=1)
    21. return None
    22. def schedule_task(task, now=None):
    23. now = now or datetime.now(TZ)
    24. # Critical tasks or off-peak hours: submit immediately
    25. if task.priority == "CRITICAL" or not is_peak(now):
    26. return task.submit()
    27. run_at = next_off_peak_time(now)
    28. # No off-peak slot found, or wait time exceeds the limit: submit now at peak pricing
    29. if run_at is None or run_at - now > MAX_DELAY:
    30. return task.submit()
    31. # Enqueue and retry with exponential backoff, up to 3 times; log an alert if submission fails
    32. task_queue.enqueue(task, run_at=run_at, max_retries=3, backoff="exponential")

    This code demonstrates three boundaries: time zone fixed to Beijing Time, an upper limit on delay, and a fallback strategy when no off-peak slot is available.

    Pre-Procurement Cost Checklist

    When choosing a provider or evaluating a migration, review the following items systematically:

    • Call volume time distribution, especially the peak-hour ratio.
    • Real-time classification of requests and the proportion of load that can be shifted to off-peak hours.
    • Expected cache hit ratio and compliance costs of caching.
    • Batch endpoint limits: maximum items per batch, timeout, and rate limits.
    • Billing granularity: per request, per token, or per duration.
    • Engineering effort and testing costs required for migration.
    • Price adjustment terms and whether advance notice is provided.
    • Service-level agreement commitments on latency and availability.

    Compile these factors into a table and calculate monthly total costs under different scenarios. This is more reliable than comparing unit prices alone.

    How Rules May Evolve

    Most peak/off-peak pricing today uses simple fixed time windows and fixed multipliers. Finer-grained variants may emerge, such as adjusting price coefficients based on historical load patterns, or offering different prices by region or customer type. Whether these changes materialize depends on provider strategy, the regulatory environment, and user acceptance—this remains uncertain.

    The more frequently rules change, the more important it becomes to make price parameters configurable and to review cost models regularly. Excessively volatile pricing can also erode user trust, so transparent and predictable rules matter as well.

    Summary

    Peak and off-peak pricing ties API costs to the time of invocation. Teams should first measure their peak-hour call ratio, use the formula to estimate bill changes, and then decide which tasks to shift and which requests to keep real-time. Moving non-real-time tasks to off-peak hours, setting boundaries for caching and batch calls, and combining request classification with rate limiting can typically control costs without sacrificing critical services. Before procurement, use a checklist to enumerate all cost-affecting factors, then make an informed decision.