LLM API and Tool Cost Evaluation Guide
A practical guide to estimating the full cost of large language model applications by separating token-based inference charges from retrieval, web scraping, speech, and other tool fees. It explains how to model peak and off-peak pricing, control agent tool usage, forecast costs across common business workflows, and establish the monitoring needed for reliable budgeting.
Start by Separating the Bill into Two Cost Categories
A large language model “full-stack” API is rarely covered by a single price table. Costs generally fall into at least two categories: model inference billed by token, and capabilities such as retrieval, web scraping, speech recognition, and speech synthesis billed per request or by duration. Looking only at the model’s token price will systematically underestimate the real cost.
A sound evaluation should answer three questions:
- What are the input and output prices for the primary model during each pricing period?
- Which tools are billed separately, and are they measured per request, minute, or unit of audio?
- What is the steady-state price after any temporary discount expires?
Discounted pricing should be treated as a transitional budgeting assumption, not as a long-term architecture baseline.
Consider the following example using broadly representative public price levels. These figures illustrate the calculation method only and do not represent a commitment from any specific provider: during weekday peak hours, input may cost approximately CNY 2 per million tokens and output CNY 8 per million tokens, with half-price rates during other periods. Retrieval and web scraping may cost about CNY 5 per 1,000 requests, while one hour of speech transcription may cost approximately CNY 0.39. If a speech-related service has a limited-time discount, list the discounted price separately.
Putting all of these figures into one table makes it possible to align pricing with actual application call paths.
Converting Token Usage into the Cost of One Task
The model cost for a single task can be expressed as:
Cost = (input_tokens / 1e6) × input_price+ (output_tokens / 1e6) × output_price
Input tokens include more than the user’s question. System prompts, multi-turn history, retrieved passages, tool results, and structured-output constraints all become part of the context. Output tokens may include the final answer, reasoning tokens if they are billable, and tool arguments. In applications with long contexts, input tokens often have a greater impact on the bill than output tokens.
Peak and off-peak usage should not be estimated by simply assuming an “average half-price” rate. If 80% of traffic occurs during weekday peak hours, the effective unit price will be close to the peak rate rather than the daily average. Track request volume by hour, apply the applicable price to each period, and then aggregate the results.
Batch processing, offline summarization, and overnight data ingestion should be moved to lower-cost windows whenever possible. Online customer support and transaction assistance should generally be planned using peak pricing.
The following pseudocode shows the calculation relationship without depending on any particular vendor SDK:
def llm_cost(in_tokens, out_tokens, peak, rates):pin, pout = rates["peak"] if peak else rates["offpeak"]return in_tokens / 1e6 * pin + out_tokens / 1e6 * pout
The peak and offpeak values in rates should come from a contract or the provider’s published console pricing, not from an informal assumption that off-peak usage is “roughly half price.”
Output tokens are often several times more expensive than input tokens. Set a maximum generation length to prevent the model from producing lengthy explanations after a tool failure.
Per-Request Tool Pricing Can Change the Architecture
When retrieval and web scraping are billed per 1,000 requests, each call may appear inexpensive. However, an agent loop can multiply one user question into several tool calls.
Suppose one question-and-answer interaction triggers an average of three retrieval calls and one web-scraping call. The tool cost is approximately:
(4 / 1000) × CNY 5 = CNY 0.02
If the model uses only 2,000 input tokens and 500 output tokens for the same interaction during peak hours, with prices of CNY 2 per million input tokens and CNY 8 per million output tokens, the model cost is approximately CNY 0.008.
In this case, tool costs already exceed model costs. The implication is straightforward: token caching and context truncation cannot solve a billing problem caused by unrestricted web searches.
Cost controls should be implemented in the calling policy rather than added manually after launch:
- Set a per-request tool limit, such as no more than two retrieval calls and one scraping call.
- Reuse results for identical queries within a short time window to avoid paying repeatedly during multi-turn conversations.
- Search local or already-indexed documents first, and call external web scraping only when a specific information gap remains.
- Deduplicate URLs and extract the main article content before scraping. Do not send site navigation, advertisements, and scripts back to the model.
- Count failed retries separately, distinguishing network timeouts from cases where the model searches again because it is dissatisfied with the result.
Speech costs are also frequently underestimated. Hour-long transcription can be inexpensive when priced at only a few tenths of a currency unit, making bulk archiving affordable. However, real-time meetings and two-way voice support combine speech recognition, speech synthesis, and model tokens for each exchange.
Estimate voice workflows through two channels:
Audio minutes × speech price+ text tokens × model price
Any limited-time discount should include an expiration date. Prepare a price switch for the post-discount rate so that promotional-month reports are not mistaken for normal operating costs.
Estimate Monthly Costs Across Three Business Workflows
Do not forecast spending using only “daily active users × an arbitrary token count.” At minimum, split the workload into three paths and track request volume, average input and output tokens, tool calls, and peak-hour usage for each one.
Path A: Tool-Free Conversation
Assume peak-hour usage of 1,500 input tokens and 400 output tokens per request. The model cost is approximately CNY 0.0062 per interaction.
At 10,000 requests per day, all during peak hours, the monthly model cost is approximately CNY 1,860, using a rough 30-day month.
This scenario is not very sensitive to tool pricing. Its main cost drivers are output length and the percentage of traffic that falls within peak hours.
Path B: Retrieval-Augmented Q&A
Starting with Path A, assume that each request triggers two retrieval calls.
The tool cost is:
(2 / 1000) × CNY 5 = CNY 0.01
This already exceeds the model cost. At 10,000 requests per day, retrieval alone would cost approximately CNY 3,000 per month.
The optimization priorities are therefore cache hit rate and the number of retrieved items, not simply switching to a cheaper sampling parameter.
Path C: Voice-Based Service Tickets
Assume each call contains an average of three minutes of audio. After transcription, the application sends approximately 800 input tokens to the model and receives 200 output tokens for summarization.
During peak hours, the model cost is negligible compared with the speech cost. At a transcription price of approximately CNY 0.39 per hour, three minutes costs about CNY 0.02.
With 2,000 calls per day, monthly speech costs will be much higher than model costs. The first optimization targets should be silence trimming, duplicate recording removal, and determining whether full transcription is necessary—not reducing the number of summary output tokens.
Weight the three paths according to their actual traffic shares to establish a monthly baseline. Then apply a volatility factor of 1.3 to 1.5 to account for prompt growth, retries, and temporary traffic spikes.
For financial reporting, use discounted prices for the current-month forecast and list prices for the annual budget.
Measurement and Governance to Implement Before Launch
Cost control depends on observability, not on cutting features after the fact.
Add application, tenant, and scenario tags. Logs should record input tokens, output tokens, peak or off-peak status, tool names and call counts, and audio duration in seconds. Without itemized data, it is impossible to determine whether the model or the tools require optimization.
Set budget alerts. Monitor daily spending, tool calls per request, output tokens per request, and failed retry rates. Set thresholds based on the estimated values for Paths B and C with an additional buffer, rather than using one average threshold for the entire system.
Govern prompts and context. Keep fixed system prompts concise. Summarize conversation history instead of concatenating it indefinitely. Limit both the number of retrieved passages and the maximum length of each passage.
Separate synchronous and asynchronous workloads. Route deferrable tasks such as summarization, quality checks, and knowledge-base ingestion through low-cost time windows. Keep user-facing responses available during peak hours, but strictly limit tool fan-out.
Reconcile contracts and invoices. Confirm whether units are measured per million or per thousand tokens, whether tools are billed only for successful operations or for every request, and whether speech is charged by audio duration or processing time. Also verify that the monitoring timezone and the defined start and end times for “weekday peak hours” match the provider’s billing rules.
How to Decide Whether the Price Is Acceptable
Price acceptability should not be judged by comparing one promotional number with another. It should be evaluated based on the value of the completed business task.
A useful metric is:
Total cost per successfully completed task÷Labor savings or revenue generated by that task
If a retrieval-based answer costs CNY 0.02 and replaces several minutes of manual research, the cost is usually acceptable. If repeated tool calls raise the cost of the same task to CNY 0.20 while the success rate remains low, the problem is the calling strategy rather than the model’s list price.
During acceptance testing, maintain a comparison table containing:
- Scenario
- Peak-hour percentage
- Average input and output tokens
- Tool calls
- Speech minutes
- Cost per request
- Monthly request volume
- Monthly cost
- Monthly cost after the discount expires
Every value in the table should be reproducible from captured logs. If the numbers can be replayed and recalculated, the pricing is understandable. If they cannot, even a low unit price is only a slogan that cannot support production planning.
For engineering teams, the practical conclusion is usually clear: the model’s list price is only a lower bound. Tool call volume and peak-hour traffic determine much of the bill for agent and voice workloads. Per-path forecasting, call limits, and itemized monitoring can turn a “full-stack” API from an apparently simple bundle into a cost structure that can be measured and governed.
