LLM API Costs: Why Identical Token Prices Can Produce Different Bills
Identical published token prices do not necessarily mean identical LLM API bills. This article explains how batch processing, off-peak pricing, subscriptions, and context caching affect total costs, highlights less obvious billing considerations, and outlines practical routing and caching strategies for reducing inference spending.
LLM API Costs: Why Identical Token Prices Can Produce Different Bills
As large language model (LLM) applications move into production, developers face an increasingly complex choice of cloud providers and API aggregators. During initial evaluation, they may find that several platforms advertise nearly identical pay-as-you-go prices for the same model. Yet once an application is running, monthly bills can differ by 50% or more.
Why can the same token price lead to such different costs? The answer lies in billing rules and traffic scheduling—not just the headline rate. This article takes a vendor-neutral look at those mechanisms and the engineering practices that help control LLM API spending.
1. What Published Token Prices Actually Tell You
A published rate is a platform’s standard pay-as-you-go price, usually quoted per million tokens. Pricing commonly distinguishes between input tokens, cached input tokens, and output tokens.
For illustration, the source pricing example uses a high-performance model with rates of approximately CNY 20 per million input tokens, CNY 2 per million cached input tokens, and CNY 100 per million output tokens. A lighter-weight or coding-oriented version has lower rates, such as CNY 6.5 for input and CNY 27 for output.
These figures illustrate the pricing relationships; they should not be treated as universally available international rates.
If two platforms charge the same standard rates for the same model version, and requests have the same billable token usage without additional pricing rules, their token charges should match.
The differences emerge from pricing arrangements beyond those published rates and from how requests are scheduled.
2. Three Billing Mechanisms That Can Change the Total
2.1 Offline Batch Processing for Non-Real-Time Tasks
Not every inference task needs an immediate response. Summarizing large document collections, extracting structured data from historical records, and processing content moderation jobs overnight can all tolerate higher latency.
Some platforms offer offline batch processing for these workloads. Users submit requests in batches, and the platform processes them when capacity is available. In exchange for delayed results, the platform may offer a discount of roughly 40%, charging about 60% of the standard pay-as-you-go rate.
Separating latency-tolerant work from interactive requests can therefore reduce the cost of that portion of a workload by nearly half.
2.2 Token Subscriptions and Off-Peak Scheduling
Another approach combines prepaid token subscriptions with off-peak pricing. Some platforms apply different rates during busy and quiet periods, either within a subscription or for usage beyond its allowance.
For example, calls during an evening peak window, such as 20:00–23:00, may be charged at the standard rate or receive a smaller discount. Calls during an off-peak window, such as 00:00–18:00 the following day, may qualify for substantially lower prices. These windows depend on the platform’s billing schedule.
Under the pricing scenario described here, moving roughly half of inference requests into off-peak hours through a queue could reduce the overall bill by about 48%. Even without extensive rescheduling, combining a subscription with off-peak pay-as-you-go overages could save approximately 12%–24% compared with standard pay-as-you-go billing.
These savings depend on the actual plan terms and the share of traffic that can be shifted.
2.3 Context Caching to Reduce Repeated Input Costs
Multi-turn conversations and long-context workloads often send the same prompt prefix repeatedly. Context caching reduces the computation needed to process that repeated input.
Cached input may cost around 10% of the standard input rate—for example, CNY 2 rather than CNY 20 per million tokens in the illustration above.
Some platforms apply automatic caching by default, with a default time to live (TTL) of five minutes and an option for a one-hour TTL. In frequent multi-turn interactions, cache hit rate can have a substantial effect on total spending.
3. Billing Details That Are Easy to Miss
3.1 Cache Writes May Be Billed Separately
Cheap cache reads do not necessarily mean that caching is free to initialize. Cache writes may carry separate charges, potentially differing between five-minute and one-hour TTLs.
For example, the source describes a K-series model family that bills cache writes separately according to those TTL options. If requests are infrequent, a cache entry may expire before it is reused. In that case, caching can add write costs without delivering meaningful read savings.
Evaluate session frequency against cache lifetime before assuming that a longer TTL or more aggressive caching will reduce costs.
3.2 Model Retirement Can Change Your Budget
Model versions evolve quickly, and older versions may be withdrawn. In the provider example described in the source, an early version stopped accepting newly registered users from late October and was scheduled for full retirement by year-end.
Applications hard-coded to a specific version can then face a forced migration. A recommended upgrade—for example, from K2 to K3.1 Pro in that example—may change both token rates and context-window limits, affecting the application’s budget.
Such retirement schedules are provider-specific rather than universal timelines.
3.3 Regional Pricing Can Add a Premium
Global deployments and cross-cloud architectures should account for regional pricing differences.
A provider may charge the same rates across several domestic regions while applying a premium to an overseas region. In the source example, input and output rates for a Singapore endpoint were approximately 10% higher.
Regional premiums, exchange-rate effects, and cross-border network latency can all influence the cost and practicality of a deployment. Do not assume that a rate available in one region applies everywhere.
4. Engineering Practices for Lower LLM API Costs
Understanding billing rules is only the first step. Putting them into practice requires flexible routing and caching at the application level.
A useful architecture is an intelligent routing and caching gateway between the application and its LLM APIs.
4.1 Classify Tasks and Route Them Dynamically
Avoid sending every request through the same processing path. Introduce a message queue and an API gateway that distinguish between interactive and latency-tolerant work.
# Pseudocode: intelligent routing for LLM API requestsdef llm_gateway(request_payload):task_type = request_payload.get("type")if task_type == "realtime_chat":# Real-time chat: prioritize latency using pay-as-you-go# or subscription-based access.return call_api_realtime(request_payload)elif task_type == "batch_summary":# Batch summaries: queue for off-peak execution# or submit through a Batch API.enqueue_task(request_payload, schedule="off_peak")return {"status": "queued", "discount": "up_to 60%"}elif task_type == "background_extract":# Nonurgent extraction: use a Batch API,# billed at 60% of the standard rate in this example.return call_api_batch(request_payload)
The functions above are illustrative placeholders, not specific provider interfaces. The discount field is also illustrative rather than a guaranteed billing outcome; paying 60% of the standard rate corresponds to a 40% discount.
This separation preserves responsiveness for interactive users while allowing background work to benefit from batch or off-peak pricing.
4.2 Integrate Caching Into the Gateway
For multi-turn conversations, the gateway can maintain a hash mapping between each session ID and its prompt-prefix hash.
Before sending a request, check the API-side cache state, where available, together with the locally tracked TTL. This helps determine whether the repeated prefix is likely to qualify for cached-input pricing.
For sessions approaching a five-minute inactivity threshold, a local strategy might trigger a warm-up request or adjust conversation handling. However, warm-up requests should be evaluated against their own cost and the likelihood of another cache hit; they should not become unnecessary recurring traffic.
The goal is to align cache lifetime and write behavior with actual conversation activity, avoiding cache creation that produces little reuse.
4.3 Prefer Nearby API Infrastructure
When published token prices are similar, network latency and bandwidth charges become more important selection factors.
A practical starting point is to evaluate the LLM API offered by the cloud where the application already runs. Where supported, access within the same VPC can avoid public-network traffic charges and keep the network component of latency low—potentially in the single-digit millisecond range.
That is not a guarantee of end-to-end inference latency. Availability and network behavior depend on the service and deployment configuration. Nevertheless, reducing network overhead can be particularly valuable for agent applications that make multiple sequential model calls.
5. Conclusion
LLM API cost optimization is no longer simply a matter of comparing prices per million tokens. It also depends on architecture, scheduling, and the details of each platform’s billing model.
Identical published rates can produce very different bills when workloads use batch processing, off-peak scheduling, subscriptions, and context caching differently. Cache-write charges, model migrations, and regional premiums can further change the outcome.
By understanding those rules and building a flexible routing and caching gateway, developers can reduce inference spending while preserving the responsiveness their applications require.
