LLM API Pricing: How Input and Output Token Costs Affect Model Selection
Understand how input and output token pricing shapes LLM API costs, estimate monthly spending, and reduce inference expenses through context management, model routing, caching, and output limits. Learn why model selection should account for task success and total operating costs—not just published token rates.
1. Why Developers Focus on API Pricing
When a new large language model enters beta testing or announces its pricing, the most active discussions often center on cost rather than capability rankings. One representative community comment captures the sentiment: “Still too expensive. My target would be RMB 0.5 for input and RMB 1 for output.”
The reaction reflects developers’ sensitivity to inference costs. In production applications, models may be called frequently enough that small differences in unit prices become substantial at scale. For an application handling a million requests per day, even a difference of a few hundredths of a yuan in per-request cost can translate into tens of thousands of yuan per month.
The useful question, then, is not simply whether an API is “expensive.” It is how to calculate its cost for a particular workload—and how to reduce that cost.
2. Why Input and Output Tokens Have Different Prices
Most LLM APIs use token-based billing, with separate rates for input and output. There are technical and practical reasons for this distinction.
Computational costs are asymmetric
During inference, output generation requires repeated decoding steps as the model produces tokens sequentially. This generally makes output tokens more expensive to process than input tokens.
Input processing also requires computation during the prefill stage, but input tokens can be processed in parallel more efficiently. As a result, output rates are commonly higher than input rates. An input price around half the output price is a common pattern, though the ratio varies.
Workloads have different cost profiles
Consider illustrative rates of RMB 0.5 per million input tokens and RMB 1 per million output tokens. These figures are used only to demonstrate the calculation; they are not a quote from any provider.
Different applications distribute costs differently:
- Long-document summarization: Input tokens greatly outnumber output tokens, so input processing drives most of the bill.
- Code generation and content creation: Output tokens account for a larger share of usage, making output pricing more important.
- Multi-turn conversations: Conversation history is repeatedly included in subsequent inputs. If the full history is retained and each turn adds a similar amount of text, cumulative input usage can grow approximately quadratically with the number of turns.
Understanding this asymmetry is the first step toward controlling costs.
3. A Simple Model for Estimating API Costs
Before selecting a model, estimate spending using the expected token volume and request frequency:
Cost per request ≈(Input tokens × Input rate + Output tokens × Output rate) / 1,000,000Monthly cost = Cost per request × Average daily requests × 30
Here, input and output rates are prices per million tokens, expressed in the same currency.
For example, suppose a customer support application averages 3,000 input tokens and 500 output tokens per request. Using the illustrative rates above:
Cost per request =(3,000 × 0.5 + 500 × 1) / 1,000,000= RMB 0.002At 100,000 requests per day:Monthly cost ≈ 0.002 × 100,000 × 30= RMB 6,000
The example highlights an easily overlooked fact: input token volume can be the largest contributor to the bill, even when input tokens have a lower unit price.
In multi-turn applications, sending the entire conversation history with every request can rapidly increase spending as conversations grow longer. Cost optimization therefore often depends more on disciplined input management than on simply switching to a cheaper model.
4. Practical Engineering Techniques for Reducing Costs
1. Trim context and compress conversation history
For multi-turn conversations, retain only the history relevant to the current request, or periodically summarize earlier exchanges.
A common approach combines relevance filtering with a time window: keep recent context and older information that remains useful. This can substantially reduce input token volume.
2. Route tasks to appropriately sized models
Not every request requires a flagship model. A lightweight model or rules engine can classify intent, allowing simple tasks to go to smaller models while reserving larger models for complex reasoning.
This model-cascade approach is a widely used way to improve cost efficiency without treating every request as equally demanding.
3. Cache and reuse results
Use answer caching for frequently repeated questions.
For long, stable system prompts, use provider-supported prefix caching where available. Reusing cached prefixes can reduce the cost and latency of processing repeated input.
4. Limit output length
Specify the desired response length in the system prompt and set a maximum output token limit to prevent unnecessarily long responses.
Because output tokens typically cost more, reducing excess output produces direct savings.
5. Use batch processing and flexible scheduling
For offline workloads that do not require immediate responses—such as data labeling or bulk document processing—use batch inference APIs where available. These often offer meaningful discounts.
Such workloads can also be scheduled outside peak periods when the service’s pricing or operating conditions make that beneficial.
5. How to Judge Whether a Model Is Too Expensive
A useful evaluation framework considers three layers of cost.
- Published price: Compare input and output token rates across models with similar capabilities. Distinguish beta pricing from standard production pricing.
- Effective cost: Account for task success and output quality. A cheaper model may cost more in practice if it requires repeated attempts or manual rework.
- End-to-end cost: Include the engineering effort required for context management, caching, operations, and monitoring. Investing in optimization can sometimes deliver greater savings than waiting for lower prices.
The original discussion also reflects price reductions among major cloud platforms in China, where some model services have become cost-effective for general-purpose tasks. That market context should not be assumed to apply equally across regions. For a deployment decision, compare providers relevant to your environment and validate them through a limited rollout before scaling up.
6. Conclusion
Debates about rates such as “RMB 0.5 for input and RMB 1 for output” reflect a practical concern: making LLM applications affordable at production scale.
Price matters, but it is not the only factor in model selection. A complete cost-management approach combines token-based estimates, context management, tiered model routing, and cache reuse.
As model capabilities evolve and pricing changes, building these engineering practices is more useful than focusing on a single advertised rate. The goal is not merely to buy cheaper tokens, but to understand and control the cost of delivering successful results.
