High Availability Architecture for Unstable LLM Services
This article breaks down how to build resilient systems when your business depends on external large language model (LLM) APIs. It covers request classification, availability and error budgets, layered timeouts, retry and backoff strategies with jitter, graceful degradation and fallbacks, multi-provider and multi-region redundancy through a unified gateway, observability signals, and capacity and cost controls for metered billing. It also includes a pre-launch stability checklist to help teams keep services continuous, predictable, and cost-accountable despite upstream outages and pricing changes.
When an LLM service moves from “usable” to “part of daily operations,” stability stops being an add-on and becomes a first-class architectural constraint. Recently, a platform’s official status page showed multiple partial outages and anomalies within a single month, affecting chat services and two types of model APIs. At the same time, industry discussion about whether to introduce paid tiers has been heating up. This article does not evaluate any specific product. Instead, it abstracts these phenomena into a general engineering problem: when your business relies heavily on external LLM services, how do you use architecture to contain uncertainty?
1. Define the Problem: What Are You Actually Depending On?
Many teams treat calling a model API as an ordinary network request, and that is where misjudgment begins. In engineering terms, an LLM service involves at least four layers of dependency: the access layer (authentication, rate limiting, routing), the scheduling layer (queuing, batching, resource allocation), the inference layer (compute and GPU memory), and external dependencies (network, storage, logging). Instability in any layer surfaces to you as timeouts, rate limits, or 5xx errors from the layer above.
So the first step in stability design is dependency modeling: identify which requests are hard dependencies (the business cannot function without a model result) and which are soft dependencies (they can degrade to rules or cache). Only after this classification can you allocate your budget meaningfully.
Request classification exampleS0 hard dependency: real-time chat main path, requires P99 < 3sS1 semi-hard dependency: document summarization, can be async, minutes-level latency acceptableS2 soft dependency: recommendation copy polishing, can use cache or template fallback
2. Availability Budget: Turn “Feels Unstable” into a Measurable Metric
Don’t stay at the intuition level of “it seems to go down a lot lately.” Define service level objectives for each request class and convert them into an error budget. For example, a monthly availability target of 99.9% allows about 43 minutes of downtime; if your business can only tolerate 10 minutes, then relying on a single external service is already below target, and you must close the gap with redundancy and degradation.
The value of an error budget is that it drives decisions: when the budget is healthy, you can ship new features; when it is running low, changes are automatically frozen and stability hardening takes priority. This turns stability from “an ops complaint” into “a team consensus.”
3. Timeouts, Retries, and Backoff: The Three Things Most Often Written Wrong
First, timeouts must be set per layer. Connection timeout, time-to-first-byte, and overall timeout should be separate, and the upstream timeout must be greater than the sum of downstream stages. This avoids wasting resources when “upstream has given up but downstream is still running.”
Second, retries must distinguish error types. Typically retryable errors are connection failures, rate limits, and 5xx. Non-retryable ones are invalid parameters, authentication failures, and content moderation rejections. Blind retries can amplify a single failure into an avalanche.
Third, backoff must include jitter and a retry budget (for example, retries should not exceed 10% of total traffic) to prevent all clients from waking up at the same moment.
import random, timedef call_with_retry(fn, max_attempts=3, base=0.2, cap=2.0):for attempt in range(max_attempts):try:return fn()except RetryableError:if attempt == max_attempts - 1:raisesleep = min(cap, base * (2 ** attempt))time.sleep(sleep * (0.5 + random.random())) # jitter
4. Degradation and Fallbacks: Keep the Business Working When the Model Is Unavailable
Degradation is not “returning an error”; it is “switching to another path that still works.” Common strategies include: switching to a smaller model or a shorter prompt to reduce load; returning a historical result on a semantic cache hit; generating an acceptable result with a rules engine or template; and converting a synchronous request into an async task while clearly telling the user the expected latency.
The key is to define the quality standard for fallback content in advance. If the fallback result is unusable, the business side should fail explicitly with an understandable status code rather than throwing a blank page at the user.
Pseudo-logic for degradation decisionsif consecutive failures on the main path >= threshold:if semantic cache hit: return cached resultelif async is allowed: enqueue and return a task IDelse: return template result + explicit degradation flag
5. Multi-Provider and Multi-Region: The Right Way to Build Redundancy
Real redundancy is not “writing down one more address.” It means abstracting a unified model invocation gateway that consolidates differences in authentication, routing, rate limiting, and billing into one layer. The gateway splits traffic by weight and real-time health, automatically removing unhealthy nodes on failure. Multi-region deployment can mitigate regional network issues, but you must also account for data compliance and data residency requirements.
It is worth noting that different models vary in prompt compatibility and output format stability. The abstraction layer should normalize inputs and outputs so business code is not locked to a single implementation.
6. Observability: No Measurement, No Stability
Collect at least four types of signals: request volume, success rate, latency distribution (P50/P95/P99), and business-side quality metrics (such as refusal rate and format non-compliance rate). Logs should record the model identifier, prompt version, token consumption, and degradation flag for traceability. Alerting should be based on error budget burn rate rather than single-point thresholds to reduce noise.
Core dashboard suggestions- Traffic: QPS, concurrency, queue time- Quality: success rate, timeout rate, rate-limit rate, degradation rate- Cost: token consumption, cost per request, cache hit rate- Dependencies: health and removal count of each node
7. Capacity and Cost: Get Ready for Paid Tiers
Once a service moves from a free quota to usage-based billing, the architecture must be able to answer “what is this request worth?” Introduce token budgets and quotas: set limits per tenant and per feature; cache and trim long contexts and repeated requests; schedule high-cost tasks during off-peak hours. The cost dashboard and the performance dashboard should live in the same view, so you don’t sacrifice key-path experience just to cut costs.
Paid tiers often come with clearer rate-limiting and quota policies. Clients should be able to recognize rate-limit responses and automatically slow down instead of continuously hammering the service.
8. Pre-Launch Stability Checklist
- Have you completed request classification and availability budgeting?
- Are timeouts, retries, backoff, and retry budgets configured and validated under load testing?
- Can degradation paths trigger automatically, and does fallback content meet the standard?
- Does the invocation gateway support health checks and automatic node removal?
- Does monitoring and alerting cover error budget burn rate?
- Do you have per-tenant cost and quota controls?
Conclusion
Volatility and billing evolution in external LLM services are the norm. The engineering answer is not to wait for the provider to be permanently stable, but to design uncertainty in: classify dependencies, quantify budgets, retry correctly, degrade gracefully, unify the gateway, make observability complete, and keep costs under control. With these in place, your business stays continuous, predictable, and cost-accountable regardless of whether upstream introduces paid tiers. To accelerate adoption, you can look at how Baidu AI Cloud combines general capabilities such as container platforms, message queues, logging services, and monitoring and alerting, using standardized components to shorten the stability-building cycle.
