Guide

AI model fallback: why one provider is a single point of failure

Model fallback is an ordered list of AI models your chatbot tries in turn, so that when the first one is rate limited, overloaded or down, the next one answers and the visitor never sees an error. If your chat depends on one provider and one key, that key is a single point of failure for your whole website chat. This guide explains the failure modes, which errors should fall through and which should not, the design patterns that work, what fallback costs, and how to test a chain safely.

2 to 5models in a chain, depending on the plan
Retries firstshort backoff on the same step before falling through
Friendly failuremessage shown only if every step fails

How a single provider fails

Model fallback only makes sense once you have seen how a lone provider lets a chatbot down. None of these are exotic. With a bring-your-own-key setup the provider’s limits become your limits, so each one can silence your chat.

Failure modes of a single AI provider, and how long they last
FailureWhat you seeUsual causeLasts
Rate limitHTTP 429Too many requests or tokens per minute for your tierSeconds to minutes
Overload or server errorHTTP 5xx, “overloaded”The provider is busy or a node is failingSeconds to minutes
OutageTimeouts, connection errors, many 5xx at onceA provider incidentMinutes to hours
Exhausted credit or quota402, or 429 with “quota” or “insufficient balance”Prepaid balance empty or a spend limit reachedUntil you add credit
Invalid or revoked key401 or 403Key deleted, rotated or mistypedUntil you fix it
Retired or unavailable model404, “model not found”The provider retired the model name or your account lacks accessPermanent for that name
TimeoutNo reply within the step’s timeA slow model, long reasoning or a very large promptVaries
Empty or malformed replyA response with nothing usable in itA rare model or gateway glitchUsually one-off

Notice the mix. Some failures clear themselves, some need you to act, and one of them, a retired model, can arrive on a quiet Tuesday with no outage at all. A chatbot that handles only the first group will still break. Our troubleshooting guide covers fixing each one.

Put a second model behind the firstAdd a fallback step on another provider, break the first key on purpose in the playground and watch the second one answer. The Free plan needs no credit card.
Start free

What a fallback chain is

A chain is an ordered list of steps. Each step names a key, a model and a few parameters. For every visitor message the system tries step one, and if that step fails in a way another model could fix, it moves to step two, and so on down the list. If a step answers, the visitor never learns that a switch happened.

Two ideas make the difference between a chain that helps and one that merely exists. First, the failures have to be classified: switching on every error is wasteful, and switching on none is useless. Second, the switch has to preserve the conversation: if step two starts from a blank page, a visitor halfway through a booking sees the agent forget everything.

Which errors should fall through, and which should not

The rule is simple: fall through when a different step could plausibly succeed, and stop when it could not.

How a SiteTrellis chain treats each kind of error
ErrorFalls through?Reason
Network error or timeoutYesAnother provider may be reachable.
429 rate limitYes, after retriesAnother key or provider has its own limit.
5xx or overloadedYes, after retriesA different provider is probably healthy.
Invalid, expired or unauthorized keyYesThe key is also marked as failing so you see it in the dashboard.
Retired model, or a prompt too large for that modelYesIt is a fault of the step, not of the request.
Empty or malformed replyYesA second attempt elsewhere is a quick fix.
Content-policy refusalNoAnother model would usually refuse the same request, and quietly routing around a refusal is the wrong default.
Bad requestNoThe request itself is wrong, so another provider would not fix it. Fixing it is your job.

The two “no” rows deserve a sentence each. A refusal is information: a model declined for a reason, and sending the same text to a more permissive model until one complies defeats the point of a safety layer. A bad request is a bug: if every provider returns the same complaint, falling through just multiplies the failed calls and delays the visitor. Some errors look like bad requests but are really limits of one model, such as a prompt longer than that model’s context window. Those count as a problem with the step, and the chain moves on.

How SiteTrellis runs a fallback chain

Every agent has a model chain in the builder. The behaviour below is what you get without writing any code; the details are in the AI keys overview and Build your agent.

  • Steps. Each step is a key, a model and parameters: temperature, maximum reply length, a timeout (3 to 55 seconds, default 30) and retries (0 to 3, default 1).
  • Retry before falling through. A temporary error is retried on the same step after a short backoff. Timeouts are not retried, because the step has already spent its time.
  • A failing step is skipped for a short while. If a step keeps failing, later visitors do not wait on a provider that is known to be down. If every step looks unhealthy, the chain still tries them in order rather than give up without trying.
  • Context is rebuilt for each step. A switch in the middle of a conversation keeps working, including the history of tool calls such as a captured lead or a lookup.
  • One time budget. The whole reply has an overall time budget of well under a minute, so several slow steps cannot add up to a visitor waiting forever.
  • A friendly failure message. If every step fails, the visitor sees the message you wrote for the agent instead of a raw error.
  • Plan limits. The chain can have 2 steps on Free, 3 on Starter and 5 on Pro.

The conversation trace in the dashboard records each attempt with its model, status and error, which is how you tell afterwards that a fallback happened.

Design patterns that work

Four common chain designs
PatternBenefitWatch out for
Small, fast model first, stronger model secondLow cost and quick replies for most chats, a safety net with more capabilityThe second model answers differently and costs more per reply
Same lab, different modelSimilar style, same account and billingA lab-wide outage or key problem takes out both steps
Different lab, same sizeProtects against a provider outage and a provider-wide rate limitTwo accounts to fund and two privacy agreements to read
OpenRouter as the second routeOne key that reaches models from several labsIt is a separate account with its own balance, and a failing key or empty balance there helps no one

