LLM API Peak/Off-Peak Pricing and Token Price Ratios Explained

    This article explains why LLM API price lists often look inconsistent, breaking down the three billable token types (regular input, cached input, and output) and the fixed ratio relationships between them. It also covers how peak/off-peak pricing works, how to estimate costs accurately with a per-period formula, and engineering practices—such as improving cache hit rates, controlling output length, and scheduling deferred tasks during off-peak hours—to reduce overall API spending.

    1. Why LLM Price Lists Look Messy

    When developers see an LLM API pricing update, their first reaction is often confusion: the price changes are inconsistent and hard to compare. Input prices went up, output prices stayed flat, and cache-related fees changed separately—making it difficult to tell whether the overall cost actually increased or decreased.

    The apparent irregularity usually comes from additional billing dimensions. A single model call typically includes at least three billable items:

    1. Regular input tokens: input content that misses the cache and must be fully computed.
    2. Cached input tokens: prefix content the server has already processed and can reuse.
    3. Output tokens: the content generated by the model.

    In common industry pricing designs, these three unit prices are not independent. Providers usually set a base unit price first, then derive the other two using fixed multipliers. So looking at the change of any single item in isolation is misleading—you should first identify the ratio between the three, then assess the overall impact.

    2. The Ratio Between the Three Token Types

    2.1 Output vs. Input Ratio

    Output tokens usually cost more per unit than input tokens. The reason is that generation is autoregressive, token by token: each output position requires a full forward pass, while the input portion can be processed in parallel. Output prices being higher than input prices is therefore common across the industry.

    2.2 Cache Hit vs. Cache Miss Ratio

    Cached input is priced significantly lower than regular input. The purpose of caching is to reuse previously computed prefix states and avoid redundant computation—the more cache hits, the lower the unit cost. This design encourages developers to place stable content at the front of requests to form reusable prefixes.

    2.3 Why a Unified Ratio Matters

    If the three prices are bound by fixed multipliers, you only need to know one base price to derive the other two. This has two benefits: price changes can be evaluated as a whole, and different providers can be compared using a unified conversion basis.

    1. def derive_prices(base_input_price, output_ratio, cache_hit_ratio):
    2. """Derive other unit prices from the regular input price; ratios are illustrative parameters"""
    3. return {
    4. "input_miss": base_input_price,
    5. "input_hit": base_input_price * cache_hit_ratio,
    6. "output": base_input_price * output_ratio,
    7. }
    8. # Parameters are for demonstrating the derivation only, not real prices
    9. print(derive_prices(2.0, 4.0, 0.1))

    It is important to note that actual multipliers should follow each provider’s official price list. This article discusses a general calculation method and the numbers should not be applied directly to any real service.

    3. Peak/Off-Peak Pricing

    3.1 Basic Concept

    Peak/off-peak pricing means setting different unit prices for different time periods. During peak hours, resources are tight and prices are relatively high; during off-peak hours, resources are idle and prices are relatively low. The goal is to flatten the load curve by encouraging users to shift delay-tolerant tasks to off-peak hours.

    3.2 Impact on Developers

    Peak/off-peak pricing changes task scheduling strategies. Latency-sensitive interactive scenarios—such as online chat and real-time customer service—are difficult to move to off-peak hours. In contrast, tasks like data cleaning, batch summarization, offline evaluation, and knowledge base preprocessing can usually be deferred and are well suited for off-peak execution.

    3.3 Things to Watch

    • The billing timezone follows the provider’s rules. Local time and billing time may differ, so teams working across time zones need to standardize the conversion.
    • For requests spanning two periods, confirm in the documentation whether billing is based on the request start time or completion time.
    • If a task is split across multiple periods, track usage for each period separately. Estimating with an average price can produce significant deviations.

    4. Cost Estimation Method

    When estimating costs, accumulate each item with the following formula, broken down by time period:

    Total cost = regular input volume × regular input price + cached input volume × cache price + output volume × output price

    1. def estimate_cost(usage, prices):
    2. """usage: token counts per type; prices: unit price per type (per 1M tokens)"""
    3. cost = 0.0
    4. for kind, tokens in usage.items():
    5. cost += tokens / 1_000_000 * prices[kind]
    6. return cost
    7. # Example parameters are for demonstrating the method only, not real prices
    8. prices = {"input_miss": 2.0, "input_hit": 0.2, "output": 8.0}
    9. usage = {"input_miss": 300_000, "input_hit": 700_000, "output": 100_000}
    10. print(round(estimate_cost(usage, prices), 2)) # outputs 1.54

    In real projects, it is recommended to pipe usage data into a logging service, record the counts of all three token types hourly, and then automatically aggregate them against the current day’s time-period price table. This makes it easy to spot cost anomalies—for example, a batch job accidentally running during peak hours.

    5. Engineering-Level Optimization Suggestions

    5.1 Improve the Cache Hit Rate

    • Place stable content—system prompts, role definitions, fixed examples—at the front of the request to keep the prefix consistent.
    • Avoid inserting fields that change every time, such as timestamps or request IDs, into the prefix.
    • Use unified templates for similar requests to reduce prefix divergence.

    5.2 Control Output Length

    Output is priced higher, so generation length should be controlled. You can reduce costs by setting a maximum output token limit, requesting structured output, and removing redundant greetings and repeated summaries.

    5.3 Tiered Task Scheduling

    Classify tasks into real-time, near-real-time, and offline categories. Keep real-time tasks running during peak hours, and use queues to execute offline tasks uniformly during off-peak hours. Message queues and scheduled task schedulers can both handle this.

    5.4 Cost Control for Retries

    Retries are billed repeatedly. Set an upper limit on retries and distinguish between retryable error types. For failures caused by overly long input, truncate the content before retrying to avoid repeatedly consuming input tokens.

    6. How to Judge Whether a Pricing Scheme Is Acceptable

    There is no single answer that works for every team. You can evaluate it along these dimensions:

    1. Cost predictability: Are the billing items clear, and can usage be estimated in advance?
    2. Load alignment: Does the pricing match your traffic pattern? Teams whose traffic concentrates during the day are affected by peak/off-peak pricing very differently from teams whose traffic concentrates at night.
    3. Room for optimization: Can caching, output control, and task scheduling significantly reduce costs?
    4. Transparency: Are pricing rules, billing methods, and change notices fully published?

    It is recommended that teams first replay historical logs to estimate monthly costs under both the old and new pricing structures, then decide whether to adjust the architecture based on business priorities. Looking only at unit price changes rarely leads to a reliable conclusion.