Tasks

Configure a fallback chain

Try one provider, fall back to the next on failure, and choose how candidates are ordered.

A fallback chain tries one provider, then the next on failure, so a single provider outage doesn't take your app down. Declare it with the x-routeplane-provider header: a comma-separated list, most-preferred first.

Declare the chain

bashOpenAI → Anthropic → Gemini
curl -s https://<gateway-host>/v1/chat/completions \
  -H 'content-type: application/json' \
  -H 'x-routeplane-api-key: rp_...' \
  -H 'x-routeplane-provider: openai,anthropic,gemini' \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Drop the header to use the key's default provider. Routeplane advances to the next candidate on a retryable failure, and the per-provider circuit breaker keeps a failing upstream out of rotation.

Choose how candidates are ordered

By default the chain is honoured in priority order (left to right). Override it with x-routeplane-strategy:

StrategyOrders candidates by
priorityThe order you listed them (default).
weightedConfigured weights.
costCheapest eligible candidate first.
latencyLowest observed latency first (per-provider EWMA).
Note. Sovereign routing overrides any chain you specify: when a request carries regulated personal data, the residency lock wins. See Enforce data residency.

Want the whole policy, targets, retries, conditions, caching, saved server-side instead of in headers? See Routing configs.