What to Do When an LLM Service Is Unavailable: Three Practical Options

    This article explains why large language model (LLM) service failures are not all the same, and walks through three ways to respond: optimizing how you call the official service, routing calls through a self-hosted API gateway, or deploying open-source models locally. It covers the three common causes of unavailability (capacity and load, rate limits, and quota or billing exhaustion), why retries only help with the first one, and includes sample backoff logic, a gateway routing policy, and a minimal local inference service. A comparison table and a layered failover recommendation help you choose the right mix for production.

    1. Define the Problem First: Unavailable Does Not Mean Unrecoverable

    In real engineering work and day-to-day usage, failure messages returned by LLM services are often lumped together as “the service is down.” Technically, though, these messages point to completely different root causes, and each one calls for a different response. Treating them as the same problem is the source of most wasted retries and blind tool switching.

    The common causes fall into three groups:

    • Capacity and load: The server is handling too many concurrent requests at that moment, so requests are queued or rejected outright, showing up as “server busy” or “service temporarily unavailable.” This type fluctuates clearly over time.
    • Rate limiting: The number of requests or tokens within a given period exceeds the threshold assigned to your account, showing up as “too many requests.” This depends on your calling cadence, not on the total volume.
    • Quota and billing: The account’s available credit, free-tier cycle, or billing balance is exhausted, showing up as “usage limit reached.” Retrying will not bring this back.

    Once you understand this layering, the first important conclusion follows: retrying only helps with the first type, and makes the second and third types worse. By the same logic, registering new accounts or frequently switching network egress points are meaningless client-side actions — they cannot change the server’s capacity allocation or quota policy.

    2. Option 1: Keep Using the Official Service and Improve How You Call It

    For everyday Q&A, writing, translation, learning support, and the occasional code snippet, the official service is still the best value for money. It requires no engineering changes, and its capabilities iterate fastest. What actually needs improving is the way you call it.

    Practical mitigations:

    1. Exponential backoff retries: Back off only on retryable errors (such as timeouts and explicit load-related errors), instead of retrying densely at fixed intervals.
    2. Compress the context: Shorten the input and keep only the necessary conversation history; this significantly reduces the resource footprint and failure probability of each request.
    3. Smooth out the peaks: Schedule batch jobs for off-peak hours and consume them serially through a queue, rather than firing off heavy concurrency.
    4. Cache results: Build cache keys for highly repetitive requests so the same content does not repeatedly consume quota.

    A sketch of backoff retry logic looks like this (pseudocode, expressing only the general idea):

    1. def call_with_backoff(request, max_retry=5):
    2. for attempt in range(max_retry):
    3. resp = client.invoke(request)
    4. if resp.is_success:
    5. return resp.data
    6. if not resp.is_retryable: # do not retry on quota exhaustion, bad params, etc.
    7. raise RuntimeError(resp.message)
    8. sleep(2 ** attempt + random()) # exponential backoff + jitter
    9. raise RuntimeError("retry exhausted")

    One common misunderstanding needs clearing up: the web chat entry point and the programmatic API are two separate service channels. A usage limit appearing in the web interface does not mean the API channel is unavailable; conversely, the API channel is equally subject to balance, rate, and backend load constraints. Neither can substitute for the other, and neither should be used as a way to “get around” limits.

    3. Option 2: Connect Through an API to a Self-Hosted Client or Unified Gateway

    If your team already uses model capabilities across multiple endpoints and business systems, the more robust approach is to funnel all calls behind a self-hosted gateway that handles rate limiting, caching, auditing, and degradation in one place.

    This layer usually carries four responsibilities:

    • Unified authentication and key custody: Keys never land on the client, avoiding leaks and misuse.
    • Multi-backend routing: When the primary channel fails, traffic switches automatically to a backup channel or a backup model size.
    • Observability: Request volume, latency, and error-code distribution are recorded so that logs, monitoring, and alerting can tell whether an issue is capacity-related or quota-related.
    • Degradation policy: Non-critical scenarios automatically drop to a smaller model or shorter output during peak hours.

    Routing and degradation at the gateway layer can be expressed as:

    1. routing:
    2. primary: { weight: 80, timeout_ms: 8000 }
    3. fallback: { weight: 20, timeout_ms: 15000 }
    4. policy:
    5. retry: { max: 3, backoff: exponential }
    6. degrade: { trigger_error_rate: 0.2, target: small_model }
    7. cache: { ttl_seconds: 3600, key: hash(prompt+params) }

    The value of this option is that it separates “is the service available?” from business code and turns it into configurable, observable, testable infrastructure. The cost is a certain amount of development and operations effort.

    4. Option 3: Deploy Open-Source Models Locally

    When data cannot leave the internal network, when offline operation is required, or when call volume has grown so large that pay-as-you-go billing no longer makes economic sense, deploying open-weight models locally is the fundamental fix. It is not constrained by external capacity or quotas; its ceiling is set by your own hardware.

    Four variables need to be assessed before you commit:

    1. VRAM and memory: Model parameter count, quantization precision (such as 8-bit/4-bit), and context length together determine resource usage, and you need to leave room for the KV cache.
    2. Inference throughput: Watch two metrics — time to first token and output tokens per second. The two usually require a trade-off through batching and concurrency settings.
    3. Operations cost: Model updates, version rollbacks, monitoring, and alerting all become your responsibility.
    4. Quality gap: Smaller quantized models typically trail large cloud models on complex reasoning and long-text tasks, so the trade-off has to be made per scenario.

    A minimal local inference service skeleton looks like this:

    1. from fastapi import FastAPI
    2. app = FastAPI()
    3. @app.post("/generate")
    4. def generate(payload: dict):
    5. prompt = payload["prompt"]
    6. max_tokens = min(payload.get("max_tokens", 512), 2048)
    7. # Load local quantized weights; configure batching and concurrency limits
    8. return {"text": local_engine.run(prompt, max_tokens)}

    5. Choosing Among the Three Paths

    Dimension Official service API + gateway Local deployment
    Engineering effort Very low Medium High
    Cost model Pay-as-you-go or free tier Pay-as-you-go + operations Hardware + operations
    Data compliance Depends on external policy Depends on external policy Fully self-controlled
    Capacity control Weak Medium Strong
    Capability ceiling Highest High Limited by hardware

    In production, the more sensible approach is not to pick one of the three but to layer them: use the official service or the standard API channel as primary, run a self-hosted gateway for unified governance and caching, and keep a small local model as the fallback for extreme situations. When the primary channel returns a non-retryable error, traffic switches automatically to the fallback path so the business keeps running.

    If the fallback model is deployed in the cloud, you can combine a container platform to host the inference service, object storage to hold model weights, and a message queue to smooth out peak traffic, then use logging and monitoring with alerting to build capacity warnings. That way, “server busy” stops being an uncontrollable external event and becomes an engineering problem with a plan, observability, and automated handling.