Skip to main content
aifinhub

Playground

Fallback Chain Simulator

LLM fallback chain simulator: Monte Carlo a primary + two fallbacks across Anthropic, OpenAI, Google. Success rate, p50/p95/p99 latency, cost, degradations.

Transparent by design — computed in your browser from a published formula and sourced rates, not a black box. Data verified May 25, 2026. Sources: Anthropic pricing ↗ · OpenAI pricing ↗ · Google AI / Gemini pricing ↗ Full methodology →

Inputs
Paste + configure
Runtime
1–15 s
Privacy
Client-side · no upload
API key
Not required
Methodology
Open →

Education · Not investment advice. BaFin/EU framework. Past performance does not indicate future results. Editorial standards Sponsor disclosure Corrections

1 · Configure the chain

Primaryprimary
8.0%
3500ms

ref p50 = 900ms

Fallback 1fallback 1
5.0%
3000ms

ref p50 = 700ms

Fallback 2fallback 2
3.0%
2500ms

Success rate

70.0%

700 / 1000 trials cleared the 1.00s deadline · p95 1.00s · p99 1.00s

p50: 571ms  ·  Cost: $20.604 total ($0.021/call)  ·  Degradations: F1 55 · F2 5

2 · Provider utilization (share of successful trials)

Claude Sonnet 4.6primary91.4% · 640 trials
GPT-5.4 minifallback 17.9% · 55 trials
Gemini 2.5 Flashfallback 20.7% · 5 trials
Failed (exceeded deadline)30.0% · 300 trials

Recommendation

Gemini 2.5 Flash has a better cost-per-successful-call than the current primary (0.0316 → 0.0030). Consider swapping.

How the trial is simulated

for each trial:
  elapsed = 0
  for leg in [primary, fallback1, fallback2?]:
    if uniform() < rate_429:   # throttled
      elapsed += 50ms; continue
    latency ~ Exponential(mean = max(p50, p99 / ln(100)))
    elapsed += latency
    if elapsed <= deadline:    # success on this leg
      return success
  return failure

Failure modes modeled independently per leg (rate-limit + latency tail). See methodology for assumptions and limits — real outages are correlated and bursty.

How to use

Step-by-step

Full calculator guide →
  1. 1

    Add up to three legs in priority order: primary, then fallback 1 and fallback 2.

  2. 2

    For each leg, pick the provider and model, then set the 429 failure-rate slider (0–30%) and the p99 latency.

  3. 3

    Set the request-level inputs: input/output token counts and the per-call deadline. Cost is derived from tokens × each model's price — you don't enter a per-call cost.

  4. 4

    Run the simulator. Read overall success rate, p50/p95/p99 latency, total cost, and the degradation-event distribution.

  5. 5

    Compare a 2-leg chain against a 3-leg chain; the marginal success-rate gain usually shrinks after the second fallback. Each leg is tried once — there is no retry toggle.

For agents

Use in an agent

Same math, same result shape as the UI above — as a static ES module. No HTTP request, no auth, no rate limit.

import { compute } from "https://aifinhub.io/engines/fallback-chain-simulator.js";

Contract: /contracts/fallback-chain-simulator.json Full agent guide →

Glossary references

Terms used by this tool

All glossary →

Questions people ask next

FAQ

What's a fallback chain?

A sequence of LLM endpoints to try in order when an upstream call fails: e.g., primary Anthropic, fallback OpenAI, last-resort cache. Production agent systems use chains to maintain availability when individual providers go down or rate-limit. The simulator models cost, latency, and success rate across the chain.

How are failure rates set?

You set them. Each leg has a 429-rate slider (0–30%) that you set to your observed provider failure rate; the defaults are 8%, 5%, and 3% for the three legs. The simulator does not auto-calibrate from status pages or published reliability targets — the numbers are yours to supply.

What's the cost of a fallback path?

Cumulative cost of every leg that actually runs before success. In the simulator a 429 is fast (about 50ms) and bills no tokens, so if the primary fails 0.5% of the time and the fallback is 3× more expensive, your effective cost is 0.995 × primary + 0.005 × 3·primary ≈ 1.010× primary. Worst case is paying for every leg that executed and then timed out.

Should the fallback always be a different provider?

Multi-provider fallback gives correlation-of-failure protection (one provider's outage doesn't take down both). Same-provider fallback (different model tier) gives capacity-overflow protection (rate-limit on Opus, retry on Sonnet). The simulator lets you mix both strategies.

Does the simulator model retries?

No. Each leg is tried exactly once, and on failure the request falls through to the next leg — there is no retry-on-timeout or retry-on-error toggle. To approximate a retry against the same provider, add another leg pointing at the same provider and model.

Complementary tools