How to Model LLM Cost: Limited-Time Discounts and Cache Price Cuts

    This article explains how to build a reusable cost model for LLM API pricing when providers offer limited-time discounts on flagship models and long-term price cuts on cached input. It defines a common three-part billing structure (cache hit input, cache miss input, output), provides Python functions for per-call cost and budget capacity, and works through a 40-yuan budget example across four pricing tiers. It also shows how to solve for the break-even cache hit ratio and lists practical ways to raise hit rates, ending with selection advice based on input/output length and prefix stability.

    1. The Problem: What Discounts and Cache Price Cuts Actually Change

    LLM pricing changes usually come in two forms: a limited-time discount on a flagship model, and a long-term reduction in the price of cache-hit input tokens. The first affects short-term cash flow; the second affects long-term structural cost. Many teams migrate the moment they see a steep discount, overlooking one premise: the real bill is not determined by unit price alone, but by input length × cache hit ratio + output length.

    The right approach is not to compare unit prices, but to build a reusable cost model that takes the discount, cache hit ratio, context length, and request frequency as variables, and produces the true cost and supportable call volume for your own scenario.

    2. Defining a Common Billing Basis

    Billing dimensions differ slightly across providers, but they can usually be abstracted into a three-part structure:

    • Cache hit input: the lowest unit price, and the main source of savings from long-context reuse;
    • Cache miss input: the highest unit price, typically including the cost of the first write into the cache;
    • Output: generally priced above cache miss input, and the main cost driver for long-form generation.

    Another common approach uses a “credit package + conversion factor” basis, where a fixed budget maps to a fixed credit allowance and different model tiers consume credits at different factors. The two bases can be converted into each other; the key is to unify the unit before comparing.

    A schematic cost function looks like this:

    1. def per_call_cost(in_tokens, out_tokens, hit_ratio,
    2. p_hit, p_miss, p_out):
    3. """Cost per call; all prices in CNY per million tokens"""
    4. hit = in_tokens * hit_ratio
    5. miss = in_tokens * (1 - hit_ratio)
    6. return (hit * p_hit + miss * p_miss + out_tokens * p_out) / 1_000_000
    7. def budget_capacity(budget, cost_per_call):
    8. """Calls and total token throughput a budget can support"""
    9. calls = budget / cost_per_call
    10. return calls, calls * (in_tokens + out_tokens)

    3. A Worked Example: How Many Calls a 40 CNY Budget Buys

    Assume a typical long-context personal assistant scenario: a budget of 40 CNY, 51,000 input tokens per call, 5,100 output tokens per call, 56,100 tokens per call in total, and a 56% input cache hit ratio. That splits into roughly 28,560 hit tokens and 22,440 miss tokens.

    Comparing four typical pricing structures under the same basis (low-price small model, mid-price small model, discounted flagship model, full-price flagship model) yields the following order-of-magnitude results:

    • Low-price small model: about 0.037 CNY per call, roughly 1,070 calls for 40 CNY, about 60 million tokens in total;
    • Mid-price small model: about 0.038 CNY per call, roughly 1,043 calls, about 58.51 million tokens;
    • Discounted flagship model: about 0.105 CNY per call, roughly 381 calls, about 21.36 million tokens;
    • Full-price flagship model: about 4× the discounted per-call cost, with call volume and throughput shrinking to roughly one quarter.

    These numbers show three things. First, the discount does pull the flagship model back from “not viable” into an “worth evaluating” range. Second, even discounted, the flagship model’s unit cost remains significantly higher than the small model’s. Third, when the hit ratio rises from 56% to around 80%, the discounted flagship model and the low-price small model converge in cost — that is the key decision point for model selection.

    4. Calculating the Break-Even Hit Ratio

    Rather than judging by feel, solve for the break-even hit ratio directly. Set the per-call cost of the two options equal:

    1. in*(h*p_hit_A + (1-h)*p_miss_A) + out*p_out_A
    2. = in*(h*p_hit_B + (1-h)*p_miss_B) + out*p_out_B

    Substitute the known unit prices and you can solve for a single h. The engineering rule of thumb: the larger the gap between cache miss and cache hit unit prices, the lower the break-even hit ratio and the more visible the gains from cache optimization; the higher the output share, the weaker the hit ratio’s effect on total cost. So tasks with long input and short output (codebase Q&A, document review) should prioritize cache reuse, while long-output tasks (long-form generation, batch rewriting) should focus on output unit price and concurrent throughput.

    5. Where Cache Hit Ratios Come From

    Hit ratio is not a configuration item; it is a by-product of your call pattern. Actionable ways to raise it include:

    1. Stable prefix: put the system prompt, tool definitions, and long-term background material at the very front of the request and keep it byte-stable, avoiding timestamps or random IDs in the prefix;
    2. Fewer needless changes: move volatile template fields to the end so the whole prefix does not get invalidated;
    3. Higher reuse density: issue requests from the same family within the cache validity window, avoiding long idle gaps that let the reuse window expire;
    4. Structured chunking: split very long documents along stable boundaries so chunk-level reuse becomes possible;
    5. Observability: instrument the application side to track hit ratio, average input/output length, and per-call cost, forming a cost dashboard with alerts.

    6. Conclusion and Selection Advice

    A limited-time discount is a short-term bonus; a long-term cache price cut is the structural optimization. Teams should proceed in three steps: first unify the billing basis and build the cost function; then plug in your real task’s input/output distribution and measured hit ratio to compute per-call cost and supportable call volume; finally use the break-even hit ratio to decide whether cache-reuse engineering work is worth the investment. If the task is mostly short input and short output and interactive, a small model with a credit package is more economical. If the task needs stronger reasoning and the prefix is highly stable, a discounted flagship model offers stage-specific value for money during the discount period. If output share is extremely high, the optimization focus should be on the output side and concurrency scheduling, not on chasing cache discounts.