---
title: "LLM failover testing: inject outages, 429s, timeouts, and bad keys"
type: "guide"
url: "https://aifordevs.org/articles/failover-testing"
markdown: "https://aifordevs.org/articles/failover-testing.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/articles/failover-testing"
description: "A failover testing guide for LLM apps: inject outages, 429s, timeouts, and revoked keys, then measure failover latency, error rate, and cost shift."
author: "AI for Devs"
published: "2026-11-23"
level: "Intermediate"
topics: ["apis", "inference"]
---

# LLM failover testing: inject outages, 429s, timeouts, and bad keys

A failover testing guide for LLM apps: inject outages, 429s, timeouts, and revoked keys, then measure failover latency, error rate, and cost shift.

> **TL;DR**
>
> - Failover testing for LLM apps breaks the primary provider on purpose and checks three things: the request still succeeds, it lands on the expected fallback, and it gets there inside a latency and cost budget written down before the test.
> - Each provider fault maps to a different Bifrost failure class. A 503 retries the same key with backoff, a 429 rotates keys with backoff, a revoked key rotates with no backoff, and a stalled response is not retried and goes straight to the fallback.
> - An invalid request is not retried, but it still walks a fallback list the caller named in the request. Expect one upstream call per provider in the chain, not one in total.
> - With max_retries at 3 and the default 500 ms initial backoff, a 503 outage waits about 3.5 seconds of backoff before the first fallback starts. A stalled provider costs one full request timeout.
> - Read failover per request from the x-bifrost-routing-info-is-fallback and x-bifrost-fallback-index headers, and in aggregate from bifrost_error_requests_total by error_type, bifrost_key_rotation_events_total, and bifrost_cost_total.