Small model first, then a stronger one

Most website chats are short questions that a small model answers well, so putting one first keeps cost and latency down. The stronger model then covers the rare case where the first one is unavailable. Do not read this as “escalate hard questions”: the chain switches on errors, not on difficulty.

Cross-provider fallback

The strongest protection against a provider incident is a step with a different provider, because the first step’s rate limits, balance and outages are then irrelevant to the second. The price is operational: another account, another spend limit and another set of data terms. Setting one up is covered in the guides for Anthropic, OpenAI, Gemini, DeepSeek and OpenRouter. How to choose an LLM for website chat helps pick the pair.

Make every step tool-capable

If your agent captures leads or calls custom tools, every step must use a model that supports tools. A fallback that cannot call the tool leaves the chat answering but unable to do its job.

What fallback costs

A fallback chain costs nothing while it is idle: you pay a provider only for the requests it receives. The cost appears when a step answers. Two examples from our catalog, as estimates for 1,000 conversations under the default assumptions (6 visitor messages per conversation, 1,500 tokens of prompt and knowledge sent every turn, and 180-token replies): about $1.79 on Claude Haiku 5.5 and about $35.88 on Claude Sonnet 5.5. Your provider’s invoice is authoritative.

So if a stronger model sits in step two, the conversations that fall through cost the stronger model’s rate, and an extended incident on the first provider moves your whole bill to the second. A request that a provider rejects outright is generally not charged, but a request that times out after generation started might be, so read each provider’s billing rules. A retry on the same step can also repeat a request, which is another reason to keep the retry count low. The practical advice: set a spend limit at every provider in the chain, not only the first, and use the cost calculator to see what a second-step model would cost if it had to carry all your traffic.

How to test a fallback chain

Do not wait for a real outage to find out whether your chain works. You can rehearse the failure on purpose, in the playground, which does not count against your plan’s conversations.

  1. Add a deliberately broken key

    In AI providers, add a key entry with a made-up value. SiteTrellis saves it, tests it and marks it failing. Alternatively use a real key with a tiny spend limit at the provider to provoke a quota or 429 error.

  2. Put it in step one

    In the agent builder, make the broken key the first step and your real key the second.

  3. Ask a question in the playground

    The reply should still arrive, a little slower. Open the conversation trace to see the failed attempt on step one and the answer from step two.

  4. Test the tools mid-conversation

    Start a conversation with the good step first, then break it and carry on. Check that tool calls and earlier context survive the switch.

  5. Break every step

    Make all steps invalid and confirm that the friendly failure message appears, and that you are happy with its wording.

  6. Restore and republish

    Put the real key back in step one, test it, and only then publish. Remove the broken key entry so it does not confuse you later.

Because a playground chat uses your real key, rehearsals cost a few cents at most. They are worth repeating after you change models, since providers retire model names.

What fallback does not do

Fallback improves resilience. It does not guarantee uptime. If every step in the chain fails, or the whole reply runs out of its time budget, the visitor sees the failure message.

  • A different model answers differently. Tone, length and the way it follows your instructions can change. Test your key questions on every step, not only the first.
  • It cannot fix a shared cause. Two steps that use the same key, the same exhausted balance or the same retired model fail together.
  • Failed attempts take time. A timeout before the switch makes that one reply slower, so use sensible per-step timeouts and a fast first step.
  • It does not refresh credit or rotate keys. Watch for keys flagged as failing and top up balances, ideally before a visitor notices.

For the underlying model behind a chat, a quick refresher is what BYOK means for AI chatbots, and our BYOK page shows where fallback fits in the whole setup.

Frequently asked questions

What is model fallback in an AI chatbot?

It is an ordered list of AI models the chatbot tries in turn. If the first model is rate limited, overloaded, unreachable or its key is invalid, the next one answers, so the visitor does not see an error.

Which errors should trigger a fallback?

Network errors, timeouts, rate limits (429), server errors (5xx), invalid or expired keys, retired models and empty or malformed replies. A different model or provider might succeed in all of those cases.

Why do content-policy refusals not fall through?

A refusal is a deliberate answer. Another model would usually refuse the same request, and sending it down the list until one complies would route around a safety layer. Bad requests do not fall through either, because the request itself needs fixing.

Does a fallback chain guarantee my chat stays online?

No. It improves resilience, but a shared cause such as an empty balance on a key used by every step, or a failure of every provider at once, still ends in the failure message. A different model may also answer slightly differently.

Should the second step be from a different provider?

Usually yes. A step with a different provider is unaffected by the first provider’s outage, rate limit or empty balance. The trade-off is another account to fund and another data agreement to read.

Will fallback make my bill higher?

Only when a fallback step answers. An idle step costs nothing. If the second model is stronger, the conversations that reach it cost its rate, so set a spend limit at every provider in the chain.

How do I test fallback without an outage?

Add a deliberately invalid key, or a real key with a tiny spend limit, as step one. Ask a question in the playground and check that step two answers. Then break every step to see the failure message.

Put a second model behind the first

Add a fallback step on another provider, break the first key on purpose in the playground and watch the second one answer. The Free plan needs no credit card.

  • No credit card
  • Live in about 5 minutes
  • Your keys, your rules