LLM Inference Costs and Quota Pricing: Starting from the Compute Baseline

    This article explains how the cost of large language model inference determines pricing for API services and quota plans. It breaks down the three main cost components (prefill vs. decode computation, GPU memory usage, and device utilization), reviews key optimization techniques such as continuous batching, prefix caching, quantization, and speculative decoding, and presents a simplified framework for estimating cost per million tokens. It also covers the logic behind tiered quotas and discount design, along with engineering practices for keeping cost models accurate.

    1. Background: How Inference Costs Determine Pricing

    The pricing of LLM services looks like a marketing question, but underneath it is a cost question. Every request consumes GPU (or other accelerator) time, memory, and power. Only by amortizing these costs over each million tokens can a provider judge whether a price is sustainable.

    In practice, quota limits, discount depth, and promotion periods are all governed by one constraint: how much compute the average user actually consumes. When a quota is set above real usage levels, the provider may temporarily absorb losses, but as the user base and usage patterns change, the cost curve can reverse the conclusion. Understanding the cost structure matters more than memorizing any specific price.

    2. The Basic Components of Inference Cost

    Inference cost comes mainly from three parts.

    1. The computational difference between input and output

    LLM inference has two phases. The prefill phase processes all input tokens at once; it is compute-heavy but highly parallelizable. The decode phase generates output tokens one by one, and each step must read model weights and the history cache, making it bound by memory bandwidth. Long inputs and long outputs therefore have different cost structures, and a simple linear estimate based on character count often leads to errors.

    2. Memory usage

    GPU memory must hold both model weights and the KV cache. The KV cache grows with context length and the number of concurrent requests. The longer the context and the higher the concurrency, the fewer requests a single accelerator can serve, and the higher the unit cost.

    3. Device utilization

    Idle devices still incur fixed costs. If request volume fluctuates and the peak-to-trough gap is large, average utilization drops and the per-token cost rises significantly. This is a major reason many providers struggle to be profitable during low-price phases.

    3. Key Techniques That Affect Unit Cost

    The following optimizations directly affect the cost per million tokens.

    • Continuous batching: dynamically merging requests that arrive at different times into the same batch, improving device utilization.
    • Prefix caching: reusing already-computed KV cache for identical system prompts or repeated contexts, reducing prefill computation.
    • Quantization: compressing weights from high precision to low precision (for example, 8-bit or 4-bit integers), reducing memory footprint and bandwidth pressure. Quantization introduces some accuracy loss and must be validated with evaluation sets.
    • Speculative decoding: a smaller draft model predicts multiple tokens first, and the main model verifies them in one pass—useful for latency and throughput optimization in the decode phase.
    • Parallelism strategies: tensor parallelism and pipeline parallelism allow large models to run across multiple GPUs, but they add communication overhead and must be chosen based on hardware topology.

    These techniques are usually combined. Operator fusion and memory layout adjustments made by inference engines for specific model architectures also bring considerable gains. However, the benefit of any optimization depends on the specific model and hardware; figures from other setups cannot be applied directly.

    4. A Framework for Estimating Cost and Pricing

    A simplified model can estimate unit cost. The values below are only for illustrating the method.

    1. def cost_per_million_tokens(
    2. device_hour_price: float, # hourly cost per device (yuan)
    3. tokens_per_second: float, # peak throughput per device (tokens/second)
    4. utilization: float # average utilization, between 0 and 1
    5. ) -> float:
    6. effective_tps = tokens_per_second * utilization
    7. tokens_per_hour = effective_tps * 3600
    8. return device_hour_price / tokens_per_hour * 1_000_000
    9. # Example: device cost 10 yuan/hour, peak 2000 tokens/second
    10. print(cost_per_million_tokens(10, 2000, 0.5)) # 50% utilization
    11. print(cost_per_million_tokens(10, 2000, 0.25)) # 25% utilization

    The results show that when utilization falls from 50% to 25%, the unit cost doubles. The same hardware can cost several times more per token at different traffic levels. Pricing must use the real utilization distribution, not peak throughput.

    Beyond this, a provider should also account for:

    • the weighted average cost across different input and output lengths;
    • non-compute costs such as networking, storage, and operations;
    • the effect of cache hit rates on effective throughput;
    • the impact of queueing latency during peak hours on user experience.

    5. Common Logic Behind Quota and Discount Design

    Fixed or tiered quotas are essentially a price lever for guiding user behavior. Common design approaches include:

    1. Tiered quotas: higher plan tiers come with higher quota ceilings, separating light users from heavy users.

    2. Long-tail usage monitoring: most users consume little, while a small number of high-frequency users may account for most of the cost. Quota design should start by observing the usage distribution before setting limits.

    3. Observation windows: promotions or temporary quota adjustments should have a clearly defined observation period, using real data to validate assumptions. A single week of usage data is rarely enough to draw long-term conclusions.

    4. Cost ceilings: subsidy-style strategies require calculating the maximum loss exposure in advance and setting a budget threshold to keep losses within tolerance.

    When a discount is unusually deep, it usually means the provider has made targeted optimizations at the inference layer or changed the deployment approach—for example, moving from proxying third-party APIs to running its own inference cluster. Such changes directly alter the cost structure, but the actual effect must be verified with measured data.

    6. Engineering Recommendations

    1. Build continuous cost monitoring that tracks device utilization and token throughput by model, request type, and time period.
    2. Before shipping a new optimization, validate both quality and performance on a fixed evaluation set—do not look at speed alone.
    3. Price or rate-limit long-context requests separately, so that a small number of requests do not drag down overall cost.
    4. Set budget caps and rollback conditions for promotions to keep losses controllable.
    5. Regularly review pricing assumptions and feed actual utilization and user growth data back into the cost model.

    As long as the cost model is accurate enough, pricing decisions can shift from experience-based judgment to a verifiable engineering problem.