Model Selection and Testing Methodologies Amid Plunging LLM Inference Costs
As LLM API prices drop drastically due to mature inference infrastructure, previously expensive use cases are becoming commercially viable. However, a low unit price does not guarantee a low final bill. This article explores the mechanics of LLM billing, detailing why input and output costs differ. It provides a four-step methodology to test models using your own workloads, build accurate cost models, and outlines five engineering practices that deliver greater cost savings than simply switching to a cheaper model.
1. Background: LLM Pricing Enters the Rock-Bottom Era
Recently, the pricing trend in the LLM API market can be described as a cliff-like drop. The input token unit price for flagship models has fallen to around 10 RMB per million tokens, and output prices have been pressed down to around 30 RMB. In horizontal comparison, the output price of some new-generation flagship models is only a quarter of the previous generation’s benchmark products, or even less than a tenth of top-tier closed-source models.
This reflects the overall maturity of inference infrastructure: higher GPU utilization, more aggressive quantization and speculative sampling strategies, and smarter KV Cache management have continuously lowered the marginal cost per token. For developers, this means application scenarios previously shelved because they were “too expensive”—such as long document analysis, batch content generation, and multi-turn Agent calls—suddenly possess commercial viability.
However, an attractive price tag does not equal an attractive actual bill. The token unit price is only half the cost story; the other half is hidden in how you call the API. The goal of this article is to provide a complete methodology from testing to estimation, helping teams make rational selection decisions in a low-price era.
2. Understanding the Billing Model: Why Input and Output are Priced Separately
Before hands-on testing, you must understand the billing structure of LLM APIs. Almost all mainstream vendors adopt an “input/output separately priced” model, and the output unit price is typically 2 to 4 times that of the input. This is not arbitrary pricing but based on clear engineering reasons:
- Input Phase (Prefill): The model processes the entire Prompt in parallel. It is compute-intensive but highly parallelized, yielding high throughput and a low unit cost.
- Output Phase (Decode): Tokens are generated autoregressively one by one. It cannot be parallelized, and the KV Cache must be repeatedly read for every generated token, making it the primary bottleneck for inference costs.
This difference directly determines the direction of cost optimization: controlling output length is more cost-effective than compressing input. For example, if your application generates a 100-word summary from a 2,000-word article, there are many input tokens but very few output tokens; such tasks are naturally cheap. Conversely, if it expands a single sentence into a long article, the cost structure is completely reversed.
Additionally, be mindful of a few hidden cost factors:
- System Prompt Repeat Billing: Every API call carries the System Prompt. In multi-turn conversations, historical messages are also repeatedly billed as input.
- Chain-of-Thought Tokens: For models with deep reasoning capabilities, the tokens generated during the internal reasoning process are usually also counted toward output fees. The actual consumption can be multiples of the visible reply.
- Cache Hit Discounts: Many platforms offer cache discounts for repeated prefixes. Scenarios with long, fixed System Prompts can save over 50% on input costs.
3. Testing Methodology: Don’t Just Look at Unit Prices, Run Your Own Workloads
Unit price comparison tables are everywhere, but truly meaningful testing must be based on your own business workload. Here is a recommended four-step, progressive testing plan:
Step 1: Build a Representative Test Set
Extract 50 to 200 real requests from online logs or simulated scenarios, covering typical cases like short Q&A, long document processing, code generation, and multi-turn conversations. Be sure to record the input token count and expected output length for each request, as this is the foundation for subsequent calculations.
Step 2: Unify Evaluation Dimensions
For quality assessment, it is recommended to adopt a dual-track system of “automated metrics + manual sampling”:
# Schematic: Evaluation pipeline skeletondef evaluate(model_endpoint, test_cases):results = []for case in test_cases:resp = call_api(model_endpoint, case["prompt"])results.append({"input_tokens": resp.usage.input,"output_tokens": resp.usage.output,"latency_ms": resp.latency,"ttft_ms": resp.time_to_first_token,"quality_score": auto_score(resp.text, case["reference"]),})return aggregate(results)
Key metrics include: accuracy/quality score, Time To First Token (TTFT), overall throughput, and the single call cost calculated based on actual token consumption.
Step 3: Stress and Stability Validation
A low unit price accompanied by high error rates or rate limits will actually drive up engineering costs. You need to validate: concurrency limits, rate limit strategies, timeout and retry behavior, and performance degradation in long-context scenarios.
Step 4: Cost Modeling and Calculation
Substitute the measured token distribution into the pricing to calculate the “total cost per 10,000 calls,” rather than stopping at unit price comparisons:
Single call cost = (Input Token count × Input unit price + Output Token count × Output unit price) / 1,000,000Monthly cost = Single call cost × Monthly call volume × (1 + Failure retry rate)
Take a typical customer service conversation as an example: about 1,500 input tokens (including historical context) and about 300 output tokens. Calculated at 10 RMB/million for input and 30 RMB/million for output, the single call cost is about 0.024 RMB, and 1 million calls per month would only cost 24,000 RMB. Under the previous generation’s pricing system, the same workload might cost over 100,000 RMB per month. This is the real meaning of “cost slashing” in actual business operations.
4. Cost Reduction Practices: Five Things More Important Than Switching Models
Model selection is just the starting point. The following engineering practices often yield greater cost savings than “switching to a cheaper model”:
- Routing Layering: Use rules or small models for front-end classification. Route simple problems to lightweight models and only route complex requests to flagship models. This can typically reduce flagship model calls by over 60%.
- Hard Constraints on Output Length: By using
max_tokensto limit output and explicitly prompting for “concise answers,” you can save 30% to 50% on output costs. - Conversation Compression: Periodically replace historical messages with summaries in multi-turn conversations to prevent infinite context expansion.
- Batch Processing and Asynchronous Operations: Use batch interfaces for non-real-time tasks. Some platforms offer additional discounts for offline batch tasks.
- Cache Reuse: Introduce a semantic caching layer for high-frequency repeated queries (such as FAQ or document Q&A). Requests that hit the cache cost zero.
5. Conclusion
The continued drop in LLM inference prices is shifting the competition from “being able to afford it” to “using it well.” Once unit prices enter the single-digit era, the decisive factor is no longer who is a few cents cheaper, but whose calling architecture is more efficient and whose evaluation system is more solid. It is recommended that teams establish their own benchmark test sets and cost dashboards as soon as possible, driving selection with real workload data rather than being led by marketing figures. The dividend of the price war ultimately belongs only to those engineering teams who spend every penny exactly where it counts.
