Putting report generation capability into a chat box is a very common requirement. The justification in reviews is usually just one sentence: the user is already here and doesn’t want to jump to another page. Engineering-wise it really isn’t hard; the APIs are all ready-made. What’s actually hard is what happens after you do the cost math: for the same report, building it as a dialog box costs an order of magnitude more than building it as a scheduled task, and the expensive part has basically nothing to do with token count.
This gap is worth unpacking, because it determines what a lot of AI products ultimately look like. Even when you’re calling the same model once, real-time and offline are not the same business.
Real-time is expensive because you pay for the time nobody is using it
First, separate the two bills. The book cost of a request is token count times unit price—anyone can calculate that. The service cost of providing that request is something else: at the moment the user presses Enter, there has to be compute that is warm, idle, and immediately available.
Offline tasks can accumulate requests, stuff them into a full batch, and run a card close to full utilization. On the same card, batch processing can complete a considerable multiple of the token volume that real-time can, depending on model size and batch limits—usually several times in order of magnitude. Real-time can’t do this: the user is waiting there, and you can’t make them queue while others fill a batch.
Hence the first thing to remember: the cost of real-time inference is determined by peak concurrency, not by average call volume.
A quick calculation makes it intuitive. Suppose a voice assistant receives 2 new sessions per second, each session lasts 90 seconds on average, so average concurrency is 180 streams. That’s before peak—morning and evening peaks can be two or three times the average. The compute kept resident to withstand that peak sits idle most of the day. If the same capability were changed to “upload a recording, get the result a few minutes later,” those 180 streams could queue and be batched, capacity demand would drop by an order of magnitude, and users would perceive no difference at all.
This calculation rarely comes up in product reviews, because everyone is used to estimating “how many calls per day” rather than “how many requests are being processed in the same second.” The former determines the token cost on the bill; the latter determines how many cards you need to buy.
The second cost comes from streaming output. To make the first token fast, the model emits text while generating, and that connection is occupied for the entire generation period. The user reads slowly, but the GPU doesn’t compute any less because of that. Session persistence, context replay, and KV cache holding VRAM without releasing it are all money paid for “the user might ask another question at any time.” Only when the user closes the page do those resources actually free up.
So when judging whether a feature should be real-time, the first question isn’t whether users want instant feedback, but how much peak concurrency differs from average concurrency. The wider the gap, the higher the extra cost of real-time.
First-token latency is a hard constraint, and shortening output length is the most effective cost control
Real-time products have two latency budgets, and many people watch only one.
The first is first-token latency, from when the user sends a request to when they see the first character. Empirically, it needs to be in the hundreds of milliseconds to feel responsive; past one second users start wondering whether they even clicked, and after two or three seconds some start refreshing the page. Voice scenarios are stricter: the turn-taking interval in human conversation is already on the order of hundreds of milliseconds, and if the machine takes more than a second to respond, users instinctively feel the other party didn’t understand.
The second is total generation time. Users can tolerate a fast first character with slower output afterward because they’re reading; but if the whole thing takes十几 seconds, they start getting impatient halfway through.
These two budgets affect cost completely differently. First-token latency is mainly determined by prompt length and prefill; long context means recomputing history every turn, so cost grows linearly with the number of conversation turns, and latency grows with it. Total generation time is determined by output length, and output length is something the product can specify: default short answers, require structured output, set max tokens—all trade information volume for cost and latency.
Here’s a counterintuitive point: the most effective way for a real-time product to save money isn’t switching to a smaller model, it’s making answers shorter. Switching models degrades quality, users notice immediately, then ask again, and all the money saved goes right back; compressing an 800-word answer to 300 words often leaves users more satisfied.
When does this not hold? When what the user wants is a complete deliverable: a report, a contract, a modified code file. Such needs should be moved to async in the first place; forcing them into a dialog box only shortchanges both sides.
Retry rate is an easily overlooked cost multiplier
In real-time products, users don’t wait quietly. If it times out, they resend; if they’re unhappy with the answer, they ask again; if the network hiccups, they click three times in a row. Every retry is a complete inference, plus a chunk of occupied capacity on top.
So when looking at cost, don’t just look at a single call; look at how many calls it takes on average to complete one effective interaction. This coefficient is clearly higher in real-time scenarios than offline. Offline tasks can retry internally on failure, invisible to the user and without consuming their attention; real-time retries are often initiated by the user, emotionally charged, and frequently concurrent.
Investment in reducing retry rates often pays back more than squeezing token unit prices. The specific methods aren’t complicated: deliver the already-generated partial result before timeout, clearly tell the user what they’re waiting for, and on failure offer one-click retry instead of making them retype everything. These are interaction design, not model optimization, but they directly change the cost structure.
Correspondingly, on metrics, looking at cost per interaction is illusory; cost per successful interaction is what matters. The denominator includes retries and abandonments, and for the abandoned portion, the cost of user churn is far more expensive than compute.
On the same product line, real-time and offline have different pricing logic
Pricing real-time by token is a mismatch. Users can’t predict how many tokens an interaction will cost, and passing cost fluctuations directly to them only leaves a vague impression: this thing is expensive. The more common approach is pricing by seat, by session, or by duration.
But per-seat pricing immediately brings another problem: revenue and usage decouple, and heavy users become negative gross margin. So the pricing structure of real-time products usually combines three things: subscription, quotas, and degradation. Quotas aren’t stinginess; they protect the first-token latency of everyone else in the same pool. One user running a long task will slow down others’ P99, and this cost externality genuinely exists in a shared capacity pool—self-discipline can’t solve it.
Offline products, conversely, can honestly charge by usage, because request boundaries are clear, users know what they’re buying, and they can control batch size themselves.
A table makes the comparison clearer:
| Dimension | Offline or async | Real-time interaction |
|---|---|---|
| What capacity is provisioned for | Average throughput | Peak concurrency |
| Main cost items | Total compute | Compute, idle time, session persistence |
| Latency target | Completion time, minutes acceptable | First token and P99 |
| Billing method | Pay per use | Subscription or seat plus quota plus degradation |
| Quality trade-offs | Can use large models, long output | Often needs short output, small-model fallback |
The last row doesn’t mean real-time can only use worse models than good ones; it means real-time must have a fallback path. When the model times out, gets rate-limited, or the upstream jitters, the product needs an escape route that “delivers part first” rather than leaving the user staring at a spinner. This escape route must be decided at the design stage; patching it in afterward is usually too late.
Which interactions truly need real-time
I don’t quite believe the claim that “users all want instant feedback.” The criterion can be harder: during the wait, can the user go do something else? If yes, it should be async; only if no does real-time even come into question.
Cutting along this line, the scenarios that truly need real-time have something in common: the next action depends on the previous result, and during the wait the user is locked into this interface. Code completion, chat, voice, and search suggestions all fall into this category—time isn’t a cost item, it’s the product itself.
Conversely, real-time is basically a waste in these cases: results are consumed by downstream systems rather than shown to people; a single task is inherently minute-scale; trigger frequency is so low it’s a few times a day. Low-frequency scenarios are the worst fit for real-time—keeping a compute instance resident for those few requests makes unit cost ugly enough that you can’t even price it.
The middle ground is underestimated: give the structure first, then fill in the content. Hand out the outline, progress, and partial results first so the user starts reading, and fill in the rest gradually. It costs considerably less than full real-time, and feels close to real-time. The product form is “skeleton first, body later” and “first three items first, completion later.” This approach works especially well in reports, long-form writing, and analysis products, because it moves the wait off the user’s perception path rather than actually making computation faster.
Drawn as a decision flow, it looks roughly like this:
flowchart TD
A[用户发起请求] --> B{等待期间能去做别的事吗}
B -- 能 --> C[异步任务并通知]
B -- 不能 --> D{下一步依赖这一步结果吗}
D -- 否 --> C
D -- 是 --> E{峰值并发远高于均值吗}
E -- 是 --> F[实时并做限额降级]
E -- 否 --> G[实时按席位定价]
C --> H[按量计费可用大模型]When a requirement that takes the left-hand path insists on being given a chat box, it’s usually not product insight—it’s that nobody wants to bear the pressure of “making the user wait.”
Turning the latency budget into tunable parameters
Putting the above into a set of executable parameters looks roughly like this. Tune the values by scenario; the structure matters more than the values.
1 | # 实时链路预算模板 |
The key is the last two lines. max_output_tokens isn’t just a cost switch—it’s actually a product-form switch: once you accept that long outputs go async, the design space for the real-time path suddenly widens, you no longer need to reserve capacity for large generations, and the first-token budget can be set more aggressively.
Conversely, if the product insists that all output appear in the chat box, that cap has to keep going up, capacity goes up with it, and in the end you either raise prices or quietly degrade quality. These are two sides of the same decision.
Which number to ask for first in review
Back to the requirement at the start about stuffing reports into a chat box. It’s not necessarily undoable, but the review order should be reversed: first ask how far peak concurrency diverges from average concurrency, then ask what the P99 first-token budget is, and only then discuss whether to stream and whether to render as you go.
If these three numbers can’t be answered, the proposal itself isn’t ready for review.
Comments