Yaha AI Gateway
Routing

Model fallback

Automatic failover across model chains

Model fallback routing

Yaha supports OpenRouter-compatible fallback chains on the gateway hot path.

Enable failover

Either:

  1. Set "route": "fallback", or
  2. Provide a models array (implicit failover when multiple models are listed)
{
  "model": "openai/gpt-4o",
  "models": ["anthropic/claude-3.5-sonnet", "google/gemini-flash"],
  "route": "fallback",
  "messages": [{ "role": "user", "content": "Hello" }]
}

Failover triggers

The gateway tries candidates in order. It fails over to the next model when:

  • Upstream returns 429 or 5xx, or
  • The upstream connection fails

Failover only happens before any response bytes are sent to the client (safe for streaming).

Control-plane routing

Org/project smart routing and prompt routing still run before the fallback chain is built. Fallback operates on the resolved candidate list.

On this page