A Practical Guide to Cost and Performance Observability for LLM Inference Services
This guide covers how engineering teams can calculate the cost of LLM inference per unit of business volume and observe latency and throughput under peak load. It describes a cost model built on token types, a way to separate reasoning-chain throughput from output throughput, and a checklist for evaluating inference services before production rollout.
When a new inference service launches, discussion often centers on benchmark scores and single demo results. For teams that will run the service in production, the more important questions are whether the cost per unit of business volume can be calculated, whether performance during peak hours is predictable, and whether clients can tell a slow response from a failure. Without answers to these basics, a single metric comparison can easily lead to a one-sided conclusion. This article uses a general measured sample as a starting point and describes a method for calculating costs and observing performance for LLM inference services.
1. Define the Cost Basis Before Comparing Unit Prices
The first step in cost evaluation is not finding the lowest unit price. It is defining what gets counted. LLM calls usually consist of three parts: input tokens, cached input tokens, and output tokens. Each part has its own price, and some providers offer separate off-peak and peak rates. Comparing services only by “price per million tokens” can miss the actual token structure of a workload.
A reusable cost model can be written as:
Total cost =uncached input tokens × input price+ cached input tokens × cached input price+ output tokens × output price+ other charges (retries, failed requests, storage, etc.)
In one weekend sample, the workload consumed about 180 million tokens and cost about 31 yuan (CNY), an average of about 0.17 yuan per million tokens. Extrapolated to 1 billion tokens, that comes to about 170 yuan. The figure is useful, but it must be accompanied by a description of the sample: whether the task types were varied, the ratio of input to output, whether the cache hit rate was measured, and whether retries were included. If the billing system does not show the cache hit rate directly, teams should track it themselves. Otherwise, the average cost is diluted across different task structures.
For example, one workload showed a cache hit rate of about 93.7% and output tokens making up only 0.59% of the total. Most tokens were input, and most input could hit the cache. In this case, cost is not sensitive to the output price. It is highly sensitive to the caching strategy and how inputs are organized. With the same token structure, a lower-tier service priced at about 160 yuan per 1 billion tokens during off-peak hours could roughly double at peak rates. A higher-tier service priced at about 500 yuan per 1 billion tokens off-peak could reach about 1,000 yuan at peak. These figures are illustrative calculations only and do not represent any vendor’s commitment. They show one clear point: on price alone, some lower-tier services may match another option during off-peak hours, but the gap widens quickly during peak hours or at higher tiers.
Subscription plans and pay-as-you-go billing should not be chosen by intuition. Subscriptions suit stable, predictable workloads that can use the full quota. Pay-as-you-go suits volatile workloads, exploratory phases, or teams whose task structure changes quickly. Before choosing, calculate the break-even point by dividing the subscription quota by the actual average monthly consumption, then compare the result with the pay-as-you-go bill. Include peak-hour premiums, retries from failed requests, and cache savings in the model.
2. Split Performance Observation into Output Throughput and Reasoning-Chain Throughput
A single total response time does not describe speed well. For inference services that expose a reasoning process, measure at least four things: time to first token, reasoning-chain throughput, final output throughput, and end-to-end completion time.
In one weekend test, output speed stayed around 50 to 55 tokens per second, which was acceptable. During the morning peak, however, reasoning-chain throughput dropped to 4 to 9 tokens per second, and output throughput fell to 12 to 25 tokens per second. If you only watch the final result, users may assume the service has frozen. If you can see reasoning-chain speed and stage status, you can tell whether the cause is queuing, rate limiting, or a network problem.
Teams should maintain sliding-window metrics on the client or gateway side:
window_tokens = number of tokens received in the last N secondsoutput_tps = window_tokens / window_secondscot_tps = number of reasoning-chain tokens in the last N seconds / window_secondsfirst_token_latency = time of first token - time the request was sentstatus = Queued / Thinking / Outputting / Retrying / Failed
These metrics do not need to be complicated, but they must be visible to users. Some clients show only an animation or a “generating” message. They do not reveal reasoning-chain speed or queue status, so users cannot tell a slow model from a dropped connection. A better approach is to display the current stage, the speed, the elapsed waiting time, and whether the request can be retried. When a retry happens, the client should say so clearly. Observability is not a cosmetic feature. It connects cost with user experience. Without it, teams can misread peak-hour slowdowns as outages, trigger unnecessary retries, and push costs higher.
3. Selection Checklist
Build an evaluation table around six dimensions:
- Cost basis: record the proportions of input, cached input, output, and retried tokens.
- Peak and off-peak behavior: load test off-peak and peak periods separately.
- Throughput layers: record time to first token, reasoning-chain throughput, and output throughput.
- Observability: check whether the service exposes stage status and speed.
- Failure semantics: confirm that timeouts, rate limits, and queuing can be told apart.
- Gradual rollout: support routing by task type and rolling back.
When rolling out a service, first collect the real token structure from a small amount of traffic, then estimate costs at the scale of 1 billion tokens using the model above. Sample performance continuously during peak hours so that a single speed test does not produce a misleading conclusion. Finally, place cost, latency, and failure rate on one dashboard, and set alert thresholds based on the business SLA. A new inference service is worth selecting only when its costs can be calculated, its performance can be observed, and its anomalies can be explained.
