Pipeline
one row per stageNo request has run yet.
Python · FastAPI · reliability engineering
One API in front of any model provider, and the machinery that keeps it standing up in production: routing, retries with exponential backoff and jitter, per-provider circuit breakers, failover down a route chain, response caching, tool calling, JSON-schema-constrained output with a repair loop, per-key rate limits, budgets and cost accounting.
A browser reimplementation of that pipeline's control flow, written so the mechanics can be watched
live. No language model is called. There is no network request, no API key and no
spend: provider replies come from a deterministic local stub, and every latency, token count and
cost figure below is simulated. Prices mirror the operator-supplied price book in the repository's
config/gateway.json, expressed in USD per million tokens.
The production implementation is Python and FastAPI - the retry policy, breaker, cache fingerprint, token-bucket limiter and error taxonomy modelled here are ports of its modules. Read the source on GitHub.
Each preset sets the controls below and runs one request. Start here.
Or build one by hand and inject a fault to see how the pipeline reacts.
Identical text plus identical options produces the same cache fingerprint.
The model name selects an ordered provider chain from the routing table.
The error taxonomy decides whether retrying or failing over could possibly help.
Idle. Pick a scenario, or send the request above.
Stages append as they resolve. Provider breakers and totals persist until you reset.
No request has run yet.
Breakers are created on first use, as in the Python registry.
| Time | Model | Provider | Tokens | Cost (USD) | Cache | Outcome |
|---|
The ledger fills as requests complete.
// The normalised ChatResponse - or an RFC 7807 problem document - appears here.
One JSON line per event, as the Python logger emits.
Each stage in the pipeline stands for a concern the production gateway has to answer.
Retry-After.failure_threshold times in a row it is skipped outright until a recovery window elapses, then a couple of probe requests decide whether it is back. That turns a dead upstream from a full retry budget per request into an O(1) skip.Retry-After wins, capped so a hostile header cannot stall the request.max_tool_iterations so a loop cannot bill forever.
Figures on this page are produced by the local stub, not measured against a model. The simulated
prices match the repository's price book for the sim-* models so the arithmetic is
real even though the tokens are not.