LLM failover testing means injecting provider faults on purpose and checking that each request still succeeds on the fallback you expected, within a latency and cost budget you set beforehand. A fallback chain that has never been exercised is an assumption. This guide uses [Bifrost](https://www.getmaxim.ai), an [open-source AI gateway](https://github.com/maximhq/bifrost), as the system under test: its retries, key rotation, fallbacks, response headers, and Prometheus metrics. It builds a small fault proxy, injects five faults, and ends with a pass/fail checklist you can run in staging.

## What failover testing means for LLM APIs

Failover testing deliberately breaks the primary component of a system and checks that traffic moves to the backup within an agreed time, error rate, and cost. For an LLM application, the primary is a model provider behind an [AI gateway](https://aifordevs.org/glossary#ai-gateway), and the backup is another provider or model in a fallback chain.

LLM providers fail in more ways than a database replica does, and each way needs different handling. A 503 from an overloaded region should be retried. A 429 should move to a key with spare quota. A revoked key should be skipped immediately. A request that hangs should time out and move on. A malformed request will fail everywhere, so sending it down the chain only multiplies calls.

The method follows the [Principles of Chaos Engineering](https://principlesofchaos.org/): define a steady state you can measure, state a hypothesis about how it holds under a specific fault, inject the fault, and look for a difference. For failover, the steady state is three numbers per request, and the hypothesis is a written expected outcome per fault.

| Measure | Read it from | What a pass looks like |
| --- | --- | --- |
| Client-visible error rate | The probe or load generator | Flat while the fallback is healthy |
| Which provider served | `x-bifrost-routing-info-provider`, `x-bifrost-fallback-index` | The provider the config says should serve |
| Failover latency | Client wall time minus a no-fault baseline | Inside the budget implied by retries and timeout |
| Upstream errors by cause | `bifrost_error_requests_total` by `error_type` | Rises only for the injected cause |
| Cost shift | `bifrost_cost_total` by provider and model | Fits the budget at real traffic volume |

Transport errors are only half of it. A fallback that returns 200 can still change behavior: a different model may follow the prompt differently, and a stateful request cannot carry state that lives on the primary provider. The [ContinuityBench paper](https://huggingface.co/papers/2607.15899) found that stateless failover kept requests answered while dropping prior conversation context. Check output shape and state, not only status codes.

## The system under test: Bifrost retries and fallbacks

Bifrost handles provider failures in two layers. [Retries](https://docs.getbifrost.ai/features/retries-and-fallbacks) run against the same provider, either on the same key or on another key from the pool. Fallbacks run across providers once the primary's retry budget is spent, and each fallback gets its own full retry budget.

Retries are set per provider in `network_config`. The defaults, as of November 23, 2026, are `max_retries: 0`, `retry_backoff_initial: 500` ms, and `retry_backoff_max: 5000` ms, so a fresh install does not retry transient errors until you set a budget. The fallback chain is a `fallbacks` array of `provider/model` strings in the request body.

Every failed attempt gets a `failure_class`, recorded on the request's `attempt_trail` with the raw status code. The class decides what happens next, which turns each test into a precise expectation:

- `transient` (network errors, 500, 502, 503, 504, 529) retries the same key with exponential backoff.
- `rate_limit` (429) rotates to another key and still applies backoff, since providers often share quota across keys in one account.
- `credential`, `quota`, `model_access`, and `model_gone` mark the key dead for the rest of the request and rotate with no backoff. Those rotations are not charged against `max_retries`, so a pool is walked even at the default of 0.
- `timeout` is not retried, but a provider timeout does start the fallback chain.
- `caller_fault` (a 400, 409, 413, 415, or 422 the provider rejected) and `unknown` 4xx errors are not retried.

**Figure 1.** Each injected fault has one correct pattern. Note the last row: an invalid request is not retried, yet it still walks a fallback list the caller named.

The last row of Figure 1 surprises people. Bifrost moves to the first fallback whatever the error, except when the caller cancelled, when a plugin set `AllowFallbacks = false` on the error, or when the error is a `caller_fault` and the fallbacks were added by the model catalog rather than named by the caller or a routing rule. A malformed request with an explicit `fallbacks` list is tried once on every provider in it.

When every provider fails, Bifrost returns the primary's original error with the primary's response headers, not the last fallback's. Fallbacks also rerun per-attempt plugins, including governance checks and [semantic caching](https://aifordevs.org/articles/semantic-caching), so a fallback provider must be permitted on the caller's virtual key or it fails for a policy reason instead.

## Build a fault-injection rig

Inject faults between the gateway and the provider, not in application code. The production request path then runs unchanged, and only the upstream misbehaves. Bifrost offers two places to do this: a fault proxy behind a custom provider, which exercises real HTTP retries and key rotation, and the Go SDK's mocker plugin, which answers in place of the provider.

**Figure 2.** The primary is a custom provider whose base URL is the fault proxy, so every byte Bifrost sees looks like a real provider. The fallback is a real provider with its own retry budget.

A [custom provider](https://docs.getbifrost.ai/providers/custom-providers) with `base_provider_type: "openai"` speaks the OpenAI wire format to any `base_url`. Give it two keys so rotation has somewhere to go, and set a short `default_request_timeout_in_seconds` so the stall test finishes. This excerpt was not run for this article.

```json title="config.json (excerpt, not run)"
{
  "providers": {
    "faulty-openai": {
      "custom_provider_config": { "base_provider_type": "openai" },
      "network_config": {
        "base_url": "http://127.0.0.1:9099",
        "default_request_timeout_in_seconds": 10,
        "max_retries": 3,
        "retry_backoff_initial": 500,
        "retry_backoff_max": 5000
      },
      "keys": [
        { "name": "key-a", "value": "env.FAULT_KEY_A", "models": ["*"], "weight": 1.0 },
        { "name": "key-b", "value": "env.FAULT_KEY_B", "models": ["*"], "weight": 1.0 }
      ]
    },
    "anthropic": {
      "keys": [{ "name": "anthropic-1", "value": "env.ANTHROPIC_API_KEY", "models": ["*"], "weight": 1.0 }],
      "network_config": { "max_retries": 2 }
    }
  }
}
```

Set `FAULT_KEY_A=key-a` and `FAULT_KEY_B=key-b`, so the proxy can tell the keys apart by their bearer token. The proxy below answers every POST with a canned completion until you switch it to a fault with `GET /_fault?mode=503`, optionally scoped to one key with `&key=key-a`. It was run with Python 3.15.1 on November 23, 2026, against the probe script further down, but not behind Bifrost.

```python title="fault_proxy.py"
import json, os, sys, time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlparse

STATE = {"mode": "ok", "key": "*"}  # key: which bearer token the fault applies to

ERRORS = {
    "503": (503, {"error": {"message": "upstream overloaded", "type": "server_error"}}),
    "429": (429, {"error": {"message": "Rate limit reached", "type": "requests", "code": "rate_limit_exceeded"}}),
    "401": (401, {"error": {"message": "Incorrect API key provided", "type": "invalid_request_error", "code": "invalid_api_key"}}),
    "400": (400, {"error": {"message": "Invalid value for 'temperature'", "type": "invalid_request_error", "code": "invalid_value"}}),
}

def completion(model):
    return {
        "id": "chatcmpl-fault-proxy", "object": "chat.completion", "created": int(time.time()), "model": model,
        "choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
        "usage": {"prompt_tokens": 5, "completion_tokens": 1, "total_tokens": 6},
    }

class Handler(BaseHTTPRequestHandler):
    def send_json(self, status, body, headers=()):
        data = json.dumps(body).encode()
        self.send_response(status)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(data)))
        for k, v in headers:
            self.send_header(k, v)
        self.end_headers()
        self.wfile.write(data)

    def do_GET(self):  # control: GET /_fault?mode=429&key=key-a
        url = urlparse(self.path)
        if url.path != "/_fault":
            return self.send_json(404, {"error": "not found"})
        q = parse_qs(url.query)
        STATE["mode"] = q.get("mode", [STATE["mode"]])[0]
        STATE["key"] = q.get("key", ["*"])[0]
        self.send_json(200, STATE)

    def do_POST(self):
        body = json.loads(self.rfile.read(int(self.headers.get("Content-Length", 0))) or b"{}")
        token = self.headers.get("Authorization", "").removeprefix("Bearer ")
        mode = STATE["mode"] if STATE["key"] in ("*", token) else "ok"
        if mode == "stall":
            time.sleep(300)  # longer than any sane request timeout
        if mode == "429":
            status, err = ERRORS["429"]
            return self.send_json(status, err, [("Retry-After", "2")])
        if mode in ERRORS:
            return self.send_json(*ERRORS[mode])
        self.send_json(200, completion(body.get("model", "unknown")))

    def log_message(self, fmt, *args):
        sys.stderr.write(f"{time.strftime('%H:%M:%S')} {STATE['mode']:>5} {self.headers.get('Authorization', '')[-5:]} {fmt % args}\n")

if __name__ == "__main__":
    port = int(os.environ.get("PORT", "9099"))
    ThreadingHTTPServer(("127.0.0.1", port), Handler).serve_forever()
```

The proxy answers any POST path, so it does not matter which path Bifrost appends to `base_url`. Its log prints one line per upstream attempt with the mode and the last characters of the key, which is the easiest way to count retries and rotations by eye.

Teams that embed Bifrost through the Go SDK can use the [mocker plugin](https://docs.getbifrost.ai/features/plugins/mocker) instead. Rules match on provider, model, message regex, or request size, fire with a `Probability` between 0 and 1, and pick among weighted success or error responses. An error response sets `Message`, `Type`, `Code`, and `StatusCode`, and its `AllowFallbacks` field set to false blocks the chain. Latency takes `time.Duration` values, and the docs warn that a bare `100` means 100 nanoseconds. Because the mocker replies before any HTTP call, use it to test the fallback chain and the application's handling of fallback responses, and use the proxy to test retries and key rotation.

## Inject the five faults

Write each expected outcome down before the run. If you cannot state it, you do not yet know what the config does. Every request below uses `"model": "faulty-openai/gpt-4o-mini"` with `"fallbacks": ["anthropic/claude-haiku-4-5"]`, and the proxy log, the response headers, and the metrics are checked against the expectation.

### Provider outage (503)

Switch the proxy to `mode=503`. Expect four attempts on the same key, three backoff waits, then a response from Anthropic carrying `x-bifrost-routing-info-is-fallback: true` and `x-bifrost-fallback-index: 1`. The test fails if the client sees an error while the fallback is healthy, or if the proxy log shows key rotation, which would mean the 503 was classified as something other than `transient`.

### Rate limit on one key (429)

Switch to `mode=429&key=key-a`. Expect one 429 on key-a, a backoff, and success on key-b, still on the primary provider, with `bifrost_key_rotation_events_total` rising with `fail_reason="rate_limit_error"`. If a single-key 429 sends traffic to Anthropic, the pool is too small or rotation is off. Rate-limit rotation needs more than one key and `max_retries` above zero.

The proxy sends `Retry-After: 2`. Bifrost records it as `extra_fields.retry_after_ms` on the error, clamped to between 1 second and 5 minutes, but the value is informational: Bifrost's own backoff still decides the wait. Check that the client does not add a second backoff on top.

### Stalled response (timeout)

Switch to `mode=stall`. Expect one wait of `default_request_timeout_in_seconds`, no retries on the primary, then the fallback. This is the slowest failure path, and the timeout setting controls it directly. Repeat with `stream: true`, where the request timeout bounds the connection and the wait for response headers, and `stream_idle_timeout_in_seconds` (default 120) governs a stream that stops sending chunks.

### Revoked key (401)

Switch to `mode=401&key=key-a`. Expect a `credential` failure, an immediate rotation to key-b with no backoff, and `bifrost_provider_key_up` dropping to 0 for key-a. The dead-key set is per request, so the next request tries key-a again and pays one extra upstream call. Bifrost Enterprise [Adaptive Routing](https://docs.getbifrost.ai/enterprise/adaptive-routing/how-it-works) instead holds a refused key out of rotation on every node, so on Enterprise the extra calls should stop after the first refusal.

Then revoke both keys with `mode=401`. With the retry budget outlasting the pool, the primary ends with `502 upstream_credentials_exhausted` rather than the raw 401, counted as `provider_credentials_exhausted`, and the fallback serves the request. Without a fallback, that 502 reaches the caller, telling them the gateway key is fine and the provider credentials are not. It is not a generic proxy failure, which is worth knowing when reading the [502 Bad Gateway guide](https://aifordevs.org/articles/502-bad-gateway) during an incident.

### Invalid request (400)

Switch to `mode=400`. Expect no retries on the primary, then one attempt on Anthropic, because the caller named the fallback. The 400 comes from the proxy, so Anthropic accepts the request, and that is the behavior to examine in production too: a bug in request code can be hidden by a fallback that is more lenient than the primary, or multiplied by a chain of providers that all reject it. Decide whether that is acceptable. If it is not, stop the chain with a plugin that sets `AllowFallbacks = false` for caller errors, or validate requests before they reach the gateway.

A typo in a model name is a related case. It is classified `model_access`, which costs one upstream call per configured key before the error or the fallback is reached.

## Measure failover latency, error rate, and cost shift

A request that eventually returned 200 proves little on its own. For every run, collect failover latency, error rate by cause, and cost per request, and compare each with a no-fault baseline. The probe below sends N requests and tallies status codes, which provider and fallback index served each one, and wall-clock and upstream latency.

```python title="failover_probe.py"
import json, statistics, sys, time, urllib.error, urllib.request
from collections import Counter

URL = sys.argv[1] if len(sys.argv) > 1 else "http://localhost:8080/v1/chat/completions"
N = int(sys.argv[2]) if len(sys.argv) > 2 else 20
BODY = {
    "model": "faulty-openai/gpt-4o-mini",
    "messages": [{"role": "user", "content": "Reply with ok."}],
    "fallbacks": ["anthropic/claude-haiku-4-5"],
}

walls, upstream, served, statuses = [], [], Counter(), Counter()
for _ in range(N):
    req = urllib.request.Request(URL, json.dumps(BODY).encode(), {"Content-Type": "application/json"})
    start = time.perf_counter()
    try:
        with urllib.request.urlopen(req, timeout=120) as resp:
            status, headers = resp.status, resp.headers
    except urllib.error.HTTPError as e:
        status, headers = e.code, e.headers
    except OSError:  # connection refused, client timeout
        status, headers = 0, {}
    walls.append((time.perf_counter() - start) * 1000)
    statuses[status] += 1
    served[(headers.get("x-bifrost-routing-info-provider", "-"), headers.get("x-bifrost-fallback-index", "0"))] += 1
    if headers.get("x-bifrost-upstream-latency-ms"):
        upstream.append(float(headers["x-bifrost-upstream-latency-ms"]))

q = lambda xs, p: statistics.quantiles(xs, n=100)[p - 1] if len(xs) > 1 else (xs[0] if xs else 0)
print(f"requests {N}  client errors {N - statuses[200]}  statuses {dict(statuses)}")
print(f"served by (provider, fallback index) {dict(served)}")
print(f"wall ms p50 {q(walls, 50):.0f}  p99 {q(walls, 99):.0f}")
if upstream:
    print(f"upstream ms p50 {q(upstream, 50):.0f}  p99 {q(upstream, 99):.0f}  (gap = backoff + gateway)")
```

### Failover latency

Failover latency is the extra time a request spends because the primary failed. Measure it as client wall time minus the baseline, because that is what users wait for. The [response header](https://docs.getbifrost.ai/providers/response-headers) `x-bifrost-upstream-latency-ms` sums time spent waiting on the provider across every attempt, retry, and fallback, so the gap between wall time and that header is mostly backoff plus gateway work. On `/v1` error responses, the fallback index and upstream latency headers are not sent, and on streams the latency header covers only the time until the stream opened.

Most of the number can be predicted before the test. Bifrost's backoff is `min(retry_backoff_initial × 2^attempt, retry_backoff_max)` with 0.8 to 1.2 jitter. With 500 ms initial backoff and `max_retries: 3`, a transient outage waits about 500 ms, 1 s, and 2 s between attempts: 3.5 seconds nominal, 2.8 to 4.2 with jitter, before the first fallback starts.

**Figure 3.** Backoff gaps follow the documented formula without jitter; attempt and answer durations are placeholders. A 503 outage pays about 3.5 s of backoff before the fallback, while a stall pays the whole 10 s timeout.

If either number breaks the latency budget, lower `max_retries` or the timeout before running anything. The [SRE book's chapter on cascading failures](https://sre.google/sre-book/addressing-cascading-failures/) explains why the budget matters beyond latency: retries at several layers multiply, so a client that retries a gateway that retries a provider turns one user action into many upstream calls. Each provider in a Bifrost chain gets its own full budget, so a primary and two fallbacks at `max_retries: 3` allow up to 12 attempts.

### Error rate by cause

Count client-visible errors separately from upstream errors. During the 429 test, upstream errors rise and client errors should stay flat, and that gap is the evidence failover worked. In [Prometheus](https://docs.getbifrost.ai/features/observability/prometheus), `bifrost_error_requests_total` carries an `error_type` label from a closed vocabulary that says whose fault a failure was:

| Injected fault | Expected `error_type` |
| --- | --- |
| 503 outage | `provider_overloaded` (503 and 529) |
| Other 5xx | `provider_server_error` |
| 429 on a key | `provider_rate_limited` |
| Stalled response | `provider_timeout` |
| Revoked key | `provider_auth_failed` |
| Every key revoked | `provider_credentials_exhausted` |
| Proxy down | `provider_connection_failed` |

`_OTHER` should stay at zero. A rise means a failure went unclassified, so read the `attempt_trail` on the log entry before trusting the run. A 429 from your own governance limits shows up as `policy_rate_limited`, not `provider_rate_limited`, which separates a tight internal limit from a real provider limit.

```promql title="queries for the test window"
# Upstream failures by cause for the faulty primary
sum by (error_type) (rate(bifrost_error_requests_total{provider="faulty-openai"}[1m]))

# Successful requests by fallback position (0 is the primary)
sum by (provider, fallback_index) (rate(bifrost_success_requests_total[1m]))

# Key rotations and why they fired
sum by (key_name, fail_reason) (increase(bifrost_key_rotation_events_total[10m]))

# Per-key health, 0 after a failed attempt
bifrost_provider_key_up{provider="faulty-openai"}
```

### Cost shift

Cost shift is the change in spend when traffic moves to a fallback. The fallback model usually has a different per-token price, and failed attempts can add cost of their own. Divide `increase(bifrost_cost_total[10m])` by `increase(bifrost_success_requests_total[10m])`, both summed by provider and model, to get cost per request in the test window, then multiply the delta from baseline by real traffic for the outage length you plan for.

Watch the `bifrost_request_retries` histogram alongside it. A rising retry count means more upstream attempts per user request, and providers differ in how they bill attempts that failed partway.

## Failover test checklist

Run these in staging with the same Bifrost config as production, apart from the faulty provider. Record the expected result before each run, and treat any mismatch as a failed test, even if the client saw a 200.

| # | Test | Pass when |
| --- | --- | --- |
| 1 | Write down `max_retries`, backoff, and timeout for every provider in the chain | Worst-case failover latency fits the budget on paper |
| 2 | Baseline, no fault | p50 and p99 wall time and cost per request recorded |
| 3 | 503 on the primary | Client errors flat; fallback index 1; proxy log shows no key rotation |
| 4 | 429 on key-a | Rotation event with `rate_limit_error`; served by the primary |
| 5 | Stall | Failover latency close to the timeout; no retries on the primary |
| 6 | 401 on key-a | `bifrost_provider_key_up` 0 for key-a; no backoff before key-b |
| 7 | 401 on every key | `provider_credentials_exhausted` on the primary; the fallback serves |
| 8 | 400 invalid request | No retries; exactly one attempt per provider in the named chain |
| 9 | Every provider down | Client receives the primary's error and the app's degraded mode runs |
| 10 | Stateful and tool-calling requests on the fallback | Output schema and conversation state still valid |
| 11 | Whole session | `_OTHER` stayed at zero; cost shift within budget |

Test 10 is the one transport metrics cannot answer. Run a short conversation and a tool-calling request with the primary forced down, and validate the fallback's output against the same schema the application already enforces.

## Run failover tests continuously

A one-time test proves the config on the day it ran. Configs drift: someone adds a provider, rotates keys, or edits a model name in the fallback list, and a fallback that pointed at a retired model now fails with `model_gone`. Schedule the checklist as a recurring game day, and keep a low-probability fault running in staging between game days.

Alert in production on the same signals the checklist uses. A drop in `bifrost_provider_key_up`, a nonzero `_OTHER` rate, or a sustained share of traffic at `fallback_index` above 0 all mean the primary path is degraded even if users see no errors. In a multi-node deployment, scrape every node or use the Push Gateway, since a scraper behind a load balancer can miss nodes. Bifrost Enterprise [clustering](https://docs.getbifrost.ai/enterprise/clustering) also shares provider health across nodes, so a cluster test should check that one node's detected outage changes routing on the others.

Failover is also where routing design shows. A chain that only takes traffic when the primary fails is active-passive, and its fallback receives no real traffic until an outage, which is why it needs these tests most. The [active-active vs active-passive comparison](https://aifordevs.org/articles/active-active-vs-active-passive) covers when weighted traffic across providers makes failover a routine event instead of a rare one, and the [LLM gateway ranking](https://aifordevs.org/articles/best-llm-gateways) compares how other gateways handle retries and fallbacks.

Fault tests also exercise the controls around the request path. Fallbacks rerun governance, so each fallback provider must be allowed on the caller's [virtual keys and budgets](https://www.getmaxim.ai/resources/governance). Those governance and security controls apply to the AI tools on employee machines as well when [Bifrost Edge](https://www.getmaxim.ai/edge) routes that traffic through the same gateway, with the same [guardrails enforced on each device](https://docs.getbifrost.ai/edge/security). Start with tests 2 to 6 against one faulty provider, fix what they find, and add the rest once the basic chain behaves as written.

## Questions

### What is failover testing?

Failover testing deliberately breaks the primary component of a system and checks that traffic moves to the backup within an agreed time, error rate, and cost. For LLM applications the primary is a model provider, and the faults are the ones providers actually produce: 5xx outages, 429 rate limits, stalled responses, revoked keys, and requests the provider rejects as invalid.

### How do you test failover for an LLM API?

Put a fault proxy in front of the primary provider, route traffic through a gateway with retries and fallbacks configured, and switch the proxy between faults while a probe sends requests. For each fault, write the expected behavior first, then compare it with the response headers, the gateway's metrics, and the client's own error rate and wall-clock latency.

### Does a 429 always trigger a fallback to another provider?

No. In Bifrost, a 429 rotates the request to another key for the same provider, with backoff, when the provider has more than one key and max_retries is above zero. The request moves to the fallback provider only after the primary's retry budget or key pool is spent. A single-key provider retries the same key instead.

### Are timeouts retried?

Bifrost does not retry a timed-out attempt on the same provider, but a provider timeout does start the fallback chain. That makes the timeout value the failover latency for a stalled provider: a 10 second timeout means at least 10 seconds before the fallback is tried. An expired request deadline is different and ends the request with no fallback.

### What happens when every provider in the fallback chain fails?

Bifrost returns the primary provider's original error along with the primary's response headers, such as its request ID and rate-limit headers, rather than the last fallback's error. Fallbacks that are not configured or cannot serve the request type are skipped. Test this case on purpose, because it is where the application's own degraded mode has to take over.

### What is the difference between failover and fallback?

The terms overlap. Failover usually names the event of moving traffic from a failed component to a standby, and fallback names the configured alternative that receives it. In an LLM gateway, a fallback is the next provider and model in the chain, and failover is what happens when retries on the primary are exhausted and the request moves there.

## Sources

1. [Bifrost docs, Retries and fallbacks (read November 23, 2026)](https://docs.getbifrost.ai/features/retries-and-fallbacks)
2. [Bifrost docs, Response headers (read November 23, 2026)](https://docs.getbifrost.ai/providers/response-headers)
3. [Bifrost docs, Prometheus (read November 23, 2026)](https://docs.getbifrost.ai/features/observability/prometheus)
4. [Bifrost docs, Mocker plugin (read November 23, 2026)](https://docs.getbifrost.ai/features/plugins/mocker)
5. [Bifrost docs, Custom providers (read November 23, 2026)](https://docs.getbifrost.ai/providers/custom-providers)
6. [Bifrost docs, Provider setup in config.json (read November 23, 2026)](https://docs.getbifrost.ai/deployment-guides/config-json/providers)
7. [Bifrost docs, Adaptive routing (read November 23, 2026)](https://docs.getbifrost.ai/enterprise/adaptive-routing/how-it-works)
8. [Bifrost docs, Edge security and guardrails (read November 23, 2026)](https://docs.getbifrost.ai/edge/security)
9. [Bifrost reference page for AI systems (llm-info, last updated September 2026)](https://www.getmaxim.ai/llm-info)
10. [Principles of Chaos Engineering (read November 23, 2026)](https://principlesofchaos.org/)
11. [Google, Site Reliability Engineering, Addressing cascading failures](https://sre.google/sre-book/addressing-cascading-failures/)
12. [Pandey, ContinuityBench: A Benchmark and Systems Study of Stateful Failover in Multi-Provider LLM Routing (arXiv 2607.15899, 2026)](https://huggingface.co/papers/2607.15899)

## Cite this guide

AI for Devs. "LLM failover testing: inject outages, 429s, timeouts, and bad keys." Published November 23, 2026. https://aifordevs.org/articles/failover-testing

- Page: https://aifordevs.org/articles/failover-testing
- Markdown: https://aifordevs.org/articles/failover-testing.md
- Reuse: Quote or summarize with a link to this page. Terms: https://aifordevs.org/reuse
- Publisher: AI for Devs
- Published: 2026-11-23
