LLM Routing: Fallback Plans for Model Provider Outages | Hokstad Consulting

LLM Routing: Fallback Plans for Model Provider Outages

LLM Routing: Fallback Plans for Model Provider Outages

LLM fallback means switching to an approved backup - not retrying without limits. Set one retry budget across all clients: for example, two primary attempts within 3 seconds, then one backup attempt within the remaining deadline.

A safe fallback plan needs:

  • Approved routes for each task, checked for quality, tools, capacity, data rules and cost.
  • Health checks and circuit breakers to stop failing routes and restore traffic in stages.
  • Clear service limits: reduced features, queued work or an unavailable message when no backup fits.
  • Tests and outage drills, including checks that retries cannot repeat completed actions.
  • Firm spending caps, monitoring and named incident owners, with budgets tracked in £.

Keep safety checks in place throughout. A backup response only counts as success if it meets the task’s requirements.

::: @figure LLM Failover: Detect, Switch and Recover Safely{LLM Failover: Detect, Switch and Recover Safely} :::

Building an LLM Gateway - Routing, Fallback, and Token Management #llmgateway #llmrouting

Set up health checks and circuit breakers

Once retries are capped, use shared health state to decide when to remove a route from rotation. Keep health decisions in the gateway so only approved fallback routes enter rotation. Share route health, circuit-breaker state and audit records across gateway instances. Scope health by provider, region, model, account and workload. One failed request must not take an entire provider out of rotation.[9][13]

Combine health probes with live traffic data

Run a short, non-sensitive probe every 30–60 seconds to check authentication, model availability, response format and latency. Combine those results with live traffic metrics: request volume, successful completions, timeouts, errors, 429s, queue depth and concurrency.

Track p50, p95 and p99 latency separately for successes and failures, as fast errors can mask poor service. Check application-level validation too. HTTP success does not mean the response is usable.[3][5][9][12]

Set thresholds for each workload, including a minimum observation window and sample count. Open the circuit only when error rates breach the workload’s SLO-based limit. Classify failures first: exclude account-specific 429s from outage thresholds and handle them through quota controls. Treat invalid requests and authentication faults as hard stops, not signals to open the circuit. Compare affected routes before extending the incident’s scope.[9][13]

When the circuit opens, move traffic to approved backups in controlled steps.

Isolate failed routes and restore traffic gradually

Use four states to control traffic:

  • Healthy: Send normal traffic.
  • Degraded: Reduce traffic or apply stricter timeouts.
  • Unavailable: Open the circuit and fail fast or use an approved fallback.
  • Recovering: Allow limited trial requests after a cooldown.

Check backup capacity, quota and budget before shifting traffic. Restore traffic in stages - 5%, 25%, 50%, then 100% - with an observation period at each step. Reopen the circuit if errors, latency or validation failures breach limits. Use separate thresholds for opening and closing the circuit to prevent flapping.[7][8][10]

Log every state change and routing outcome. Include the timestamp, request ID, provider, model, region, route state, routing decision, error class, retry count, latency, token counts, estimated cost, validation result and fallback destination. Record which automation or operator was responsible.

Keep prompts and responses out of routine logs. Use access-controlled, short-lived samples only when an investigation requires them.[4][6]

Approve backup models and service modes

Choose backups by workload, not just availability. If a route fails, switch only to a pre-approved backup or reduced service mode. The registry is the gateway’s source of truth when primary routes fail. A backup that works for support chat may not suit document extraction or an agent that changes account details.

Keep a registry of approved routes

For each workload, record its owner, primary route, backup models in priority order, capabilities, latency, spend ceilings, data-retention terms, training-use policy, hosting regions, contract status and last validation date. Include reasons for approval and rejection so responders can make fast decisions during an incident.

Use the registry to decide which service modes each workload can use during an outage.

Set separate policies for conversation, retrieval, classification, extraction and code agents. Each needs its own minimum capabilities. Shorter replies may work for conversation, but retrieval and summarisation must keep sources and necessary context. Classification and extraction need schema validation and checks for missing or conflicting values. Code and tool agents need compatible tool schemas, sandboxing, permissions and idempotency controls.

