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 →
1 · Configure the chain
ref p50 = 900ms
ref p50 = 700ms
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)
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 failureFailure 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
- 1
Add up to three legs in priority order: primary, then fallback 1 and fallback 2.
- 2
For each leg, pick the provider and model, then set the 429 failure-rate slider (0–30%) and the p99 latency.
- 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
Run the simulator. Read overall success rate, p50/p95/p99 latency, total cost, and the degradation-event distribution.
- 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
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.
Related deep dive
All articles →Read further
Long-form context behind the tool output.
- Tutorial · Runnable·10 min
Rate Limit Design for LLM Research Loops
Three primitives that turn bursty finance workloads into stable loops: per-provider token bucket, cross-provider fallback chain, and graceful degradation.
Read - Pillar · Guide·13 min
Model Selection in Finance: Surviving Benchmarks
Model selection finance methodology: a five-axis rubric, quarterly rebench cadence, version-pinning, and shadow A/B that survive 3-6 month.
Read - Pillar · Guide·11 min
Vendor Lock-In Risk: How to Architect Cross-Provider
Anthropic, OpenAI, and Google can all break or price-jump in one quarter. The fallback-chain architecture that survives a single-vendor outage.
Read
Complementary tools
Users of this tool often explore
Agent Cost Envelope Calculator
Model an LLM research loop end-to-end — steps, tool calls, convergence checks, markets per day — and see per-loop, daily, and monthly cost with cost-cap.
Trading System Blueprinter
Pick your data source, LLM, broker, storage, risk engine, and logger. Get a Mermaid architecture diagram and a copyable starter file tree — the full stack before you write code.
Token-Cost Optimizer
Compute the dollar cost of a trading research loop across Claude, GPT, and Gemini. Prompt length × model × retry × call volume → cost per idea and per.