Keep working when a model fails
Give a request backup models so OpenRouter can try another model when the first one can’t respond.
OpenRouter already tries another provider when one provider for a model fails. Model fallbacks go a step further: if the model itself can’t answer, OpenRouter moves to a different model.
Send a models array in priority order instead of a single model.
{
"models": [
"anthropic/claude-sonnet-4.5",
"google/gemini-3.8-flash"
],
"messages": [
{
"role": "user",
"content": "Summarize this support ticket."
}
]
}If the first model returns an error, OpenRouter tries the next one. That covers downtime, rate limits, and prompts that are too long for the first model’s context window. If the last model in the list also fails, the request returns that error.
Check your understanding
A request lists a large model first and a small, cheap model second. The large model is rate-limited for an hour. What does the bill show for that hour?
You pay for the model that actually answered, and the response’s model field tells you which one that was. Check it in your logs to see how often fallbacks happen.
You can also put fallback models in a preset, so callers get them without adding models to every request.
Apply it
Your team’s long documents sometimes fail with a context-length error. How could fallbacks help?
Add a model with a larger context window to the models list after the usual one. Normal requests keep using the first model, and long documents that it can’t take fall back to the larger one. Watch the model field to see how often that happens and what it costs.
Takeaway
Send models in priority order and OpenRouter tries the next one if a model errors, is rate-limited, or can’t fit the prompt. You pay for the model that answered, which the model field shows.
Try it live
OptionalSend a request with a two-model models list, then check the response’s model field and the matching entry in Logs.