Fallback Chain
Which model actually served a request: the fallback order drawn as a small flow with a running clock and cost, each failed try broken red with its reason, the one that answered carried through to the response.
oxyn add fallback-chainSummarise the support ticket
Attempt 1 of 40.0s$0- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Trying
- Model
- Opus 4.1
- Time
- 0.0s of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Azure · eastus2Waiting
- Model
- GPT-5
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- Vertex · europe-west4Waiting
- Model
- Gemini 2.5 Pro
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- xAI · directWaiting
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Status
- Not back yet
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Rendered from Rust at build time · goes live when visible
When to use
- Which model actually served a request: the fallback order as a small flow with a running clock and cost, each failed try broken red with its reason, the one that answered carried on to the response.
When not to use
- An agent asks before it acts: use Approval Card instead.
- Several open requests in one card: use Approval pager instead.
- An agent's question in its own card above the composer: use Decision Card instead.
Installation
Fallback Chain is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add fallback-chainuse crate::oxyn::{FallbackChain, STATUS_INDICATOR_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{FallbackChain, STATUS_INDICATOR_CSS};
Usage
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Examples
Live
Plays and loops: a dotted light grows along each branch while that model is tried; the first is rate limited, the second runs out of time, the third answers and runs on to the response. Clock and cost tick in the header.
Summarise the support ticket
Attempt 1 of 40.0s$0- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Trying
- Model
- Opus 4.1
- Time
- 0.0s of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Azure · eastus2Waiting
- Model
- GPT-5
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- Vertex · europe-west4Waiting
- Model
- Gemini 2.5 Pro
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- xAI · directWaiting
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Status
- Not back yet
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Settled
The finished run: two red breaks, the answer in green, one model never asked.
Summarise the support ticket
Answered7.7s$0.0049- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Answered
- Model
- Gemini 2.5 Pro
- Time
- 3.1s of 5.0s
- Cost
- $0.0049
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Gemini 2.5 Pro
- Tokens
- 412
- Took
- 7.7s with 2 fallback(s)
- Spent
- $0.0049
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}First try
The first model answers – everything after it stays dashed and is marked not needed.
Summarise the support ticket
Answered1.6s$0.0027- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Answered
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0.0027
- Code
- 200 – ok
- Price
- $3 / $15 per 1M
- Azure · eastus2Not needed
- Model
- GPT-5
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- Why
- An earlier model answered
- Vertex · europe-west4Not needed
- Model
- Gemini 2.5 Pro
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- Why
- An earlier model answered
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Opus 4.1
- Tokens
- 412
- Took
- 1.6s with 0 fallback(s)
- Spent
- $0.0027
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Second try
One rate-limit break before the second model answers.
Summarise the support ticket
Answered4.3s$0.0031- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Answered
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0.0031
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- Vertex · europe-west4Not needed
- Model
- Gemini 2.5 Pro
- Time
- – of 5.0s
- Cost
- $0
- Price
- $1.25 / $10 per 1M
- Why
- An earlier model answered
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- GPT-5
- Tokens
- 388
- Took
- 4.3s with 1 fallback(s)
- Spent
- $0.0031
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}All failed
Every model fails: red branches, a red status, no response, and a Retry button in the header.
Summarise the support ticket
All failed4.0s$0- Route
- router/auto
- Models
- 3 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 0.9s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 1.8s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Failed
- Model
- Gemini 2.5 Pro
- Time
- 0.7s of 5.0s
- Cost
- $0
- Code
- 503 – overloaded
- Price
- $1.25 / $10 per 1M
- Why
- 503 · overloaded
- Status
- No model answered
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Details
A model opened: provider, its tag, then model, time against its budget, cost, status code, list price and the reason.
Summarise the support ticket
Answered7.7s$0.0049- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Answered
- Model
- Gemini 2.5 Pro
- Time
- 3.1s of 5.0s
- Cost
- $0.0049
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Gemini 2.5 Pro
- Tokens
- 412
- Took
- 7.7s with 2 fallback(s)
- Spent
- $0.0049
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Medium
Under 600 px the provider leaves the row and lives only in the details card.
Summarise the support ticket
Answered7.7s$0.0049- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Answered
- Model
- Gemini 2.5 Pro
- Time
- 3.1s of 5.0s
- Cost
- $0.0049
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Gemini 2.5 Pro
- Tokens
- 412
- Took
- 7.7s with 2 fallback(s)
- Spent
- $0.0049
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Narrow
Under 520 px the diagram becomes a vertical tree on a dashed rail.
Summarise the support ticket
Answered7.7s$0.0049- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Answered
- Model
- Gemini 2.5 Pro
- Time
- 3.1s of 5.0s
- Cost
- $0.0049
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Gemini 2.5 Pro
- Tokens
- 412
- Took
- 7.7s with 2 fallback(s)
- Spent
- $0.0049
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}Classic
Classic style: header band over a grey field, flatter nodes.
Summarise the support ticket
Answered7.7s$0.0049- Route
- router/auto
- Models
- 4 in order
- Asked
- Summarise the support ticket
- Bedrock · us-east-1Failed
- Model
- Opus 4.1
- Time
- 1.6s of 5.0s
- Cost
- $0
- Code
- 429 – too many requests
- Price
- $3 / $15 per 1M
- Why
- Rate limited · 429
- Azure · eastus2Failed
- Model
- GPT-5
- Time
- 2.4s of 5.0s
- Cost
- $0
- Code
- 504 – no reply before the budget ran out
- Price
- $1.25 / $10 per 1M
- Why
- Timed out
- Vertex · europe-west4Answered
- Model
- Gemini 2.5 Pro
- Time
- 3.1s of 5.0s
- Cost
- $0.0049
- Code
- 200 – ok
- Price
- $1.25 / $10 per 1M
- xAI · directNot needed
- Model
- Grok 4
- Time
- – of 5.0s
- Cost
- $0
- Price
- $3 / $15 per 1M
- Why
- An earlier model answered
- From
- Gemini 2.5 Pro
- Tokens
- 412
- Took
- 7.7s with 2 fallback(s)
- Spent
- $0.0049
Code
rsx! {
FallbackChain {
attempts: Some(router.attempts()),
request: req.summary(),
route: "router/auto",
on_retry: move |_| router.retry(req),
now: clock.now(),
}
}API reference
FallbackChain
| Prop | Type | Default | Description |
|---|---|---|---|
attempts | Option<Vec<FbAttempt>> | Default::default() | The models in fallback order (the demo's when `None`). |
request | String | "Summarise the support ticket" | The request as the header title. |
route | String | "router/auto" | The router the request went through (under "Request"). |
live | bool | Default::default() | Demo: the chain plays out live and loops; otherwise it shows the settled result. |
gap_ms | u64 | 300 | Hand-over pause between two tries, ms. |
open | Option<usize> | Default::default() | The attempt whose details are open from the start. |
nowrequired | ClockMs | — | The clock. |
style | String | Default::default() | `clean`, `classic`, or empty to follow `data-cstyle`. |
on_retry | EventHandler<()> | — | Retry pressed (shown when every model failed). |
on_open_change | EventHandler<Option<usize>> | — | An attempt's details opened (index) or closed (`None`). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Request, then each model in order, then the response – each shows its details card on focus |
| EnterorSpace | Pins a node's details card open or closes it |
| Escape | Closes a pinned card |
Accessibility
- Each model is a button whose name carries its place in the order, model, provider and what happened to it; its details card is a role=tooltip that opens on hover, focus or click.
- The header status (attempt k of n, answered, all failed) is a status region; failures are named in words, never colour alone.
- The links are an aria-hidden SVG; the order is also the list order. Reduced motion stops the travelling light and the drawing.
Responsive behaviour
- Wide: request, links, models, links, response in one row.
- Under 600 px the provider moves into the details card.
- Under 520 px the links give way to a dashed rail and request, models and response stack.
Edge cases (spec)
Under 600 px the provider leaves the row (it stays in the details card); under 520 px the diagram becomes a vertical tree on a dashed rail with request, models and response stacked.
Notes for AI
- Import
FallbackChainfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
FallbackChainElinoxyn_gpui. - Props to set first:
now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.