Routing overview

How the gateway picks one EU provider per request — and what you can override.

For models hosted by more than one EU provider, the gateway picks exactly one per request. You can stay hands-off (the gateway's defaults are sane), give a strategy hint, or take total control with provider pinning.

The five-step decision

flowchart TD
  Req[Request arrives] --> Pin{X-CleverRouter-Provider set?}
  Pin -- yes --> CheckHost{Does that provider<br/>host this model?}
  CheckHost -- no --> Err400[400 provider_unsupported]
  CheckHost -- yes --> UsePin[Use pinned provider]
  Pin -- no --> Sort[Sort by model_providers.priority ASC]
  Sort --> Health{Provider healthy<br/>in last probe?}
  Health -- no --> NextProvider[Skip, try next]
  Health -- yes --> Disabled{enabled = true AND<br/>deprecated_at IS NULL?}
  Disabled -- no --> NextProvider
  Disabled -- yes --> Use[Use provider]
  NextProvider --> Health

Word version:

  1. Explicit pin (X-CleverRouter-Provider) wins if the model is hosted there. If not: 400 provider_unsupported — no silent fallback.
  2. Priority sort on model_providers.priority ASC — lowest wins.
  3. Health filter — providers that were down in the last health probe are skipped (unless all are down).
  4. Disabled / deprecatedenabled=false mappings are ignored. deprecated_at IS NOT NULL returns 410 Gone.
  5. Strategy hint (X-CleverRouter-Strategy) refines step 2 when multiple providers tie on priority.

What we deliberately don't do

FeatureWhy not yet
Cost-based dynamic routingHard to reason about — predictable beats clever
Latency-based dynamic routingSame — operators want repeatable bills
Sticky sessionsStatelessness is easier to scale
Cross-border failoverInvariant — would break EU-only positioning

Inspecting the chosen provider

Every successful response carries:

X-CleverRouter-Provider: scaleway
X-Request-Id: 0193adc8-…

Combine the two and you can correlate any call with the dashboard's request log.

Streaming and failover

Once the stream starts, no failover

The gateway can't replay a streaming response on a different provider once the first chunk has shipped. Failover for streams works only before the first byte leaves. For non-stream requests, a 5xx triggers the next eligible provider automatically.

Three sections that follow this