If no approved route fits, pause high-risk tasks for human review. Do not route around safety refusals.

Before approving another provider or region, check data classes, processor terms, sub-processors, retention, deletion and training-use terms. Identify where processing takes place and whether a restricted international transfer applies. Record the transfer safeguard used, such as the UK International Data Transfer Agreement, UK Addendum or Binding Corporate Rules, alongside any required transfer risk assessment.[15][17][18]

Define full, reduced, queued and unavailable service

Set these limits as service modes rather than deciding them ad hoc. Use route state changes from the circuit breaker to select a mode, subject to each workload’s requirements.

Mode Visible capabilities Safety controls Latency and cost Escalation
Full Normal features through the primary route or a fully compatible backup Keep required validation and tool permissions Normal latency target; approved spend ceilings Routine support
Reduced Shorter answers, read-only access or labelled cached results Disable unsupported actions; keep safety checks State the changed response target; cap tokens and spend Deferred processing or human handover
Queued Accept work for later processing and show a completion window Preserve tenant isolation, ordering and cancellation Longer delay; approved capacity and budget Notify on completion, failure or expiry
Unavailable Explain why the task cannot safely proceed Block unsupported work and unresolved partial actions Immediate rejection; no model calls Human handover or retry window

For each mode, record entry and exit criteria, maximum duration, user message and responsible owner. Before serving cached content, check access, tenant scope, validation and expiry. Show its age, and reject stale or revoked entries.

Never send unsupported work to a smaller model, remove safety checks or drop necessary context. Queue the work, make service limits visible or hand it to a person.

Test backup quality and outage recovery

Use the approved route registry and service modes to check whether each backup is safe enough for automatic failover. A successful response does not prove recovery. Before approving automatic failover, set workload-specific thresholds for quality, reliability, latency and cost. Reject any backup that falls below the minimum service level or introduces unacceptable factual, safety or action errors.[19][14]

Test representative tasks before live use

Build a version-controlled test set from actual workloads, using the same workload mix as the route registry. Include normal and difficult requests, relevant languages, long-context prompts, retrieval-grounded answers, structured output and tool use. Record expected answers, required fields, allowed actions and when escalation is required.

Measure task success, factual accuracy, source accuracy, schema validity, tool-call correctness, safety outcomes and escalation rates. Track timeout rate, p95/p99 latency, token use and cost per successful task, including retries. Record sample sizes so a small test does not create false confidence.[23]

Follow offline tests with privacy-cleared shadow traffic that cannot reach customers or trigger actions. Once that passes, move to a 1% canary of eligible, low-risk requests, with monitoring and an immediate rollback switch. Repeat tests after material changes to model versions, prompts, retrieval, tool schemas, provider APIs or routing rules. Keep results and approval decisions with the route evaluation record.[16][19][20]

Rehearse outages and the return to primary routes

After offline scoring, rehearse the actual failover path in a test environment. Block the primary route and inject timeouts; HTTP 429, 500, 502 and 503 errors; invalid responses; slow, interrupted or truncated streams; partial degradation; and exhausted backup capacity.

Check that retries stay bounded, circuit breakers open and requests move into the correct reduced or unavailable mode. Verify that conversation history, retrieved context and tool results survive within the backup’s limits. For interrupted actions, check durable action logs before retrying. Confirm that idempotency and deduplication prevent a completed action from happening twice.[11]

Test the controlled return to primary routes as carefully as failure. Once healthy probes and live traffic metrics confirm recovery, restore traffic in stages, with an observation period at each step. Roll back if error, latency, quality or spend thresholds fail.

Include prolonged outages in rehearsals. Draining queued work must not cause a surge, duplicate actions or route flapping. Fix failed checks and repeat the drill before approving automatic failover.[21][22][24]

Cap failover costs and complete the runbook

Once backup routes are approved, set firm spending limits so failover costs stay bounded.

