Private beta: The LLM Gateway is in private beta. Sign up for the waitlist to get access.
How it works
A fallback configuration has:- A name, exposed at the route
https://gateway.smith.langchain.com/routes/{name}. Clients call this URL instead of a provider-specific path. - One or more fallback chains, each an ordered list of model configurations to try in priority order.
- Triggers: the upstream HTTP status codes that should cause the gateway to move on to the next model in the chain—for example
429for rate limits, or500,502,503,504for other provider errors.
- Picks a chain (see Selecting a chain by model).
- Calls the chain’s first model configuration.
- If the response status matches a configured trigger, discards that response and calls the next model configuration in the chain.
- Repeats until a candidate returns a non-trigger response, or the chain is exhausted—in which case the last candidate’s response is returned to the caller.
model is used only to select a chain; if it doesn’t match any chain, the first (default) chain is used. If a fallback is triggered the original request’s model is overridden with the model tag in the Model Configuration. So you can fallback from model-x to model-y, for example.
Only OpenAI Compatible Endpoint model configurations—the same type used for custom providers—can be added to a fallback chain.
Create a fallback configuration
- Go to Settings → Gateway → LLM Gateway and select the Model Fallbacks tab.
- Click Create configuration.
- Enter a Configuration name. This becomes
{name}in the gateway URLhttps://gateway.smith.langchain.com/routes/{name}. - Select the Workspace the configuration belongs to. Model configurations are workspace-scoped, so only that workspace’s configurations are available to add to a chain. The workspace can’t be changed later—delete and recreate the configuration to move it.
- Under Fallback triggers, add the HTTP status codes that should trigger a fallback (for example
429,500,502,503,504). - Under Model fallback chains, click Add chain, then add model configurations to it in the order they should be tried. The first chain is the default chain, used whenever a request’s model doesn’t select a different one.
- Click Create configuration.
Make a call
Call the route the same way you’d call a custom provider:Selecting a chain by model
A configuration can hold more than one fallback chain—useful when different model families need different fallback behavior. The gateway selects a chain by matching the request body’smodel field against each chain’s primary (first) model configuration’s underlying model name:
- If
modelmatches a chain’s primary model, that chain is used. - If
modelis omitted, or doesn’t match any chain’s primary model, the first (default) chain is used.
- A request with
"model": "gpt-5.5"uses chain 1, which fails over from OpenAI to Azure to Bedrock. - A request with
"model": "gpt-4o-mini"uses chain 2, which fails over from OpenAI to Fireworks. - A request with an unrecognized or omitted model uses chain 1, the default.
"model": "heavy" to route to the first chain.
Next steps
- Custom model providers: the model configuration type used in fallback chains.
- Spend policies: apply cost limits alongside fallback routing.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

