Understanding Off-Peak Pricing for Large Model APIs: A Cost Control Guide

    This article breaks down how time-based, tiered pricing works for large model APIs and why inference compute behaves like a tidal resource. It explains the three billing items (cached input hits, cached input misses, and output), the two time windows (peak and off-peak), and why prefix caching can create an order-of-magnitude cost difference. It also covers how to classify workloads by latency sensitivity, and how to build a time-aware scheduling and cost-control loop with observability, queues, output budgets, and fallback strategies. Readers will learn to treat time and caching as first-class architecture dimensions to make API costs predictable.

    1. The Technical Problem Behind the Headline: Why Inference Services Get Congested by Time of Day

    A cloud provider recently changed how it bills for large model API usage. Instead of a single flat rate across all hours, it introduced time-based, tiered pricing driven by supply and demand for compute: fixed morning and afternoon windows are defined as peak hours, and all other times are off-peak. Off-peak prices are roughly half of peak prices, with billing uniformly measured in yuan per million tokens. At the same time, a higher-capability model tier that had been in testing moved into general commercial availability.

    If you treat this as nothing more than a price change, you miss its real technical meaning: inference compute is a resource with a pronounced tidal pattern. Enterprise calls cluster during weekday daytime, stacking on top of local development, testing, and batch data processing to form load spikes, while machine utilization at night and in the early morning tends to be low. To make better use of a limited pool of accelerator cards, the server side needs a price signal that “pushes” deferrable tasks into the trough. That is the essence of off-peak pricing.

    For developers, three conclusions matter:

    • The cost per token is no longer a constant; it is a function of “time window × billing item × model tier.”
    • Architecture design shifts from “make it run” to “make cost predictable,” which requires explicitly modeling the time dimension.
    • Cache hit rate goes from an optimization item to a first-order cost variable, where the unit price of a hit versus a miss can differ by an order of magnitude.

    2. Breaking Down the Billing Structure: Three Billing Items Across Two Time Windows

    Published tiered pricing typically splits a single request into three billing items, each with separate peak and off-peak rates:

    Billing item Meaning Relative off-peak level
    Cached input hit The prefix content is reused from the server-side cache Lowest
    Cached input miss Prompt content that must be fully re-encoded Medium
    Output Tokens generated by the model Highest

    Using the magnitudes given in the source as an example, the lightweight tier in off-peak hours is roughly 0.05, 1.5, and 4.5 yuan per million tokens for the three items, doubling to 0.10, 3.0, and 9.0 in peak hours; the higher-capability tier is roughly 0.15, 4.5, and 13.5 off-peak, and 0.30, 9.0, and 27.0 in peak hours.

    Three engineering conclusions follow from this table:

    1. Output is the most expensive part, so controlling generation length is often more effective than compressing the prompt.
    2. There is roughly a 30x price gap between cache hits and misses, so how you organize the prompt directly determines the bill.
    3. Peak versus off-peak is a 2x relationship, so moving deferrable load to a different window is equivalent to halving overall cost.

    Note that the numbers above only illustrate the order-of-magnitude relationships. Actual unit prices, time-window definitions, and caching policies should follow the billing documentation published by the service provider for the current period.

    3. Why Cache Hits Produce an Order-of-Magnitude Difference

    Prefix caching (often called prompt caching in the industry) can be reused only when the leading sequence of tokens in a request is exactly identical to a recent request. On a hit, the server can skip recomputing the Key/Value for that portion, so the price is significantly lower than a miss.

    To raise the hit rate in practice, follow the “stable prefix” principle:

    1. [Stable prefix] System instructions + tool definitions + domain knowledge + a few examples
    2. [Semi-stable section] Conversation summary, fixed business context
    3. [Volatile tail] Current user input, timestamps, random IDs

    A common mistake is placing timestamps, request IDs, or randomly ordered retrieval results at the beginning of the prompt. This makes the entire prefix different every time and invalidates the cache. In addition, unstable field ordering in tool definitions, random sampling of the example set, and retrieval-augmented results whose ordering shifts with minor scoring changes will all break prefix consistency.

    4. Workload Tiering: Which Loads Are Suited to Off-Peak

    Not every call can be deferred. Loads can be grouped into three tiers by “latency sensitivity”:

    • Online interaction tier: Dialogue, completion, and real-time Agent decisions must land within the user’s waiting window, so they can only run in peak hours; the optimization focus is output length and context trimming.
    • Near-real-time tier: Minute-level summarization, moderation, and routing can tolerate a small delay and are suited to time-aware queuing.
    • Offline batch tier: Document parsing, dataset labeling, batch rewriting, regression evaluation, and nightly builds are best moved entirely to off-peak hours.

    The capability combination mentioned in the source—very long context, code-completion-style infilling, tool calling, conversation continuation, and multiple interface-compatible forms—happens to cover all three tiers: long-text parsing and batch inference lean offline, while code completion and tool calling lean online. The first step in cost governance is to break calls down and measure them by these three tiers, rather than looking at one vague monthly total.

    5. A Practical Approach: A Time-Aware Scheduling and Cost-Control Loop

    5.1 Cost Observability

    First, set up instrumentation by “time window × billing item × business tag,” recording input tokens, hit tokens, output tokens, timestamp, and business-line tag for each call. Without this layer of data, any optimization is guesswork.

    1. # Example: unified recording of request cost and time-window tagging
    2. PEAK_RANGES = [(9, 12), (14, 18)] # Peak hours (per the provider's published schedule)
    3. def is_peak(ts) -> bool:
    4. hour = ts.hour
    5. return any(start <= hour < end for start, end in PEAK_RANGES)
    6. def record(call, ts):
    7. metrics.increment(
    8. "llm_cost_tokens",
    9. tags={
    10. "peak": str(is_peak(ts)),
    11. "model_tier": call.tier,
    12. "hit": str(call.cached_input > 0),
    13. "biz": call.biz_tag,
    14. },
    15. value=call.input_tokens + call.output_tokens,
    16. )

    5.2 Time-Aware Queue

    Write offline jobs into a message queue, and let the consumer decide based on the current window whether to “run now” or “delay until the off-peak window,” with a maximum delay cap to avoid jobs piling up indefinitely.

    1. def schedule(job, now):
    2. if job.deadline_soon(now):
    3. return run_now(job) # Hard deadline, run immediately
    4. if is_peak(now):
    5. return delay(job, until=next_off_peak(now))
    6. return run_now(job)

    5.3 Output Length Governance

    Since output has the highest unit price, explicitly constrain the generation budget: set a maximum output token count, use structured output to reduce pleasantries and redundancy, and adopt a two-stage “extract first, then generate” flow for summarization tasks to avoid letting the model run freely.

    5.4 Stability and Fallback

    Off-peak scheduling must be paired with capacity and fallback strategies: reserve quota and rate-limit thresholds for the online path during peak hours, configure timeout retries with exponential backoff, prepare a fallback path that “degrades to smaller context or shorter output” for non-critical tasks, and wire key metrics into logging services and monitoring alerts.

    6. Common Pitfalls

    • Looking only at unit price, not structure: The impact of a doubled unit price is far smaller than the amplification from a fully missed cache.
    • Blanket off-peak shifting: Deferring tasks with deadlines saves far less money than the business loss it causes.
    • Ignoring context growth: Without summary compression in multi-turn conversations, input tokens grow linearly with turns and costs spiral out of control.
    • No rollback baseline: After a price change or policy change, without a baseline comparison, you cannot tell whether the optimization actually worked.

    7. Conclusion

    Off-peak tiered pricing makes the supply-demand relationship of compute explicit as a price signal. The right response for developers is not to passively accept the bill, but to bring the two dimensions of time and caching into architecture design: trade a stable prefix for cache hits, trade workload tiering for time-window discounts, and use output budgets and an observability system to keep costs predictable. If an organization wants to implement the same scheduling approach in its own environment, it can build an offline inference pipeline on general-purpose capabilities such as the container platform, message queue, object storage, and monitoring and alerting offered by Baidu AI Cloud, achieving a resource-utilization model that yields to peak demand and fills up during idle hours.