DEV Community

Cover image for Your LLM provider goes down for 4 hours. What does your user see? (Friday AI question)
M.T.Ramkrushna
M.T.Ramkrushna

Posted on Edited on

Your LLM provider goes down for 4 hours. What does your user see? (Friday AI question)

Friday AI Question. This one is about the day your model provider has a bad afternoon.

Your app calls one LLM API. That API starts returning errors, or just hangs. What does your user see?

Pick one (and tell me in the comments):

  • A) An error page. We'd find out from Twitter.
  • B) Retries. The SDK handles it.
  • C) A fallback to a second provider or model.
  • D) C, plus timeouts, a retry budget, a circuit breaker, and evals on the fallback model, tested before the outage.

My lean: B is the floor, D is the goal. Here's why.

Outages happen to the biggest providers

On December 11, 2024, all OpenAI services degraded or went fully unavailable. Per OpenAI's own post-mortem, it ran from 3:16 PM to 7:38 PM PST. The API had substantial recovery at 5:36 PM and full recovery across all models at 7:38 PM. The cause wasn't a model problem at all: a new telemetry service overwhelmed the Kubernetes control plane in most of their large clusters, and that cascaded.

Overload is also a normal, documented error. Anthropic's API docs list 529 overloaded_error: "The API is temporarily overloaded," and note it can happen during high traffic across all users.

So the question isn't whether your provider will fail. It's what your app does for those few hours.

Why option B is the floor, not the plan

Retries are good, and you probably already have them. Anthropic's docs say the SDK retries a failed request up to two times by default (three attempts in all). It retries connection errors, timeouts, and 408, 409, 429 and 500+ statuses, follows a retry-after header if present, and otherwise uses exponential backoff from 0.5 to 8 seconds. You can change it with max_retries, and 0 turns retries off.

Retries handle blips. They don't handle a four-hour outage, and they can make overload worse. Google's SRE book (chapter "Addressing Cascading Failures") is blunt about this:

  • Always use randomized exponential backoff. If retries aren't spread out, a small blip can make retry waves line up and amplify themselves.
  • Limit retries per request. Don't retry forever.
  • Consider a server-wide retry budget. Their example: only allow 60 retries per minute in a process, and when the budget is used up, fail the request instead of retrying.
  • Don't retry at every layer. If the frontend, backend and JavaScript layers each make 3 retries (4 attempts), one user action can become 4^3 = 64 attempts on the overloaded system.

That last one is common in LLM apps: your HTTP client retries, the SDK retries, your agent framework retries the tool call, and your queue worker retries the job. Count your layers.

Option C: fallback is easy to add and easy to get wrong

Routing to a second model or provider when the first one fails is a few lines of code. The risky part is everything you didn't test:

  • Prompts aren't portable. A prompt tuned for one model can behave differently on another: format, tool-calling, refusals, length.
  • Structured outputs and tools differ. If your parser expects one model's JSON shape, the fallback may break it in a new way.
  • Cost and latency change. A fallback to a bigger model can blow your budget. A fallback to a smaller one can quietly drop quality.

A fallback you've never evaluated is a second outage waiting to happen, just a quieter one.

Option D: what "tested before the outage" means

Here's the checklist I'd use:

  1. Set a timeout on every call. A hung request ties up a worker. Pick a timeout from your real p95/p99 latency, not the library default.
  2. Retry once, with jitter, at one layer. Decide which layer owns retries and turn them off everywhere else.
  3. Add a retry budget. When most calls are failing, stop retrying and fail fast.
  4. Add a circuit breaker. Martin Fowler's description (from Michael Nygard's Release It): wrap the call, count failures, and once they cross a threshold the breaker trips and further calls return an error immediately, without calling the supplier. Add an alert when it trips. For an LLM app, "return an error" can be "route to the fallback."
  5. Run your eval set on the fallback model. The same set you use to ship prompt changes. If it fails, you know before your users do.
  6. Decide what degrades. Maybe the fallback answers support questions but agent actions are paused. Maybe you show a cached or simpler answer. Write it down.
  7. Rehearse it. Force the breaker open in staging once and watch what users would see.

So, A, B, C or D?

Most apps I see are at B, and think they're at C. If you've got D, I'd love to hear how you test the failover.

What happens in your app when the model API goes down? And how many layers of retries do you actually have?

References

Top comments (2)

Collapse
 
userxnom profile image
Abdullah Naseer •

I lean D, but with one hard rule: the app should never look broken just because a provider is. For a mobile app that has to keep working offline, I would rather degrade on purpose — show the last good state, queue the request, and tell the user plainly what happened and when it will retry. Retries and a second provider help with cost and coverage, but they do not answer the user's question in the moment: is my work safe? The part I would test first is the fallback itself, not just the code path. How do you rehearse the degraded experience — do you force the breaker open in staging and watch what a real user would actually see?

Collapse
 
m_t_ramkrushna profile image
M.T.Ramkrushna •

Yes, I force the breaker open in staging and walk through the app as a user would: airplane mode, a provider returning 503s, and a slow timeout. I check that the last good state still shows, queued requests survive an app restart, and the retry message is honest about timing. A fault-injection toggle on the provider client makes this repeatable, so the degraded UX gets a regression test like any other feature.