A Practical Guide to Evaluating LLM API Costs: How to Assess a New Model Scientifically
Evaluating a newly released large language model through its API can quickly become expensive if the calling pattern is poorly designed. Using a real case where a two-hour evaluation session cost roughly 500 RMB, this article breaks down the four types of token metering behind mainstream LLM API billing—input tokens, output tokens, and short- and long-TTL cache writes—explains why multi-turn long-context tasks with tool calls accumulate costs so fast, and provides a reusable checklist covering session structure, segmented generation, output length limits, tiered model routing, token budgeting and monitoring, and cache TTL selection, so teams can keep evaluation budgets under control and build an accurate cost model for production.
A Practical Guide to Evaluating LLM API Costs: How to Assess a New Model Scientifically
1. Starting with a Real Evaluation
Whenever a new large language model is released, the most common reaction in the developer community is “log in and try it.” One developer’s approach is typical: to evaluate a new model’s long-document analysis and report generation capabilities, he submitted a research task via the API—feeding it a lengthy background document and letting the model retrieve, organize, and produce a structured report. After two hours of continuous calls, the bill showed roughly 500 RMB spent.
That number sounds surprising at first, but breaking down the usage details—input tokens, output tokens, cache write tokens (5-minute TTL), and cache write tokens (1-hour TTL)—reveals that the cost was not simply “the model ran fast, so it burned money.” It was determined jointly by the task structure, the billing rules, and the calling pattern. Understanding this bill is the core subject of this article.
2. The Four Dimensions of Token-Based Billing
Mainstream LLM APIs generally bill by token, and a single call actually involves four distinct types of token metering:
Input tokens: everything sent to the model in each request, including the system prompt, conversation history, and uploaded document segments. In long-context scenarios, input is usually the largest cost component. For “research-style” tasks in particular, if every turn carries the full prior context and source material, input volume accumulates roughly linearly with the number of turns—and can even grow quadratically.
Output tokens: the content the model generates. Producing a long report may consume thousands to tens of thousands of output tokens, and the per-token price for output is typically much higher than for input. The longer and more detailed the report, the higher the output cost.
Cache write tokens (short TTL, e.g., 5 minutes): when a request shares a long common prefix with recent requests, the server can write that prefix into cache, and the cache-hit portion of subsequent requests is billed at a price far below normal input. However, the write itself carries a one-time cost; short-TTL cache writes are usually priced lower.
Cache write tokens (long TTL, e.g., 1 hour): a cache type designed for frequently reused long prefixes. The write price is higher, but the discount on hits is larger and the validity period is longer.
In other words, caching is a double-edged sword: hits save money, while frequent writes without hits cost extra. Whether an evaluation task should enable caching, and which TTL to choose, depends on the task pattern.
3. Why Two Hours Cost Several Hundred RMB
Returning to the opening case, the high bill can be attributed to three factors:
First, the task itself was of the multi-turn long-context type. Research report generation typically involves multiple steps: decomposing the question, retrieving item by item, writing section by section, and assembling the final document. If every step rolls forward within the same session, input tokens keep accumulating.
Second, tool calls and reasoning also consume tokens. For models that support tool use and reasoning, the intermediate retrieval results and reasoning content all count toward metering. The hidden consumption of long-chain tasks should not be underestimated.
Third, the cache strategy may be mismatched. If the request prefix changes significantly each turn (for example, splicing different retrieved fragments into the prefix every time), the cache hit rate is extremely low while cache write fees keep accruing. Conversely, if the source material is fixed and only new instructions are appended at the end, a long-TTL cache should be used to amortize the cost.
4. A Reusable Cost Optimization Checklist
Based on the analysis above, the following practices are recommended for evaluation or production work:
Optimize session structure: place stable, bulky content (such as the system prompt and reference material) at the very front of the prefix, and put volatile instructions at the end. Maximize the common prefix to improve the cache hit rate.
Generate in segments rather than all at once: have the model produce the report chapter by chapter, issuing a separate request for each chapter carrying only the necessary context. This avoids the high retry cost of a single request with overly long output.
Constrain output length explicitly: specify the report length and number of items in the prompt. Every output token saved is a direct saving on the bill.
Route tasks to tiers of models: lightweight steps such as decomposition and formatting can be handled by a low-cost small model, reserving the high-performance model for critical reasoning and writing. This forms a “model orchestration” pattern.
Establish token budgets and monitoring: run a small-scale trial before going live to estimate the average token consumption per task, then multiply by task volume to derive a budget. Use logging to record usage for each token type and set alert thresholds to prevent runaway spending.
Choose the right cache TTL: for minute-scale tasks (such as an interactive debugging session), short-TTL cache is sufficient; when the same material will be called repeatedly within an hour (such as batch report generation), long-TTL cache is more cost-effective.
5. Conclusion
Evaluating a new model is itself a technical activity with real costs. What is expensive is not the model, but a calling pattern that lacks design. By thoroughly understanding the token metering rules and treating session structure, caching strategy, and task orchestration as engineering concerns, teams can both keep evaluation budgets under control and build an accurate cost model for subsequent production deployment. That 500 RMB of tuition bought a reusable evaluation methodology—which is precisely the most worthwhile investment any team can make when adopting LLM capabilities.
