How to Calculate LLM Costs Under Peak and Off-Peak Pricing

    A practical breakdown of how time-based pricing changes LLM cost structure, why per-token price is a poor metric, and how to measure end-to-end cost per task. Includes a peak-hour benchmark across eight real engineering tasks, plus an optimization checklist covering off-peak scheduling, model tiering, and context trimming.

    1. What the Price Hike Debate Is Really About: From “Cheap Per-Token” to “Controllable Total Cost”

    A cloud provider recently introduced time-based pricing for its LLM services. Peak-hour per-token rates rose several times over, with the increase on cache-hit tokens standing out in particular, and the change has drawn wide discussion in developer communities. The core of the controversy is not the price increase itself, but the fact that the new price structure invalidates existing cost assumptions: cache hits used to be treated as a reliable way to cut costs, and now that same line item has become a major source of peak-hour spending.

    Time-based pricing is worth clarifying up front: it is a common practice in compute scheduling. The logic is to use price signals to shift deferrable batch workloads into off-peak windows, which raises overall resource utilization. What developers actually need to internalize is this: whether a model service is cost-effective cannot be judged by the per-million-token rate alone; it has to be judged by the end-to-end cost of completing one business task.

    End-to-end cost can be abstracted as follows:

    1. Total task cost = input tokens × input rate
    2. + output tokens × output rate
    3. + cache-hit tokens × cache rate
    4. + extra consumption from failed retries

    The fourth term is the one most often overlooked. If the model gets rate-limited or times out during peak hours and the request is retried, actual spending can grow faster than the nominal rate increase suggests. Cost accounting therefore has to include a reliability dimension.

    2. Breaking Down the Bill: Three Key Cost Variables

    Input and output grow asymmetrically. Looking at the revised price structure, output rates were generally raised more than input rates. This hits generative workloads harder, because in code generation and report writing the output token count is far higher than the input. The right approach is to estimate the input-to-output ratio of a task first, then judge how sensitive you are to the increase.

    The double-edged effect of cache hits. Caching reduces repeated overhead by reusing already-computed context, and the payoff is clear in long-context, multi-turn iteration scenarios. But once the cache rate is raised significantly, a high hit rate means spending becomes concentrated in that one line item. At that point it is worth re-evaluating whether “stuff the entire project context into the prompt at once” is still economical.

    The cost-performance inflection point of model tiering. The same requirement run on models of different capability tiers can differ in cost by several times. In testing, one full-stack development requirement took about seventeen minutes and cost just over three yuan on a high-capability model; a lightweight model took about nineteen minutes and cost just over one yuan. The time gap was small while the cost gap was clear, which suggests many tasks do not need the highest capability tier.

    3. Test Method: Eight Task Categories and a Peak-Hour Run

    To validate the points above, the author ran eight categories of real engineering tasks during peak hours using an AI coding tool paired with a high-capability model, with every task held to a “runnable and acceptable” standard:

    1. Frontend development: build a responsive data dashboard from scratch, including charts, lists, search and filtering, and mobile adaptation — about twelve minutes, costing 1.8 yuan.
    2. Backend development: implement user management APIs covering CRUD, pagination, parameter validation, and error handling; all 28 API tests passed — about four minutes, costing 0.7 yuan.
    3. Full-stack development: complete a task management system with frontend, backend, data persistence, and integration — about seventeen minutes, costing 3.3 yuan, the most expensive task.
    4. Bug fixing: four categories of defects were pre-planted (search, data display, mobile layout, runtime errors); the model located, fixed, and verified them on its own — about three minutes, costing 0.9 yuan.
    5. Data analysis: clean, analyze, and report on roughly 1,000 business report records containing missing, duplicate, and anomalous values — about six minutes, costing 1.2 yuan.
    6. Office automation: clean, merge, aggregate, and summarize three months of sales records in a spreadsheet into a summary file — about ten minutes, costing 1.7 yuan.
    7. Image processing: write and run a script to resize, compress, and watermark ten images of different dimensions and report total file size — about four minutes, costing 0.8 yuan.
    8. Web automation: write a script for filling, clicking, verifying, and testing exception scenarios on a fixed registration page — under two minutes, costing 0.4 yuan, the cheapest task.

    The eight tasks together cost about 10.9 yuan. The pattern in the data is clear: the closer a task gets to end-to-end delivery, the higher the cost; the more clearly bounded the task and the shorter the output, the lower the cost.

    4. Cost Optimization Checklist

    • Schedule off-peak: move deferrable work such as batch data processing, report generation, and dependency upgrades into off-peak windows, and keep only interactive and blocking tasks in peak hours.
    • Tier your model selection: route by task difficulty — lightweight models for simple scripts and format conversion, high-capability models for architecture design and complex integration.
    • Trim context: inject only the files and snippets relevant to the task instead of feeding in the whole repository; keep stable prefixes in a fixed order to improve cache reuse.
    • Control output length: define acceptance criteria and the scope of deliverables clearly to cut redundant explanatory output.
    • Set up observability: use logging services and monitoring alerts to record token consumption and elapsed time for every task, forming a cost baseline — without one, you cannot tell whether an optimization actually worked.

    5. Conclusion

    Time-based pricing is itself a neutral resource scheduling mechanism; whether it is acceptable depends on whether tasks can be orchestrated sensibly. The tests show that even during peak hours, the total spend across eight categories of engineering tasks stayed in the single-digit to roughly ten yuan range, and costs for most common development scenarios remain controllable. The capability developers really need to build is turning “per-token price anxiety” into an engineering metric of cost per unit task, then continuously improving it through off-peak scheduling, model tiering, and context trimming.