Enforce incident budgets and traffic limits

Apply one retry budget across the application, gateway and provider clients. Define maximum attempts, a total deadline, back-off delay and jitter. Pass that budget downstream so a fallback call cannot restart retries.

Cap input and output tokens, context length, concurrency per provider and route, and queue size. Set per-user, tenant and application allowances. Keep interactive and batch budgets separate, and limit both fallback duration and its share of traffic.

Reserve estimated costs before dispatch, allowing for retries and in-flight requests. Reconcile these reservations against actual usage afterwards, including failed calls that still incur charges.

Make the routing policy explicit:

  • Reject new billable work if its reservation would breach the cap.
  • Queue non-urgent batch work when capacity or budget is temporarily unavailable.
  • Use approved reduced service for eligible interactive requests. Otherwise, return a clear unavailable response.

Set budgets in £ using current pricing. Document whether they include tax, discounts and provider-specific charges. Use these limits to guide dashboards and incident response.

Track outcomes and assign incident owners

Keep separate dashboards for primary and fallback traffic. Track fallback rate, request cost, cost per successful task, tokens by route, quality, p95/p99 latency, circuit state, queue depth and reduced-service use. Include retries and human rework in task costs.

Add route-level dimensions for provider, model, tenant, application, region and incident identifier. Attribute usage to each tenant, application and incident. Retain enough detail to compare results with representative-task tests while minimising stored prompt and response data.

Record detection thresholds, approved route order and recovery gates in the runbook. Name an incident owner and a technical routing owner, along with deputies and contact details. State who can approve budget extensions, change service mode or authorise a return to primary routes.

Include escalation contacts and user messages for full service, reduced service, queued work and unavailability. Define rollback conditions and a cooldown period before traffic returns to the primary route. After each incident, reconcile charges and assign corrective actions with owners and due dates.

Check readiness for automatic failover

Carry these controls into the final approval gate. The sign-off checklist should cover:

  • Approved routes, capacity, pricing, data-processing and residency terms, supported features, token limits and owners.
  • Route order, health and quality gates, bounded retries, circuit-breaker rules and gradual-recovery rules.
  • Traffic and budget caps, queued work and reduced-service behaviour.
  • Cost reservation and reconciliation.
  • Dashboards, alerts, escalation paths and user messages.
  • Outage rehearsal evidence and post-incident actions.

Approve automatic failover only when the system can switch routes, cap exposure, communicate degradation and return safely without manual code changes.

FAQs

How do I set failover thresholds for low-traffic workloads?

Avoid percentage-based triggers: they can trip when they shouldn’t and cause unnecessary outages. Instead, use absolute failure thresholds or sliding windows large enough to reveal meaningful patterns - typically 10 to 20 calls. Base your settings on actual traffic data, and exclude business-logic errors, such as 404s, from trigger criteria [1].

Test thresholds against representative tasks in a non-production environment. This helps balance availability and reliability without setting off uncontrolled failover activity [1][2].

How often should I revalidate backup models?

Revalidate backup models when your traffic mix, prompt structures, context length, model versions, pricing or rate limits change. Do the same if production monitoring shows changes in error rates or validator performance.

Check costs and savings regularly against current performance data. Routing thresholds can become less suitable as models and system behaviour change. Record every threshold change, along with the evidence behind it and a clear rollback plan.

How do I budget for a prolonged provider outage?

Track total workflow spending, not just inference costs. Include classification, validation, retries and fallback charges, and measure the cost per successful task in £ [1][2].

Set token and £ limits for each request, alongside daily and monthly budgets, to keep failover spending in check [2]. Record fallback-switch costs separately. Keep fallback attempts within the original request’s shared attempt and time budgets so costs don’t keep adding up [1].

Need help with your DevOps, cloud or AI plans?

Hokstad Consulting helps companies with DevOps transformation, cloud architecture and hands-on AI development — pragmatic consulting with measurable results.

Our services: DevOps on Retainer · Hosting & Cloud · AI Development & Strategy