We shipped a document-summarising feature for a client last year, and it worked beautifully in the demo. Then it went to production, a user pasted in a forty-page contract on a flaky Telkom connection, and the whole screen sat spinning for ninety seconds before the browser gave up. The prompt was fine. The model was fine. What we had failed to design was the thing around the model call: the latency budget, the timeouts, the fallback. Most teams treat an LLM call like a database query that happens to be clever. It is not. It is a slow, high-variance network request to a system that sometimes decides to think for a very long time, and your feature needs to be built as if that is the normal case, because it is.
The latency distribution is the whole problem
A Postgres query that usually takes 8ms almost never takes 8 seconds. An LLM call that usually takes 2 seconds will, some meaningful fraction of the time, take 20. The average is a lie that will comfort you right up until a user on a bad day hits the tail of the distribution. When you plan around the median response time, you are designing for the good case and leaving the bad case to chance. The bad case is where users form their opinion of whether your product is broken.
Latency on a model call has several moving parts, and it helps to name them so you know what you can actually influence. There is time-to-first-token, which is how long before anything starts coming back. There is the per-token generation rate, which scales with how much output you asked for. And there is queueing on the provider's side, which you do not control at all and which spikes when everyone else is also busy. A 2000-token summary is not twice as slow as a 1000-token one by accident; output length is often the single biggest lever you have. If a response feels slow, the first question is not 'is the model slow today' but 'how much are we asking it to write'.
Before you touch anything, instrument the call. Log the wall-clock duration of every model request in production, and look at the 95th and 99th percentiles, not the average. You will almost certainly find the tail is far worse than anyone assumed, and that is the number your timeout and your UI need to be built for.
Streaming changes what 'slow' means
The single highest-leverage change for perceived speed is streaming the response token by token instead of waiting for the whole thing. A summary that takes 12 seconds to fully generate feels completely different if the first sentence appears after 1.5 seconds and the rest flows in as the user reads. The total time is identical. The experience is not remotely the same, because the user is watching progress rather than staring at a spinner wondering if the thing has frozen.
Streaming is not free, though, and the trade-offs are real. It complicates your error handling, because a request can now fail halfway through after you have already shown the user half an answer, and you have to decide what to do with that partial output. It also complicates anything that needs the complete response before acting, like parsing structured JSON or running a validation step. A common mistake is to stream text to the user and then, at the very end, discover the model produced malformed JSON that your parser rejects, so the user watched a perfectly good-looking answer appear and then saw it vanish into an error. If you need structured output and you want streaming, you generally stream to a buffer and show a lighter progress indicator, rather than streaming raw tokens straight to the screen.
Timeouts, retries, and the fallback you forgot to build
Every model call needs an explicit timeout, and the default from your HTTP client is almost always wrong. Too short and you cut off legitimate slow responses, wasting the work already done and annoying users whose request would have succeeded. Too long and you hold a user hostage to the worst case. Set the timeout from your measured 99th percentile plus a margin, not from a round number that felt sensible. For a user-facing call, that might be 20 to 30 seconds. For a background job, you can afford to be far more patient because nobody is watching.
Retries are where people quietly make things worse. Retrying a timed-out LLM request means you now have two expensive, slow calls in flight, and if the provider is overloaded, your retry adds to exactly the load that caused the timeout. If you retry, cap it at one attempt, add jitter, and only retry on genuinely transient errors like a 429 or a 503, never on a timeout you set yourself. Blindly retrying on every failure is how a provider hiccup turns into your own cost spike and a thundering herd that keeps the provider down longer.
The part almost everyone skips is the fallback: what the user sees when the call genuinely fails. 'Something went wrong, try again' is not a fallback, it is a surrender. A real fallback degrades gracefully. If the AI summary fails, show the first paragraph of the document and a plain 'Summary unavailable right now' message, so the feature is diminished rather than broken. If a smart autocomplete times out, fall back to the normal text field with no suggestions. Design the non-AI version of every AI feature, because on a bad day that is the version your users get, and a feature that quietly loses its intelligence is far better than one that loses its mind.
The takeaway
Start by instrumenting every model call in production and looking at the 95th and 99th percentile durations, because those tails are what your users actually feel and your averages are hiding them. Set an explicit timeout derived from that 99th percentile rather than accepting your HTTP client's default. Treat output length as your main latency lever and cap it deliberately; do not ask for 2000 tokens when 400 will do. Add streaming to any user-facing generation to turn dead waiting time into visible progress, but stream to a buffer when you need structured output so a parse error cannot erase a good-looking answer. Be conservative with retries: one attempt, with jitter, only on transient provider errors, never on your own timeout. And before you ship, build and test the degraded path for every AI feature, so when the model is slow or down, your product gets quietly less clever instead of visibly broken.
The prompt is the part that is fun to tune, which is exactly why it gets all the attention. The latency and failure handling is the part that decides whether anyone trusts the feature enough to keep using it. Build that first.