Understanding LLM API Peak and Off-Peak Pricing: Token Ratios and Cost Optimization
This article breaks down why large model API price adjustments often look random on the surface but actually converge the price ratios across input tokens, output tokens, and cached tokens. It presents a cost model with peak and off-peak multipliers, explains the rationale behind time-based pricing, and outlines practical strategies such as prompt structuring, output constraints, off-peak scheduling, observability, and elastic deployment to help developers align token structure and scheduling with the new pricing ratios.
1. The Phenomenon and the Essence: Why Price Changes Look Random
A cloud provider adjusted its large model API billing in mid-August. On the surface, prices for different tiers moved in different directions—some up, some down. But if you align the before-and-after prices across three token categories—input tokens, output tokens, and cached tokens—the changes are not random. Instead, the adjustment converges the price ratios among the three token types into a unified proportional relationship. In other words, the absolute price changes are the surface; the restructuring of the ratios is the core of this adjustment.
This distinction matters. When estimating costs, developers often remember only one number: price per thousand tokens. A real bill, however, is a weighted sum of three token types at different unit prices. When the ratios change, the same workload can produce a higher or lower bill depending on your input-output structure, cache hit rate, and the time distribution of your calls.
2. Cost Model: Turning the Bill into a Computable Formula
Let the input token unit price be p_in, the output token unit price be p_out, the cached token unit price be p_cache, the peak-hour coefficient be α (greater than 1), and the off-peak coefficient be β (less than 1). The expected cost of a single call can be written as:
Cost = (N_in * p_in + N_out * p_out + N_hit * p_cache) * f(t)f(t) = α (peak) or β (off-peak)N_in = N_total_in - N_hit
This model shows three things. First, output is usually more expensive than input, so long-text generation workloads are extremely sensitive to p_out. Second, cache hits can push the unit price of repeated prefixes very low, making them the most elastic item in ratio adjustments. Third, the time coefficient f(t) is a multiplier, not an addend, so off-peak shifting produces more noticeable absolute savings for high-volume workloads.
3. Why Peak and Off-Peak Pricing Makes Sense
Time-based pricing is not artificial complexity. It passes the supply-side capacity cost structure through to the demand side. Inference clusters need compute, memory, and bandwidth reserved for peak load. Peak-hour calls compete for the scarcest elastic capacity, while off-peak calls use resources that would otherwise sit idle. Using price signals to shift deferrable workloads is more economical than simply adding capacity.
For developers, this leads to a clear engineering action: separate “real-time interaction” from “deferrable batch processing.” The former is latency-sensitive and should stay in peak hours; the latter only needs sufficient throughput and can be scheduled for off-peak windows.
4. Practical Impact of Unified Token Ratios
Once the ratios are unified, comparability improves. Previously, unit price structures differed across tiers, so comparing costs across models required repeated conversions. With unified ratios, you can evaluate options horizontally using the same formula. At the same time, the value of caching is priced more clearly, encouraging engineering teams to actively reuse prefixes and results.
Note that unified ratios do not mean lower total costs. If your workload is dominated by long outputs and concentrated in peak hours, the bill may rise. If your workload has high input repetition and can be shifted off-peak, it will most likely fall.
5. Actionable Optimization Strategies
- Structural optimization: trim redundant prompts, keep system prompt prefixes stable, and improve cache hit rates.
- Output constraints: use structured output and length limits to control N_out and avoid unbounded generation.
- Off-peak scheduling: place batch jobs in a queue and consume them during off-peak windows.
def estimate_cost(n_in, n_out, n_hit, p_in, p_out, p_cache, factor):return (max(n_in - n_hit, 0) * p_in+ n_out * p_out+ n_hit * p_cache) * factordef schedule(task, now, peak_hours):return "peak" if now in peak_hours and task.latency_sensitive else "valley"
- Observability: aggregate token consumption by business dimension through logging services and monitoring alerts, and set budget threshold alerts.
- Elastic capacity: run stateless inference services on a container platform, use message queues to smooth peaks, and store intermediate results in object storage.
6. Conclusion
The technical meaning of this price adjustment is replacing scattered absolute price differences with a unified proportional relationship, layered with a time-based price signal. Developers should shift their focus from “did the unit price go up or down” to “does my token structure and scheduling strategy match the new ratios.” In general practice on platforms such as Baidu AI Cloud, the core of cost governance has always been three things—modeling, measurement, and scheduling—rather than chasing a single price number.
