LLM Inference Pricing Structure and Cost Optimization: A Practical Guide

    This article explains the core pricing components of LLM inference services, including input/output token fees, context caching, and tiered model versions. It provides a reusable cost-estimation formula and practical engineering methods for reducing inference costs through higher cache hit rates, output-length control, and workload-based version selection.

    LLM Inference Pricing Structure and Cost Optimization: A Practical Guide

    As large model applications move from pilots to scaled production, inference cost has become one of the metrics technical teams watch most closely. Understanding how LLM inference services are billed—and designing request and caching strategies around that billing model—can often reduce overall costs several-fold without changing model capabilities. Using a typical flagship inference model pricing plan as an example, this article explains its price structure and presents actionable cost optimization methods.

    1. Basic Components of LLM Inference Billing

    Mainstream LLM inference services generally use token-based billing. The core structure can be divided into two major parts: base token fees and context caching fees.

    1. Base token fees

    Base token fees are split into input and output, usually priced per million tokens (MTok). Input tokens refer to prompts, system instructions, conversation history, and other content sent to the model. Output tokens refer to the response generated by the model. Because generation is computationally much more expensive than reading, the output token price is typically 4–6 times the input price.

    2. Context caching fees

    Context caching is an important capability in recent inference services. When multiple requests share a large repeated prefix—such as a fixed system prompt, knowledge base documents, or tool definitions—the service can cache the computation results for that prefix. If subsequent requests hit the cache, those tokens are billed at a much lower cache-hit price instead of the full input price.

    Cache-related billing is generally divided into three items:

    • Cache hit: Tokens that hit an existing cache are billed at a very low price, usually only one tenth of the normal input price.
    • Cache write (short-lived): Content written to a cache with a validity period of about 5 minutes is usually priced at the same level as normal input.
    • Cache write (long-lived): Content written to a cache with a validity period of about 1 hour is usually priced at about 2 times the normal input price.

    2. Interpreting a Typical Set of Price Data

    Taking the public pricing of a flagship inference model as an example, the latest-generation model has the following price structure (unit: RMB per million tokens):

    Billing item Standard High-speed Previous-generation model
    Input 13.00 26.00 20.00
    Output 68.00 136.00 100.00
    Cache hit 1.30 1.30 2.00
    Cache write (5 min) 13.00 26.00 20.00
    Cache write (1 h) 26.00 52.00 40.00

    This data reflects several industry trends worth noting:

    1. Clear generational price reductions. Compared with the previous generation, the new model’s input price is about 35% lower, output price about 32% lower, and cache-hit price about 35% lower. This is consistent with the industry’s overall direction of “higher capability, lower price”: engineering optimizations in inference efficiency—such as more efficient attention implementations, quantization, and scheduling optimization—continue to reduce unit costs, and the benefits eventually pass through to pricing.

    2. Tiered pricing for Standard and High-speed versions. The basic prices of the High-speed version are about 2 times those of the Standard version, but its cache-hit price is the same as Standard. The High-speed version typically provides more stable, lower-latency responses through reserved compute and optimized scheduling, making it suitable for latency-sensitive online interaction scenarios. The Standard version is suitable for asynchronous tasks, batch processing, and other scenarios with higher latency tolerance.

    3. Cache hits are a key lever for cost reduction. For the Standard version, the cache-hit price (1.30) is only one tenth of the normal input price (13.00). This means that as long as the cache hit rate for request prefixes is high enough, input-side costs can theoretically be compressed by nearly an order of magnitude.

    3. Cost Estimation: A Reusable Method

    Before integrating any inference service, it is advisable to build your own cost model. A general estimation formula is as follows:

    1. Cost per request = (uncached input tokens × input price
    2. + cached tokens × cache-hit price
    3. + newly written tokens × cache-write price
    4. + output tokens × output price) / 1,000,000

    For example, assume an intelligent customer service application has a system prompt and knowledge base prefix totaling 8,000 tokens (cacheable), each user question is about 200 tokens, and the model response is about 500 tokens. Using Standard billing:

    • Under ideal cache hits: 8,000 × 1.30 + 200 × 13.00 + 500 × 68.00 = 10,400 + 2,600 + 34,000 = 47,000 (before conversion from RMB/MTok), or about RMB 0.047 per request.
    • With no caching at all: 8,200 × 13.00 + 500 × 68.00 = 106,600 + 34,000 = 140,600, or about RMB 0.141 per request.

    Caching alone reduces the per-request cost by about 67%. When daily call volume reaches the order of 100,000 calls, this difference scales to a monthly cost gap of tens of thousands of RMB.

    4. Engineering Practices for Cost Optimization

    1. Maximize prefix reuse. Context caching is usually based on a prefix-matching mechanism. Therefore, immutable content—system instructions, tool definitions, and documents—should be placed at the very front of the request, while variable content—user input and timestamps—should be placed at the end. Avoid inserting random IDs or dynamic time fields into the prefix, as this breaks cache hits.

    2. Choose cache duration appropriately. Short-lived cache (about 5 minutes) has lower write cost and is suitable for continuous conversational interaction. Long-lived cache (about 1 hour) is suitable for periodic tasks or low-frequency batch calls with fixed prefixes. If the interval between calls often exceeds 5 minutes but is less than 1 hour, long-lived cache is often more cost-effective. You can calculate the hit rate from historical call logs before deciding.

    3. Control output length. Output tokens are much more expensive than input tokens and are a major cost driver. You can control output overhead by explicitly specifying length constraints in prompts, setting a maximum output token limit, and using “segmented generation plus programmatic concatenation” for long-text tasks.

    4. Select versions by scenario. Establish a routing mechanism: latency-sensitive scenarios such as real-time chat and code completion should use the High-speed version; asynchronous tasks such as document summarization, data cleaning, and offline evaluation should use the Standard version. Choosing the wrong version alone can create nearly double the unnecessary cost.

    5. Build cost monitoring and alerting. Write the token usage of each call—distinguishing input, output, and cache hits—to a logging service or monitoring and alerting system. Aggregate and analyze usage daily or by business line, and detect abnormal calls in time, such as prompt bloat or runaway retries.

    5. Conclusion

    The core of LLM inference cost management is understanding the common industry structure of “separate input/output pricing + tiered cache billing + tiered version pricing.” Beyond the natural price reductions brought by generational upgrades, cache hit rate, output-length control, and version selection are the three main levers developers can actively optimize. Teams should establish a cost estimation model and usage monitoring mechanism early in integration so that inference costs remain observable, predictable, and optimizable, laying an economic foundation for scaled application deployment.