Skip to main content

Provider Routing

By default, the Router distributes requests across healthy providers using round-robin with automatic failover. The provider field lets you override this when you need specific behavior.

Default Behavior

If you send no provider field, the Router:

  1. Picks a healthy provider for the requested model
  2. Retries on the next healthy provider if the first returns an error
  3. Returns the response — or a 503 if every provider failed

This is the recommended path for most applications.

Routing Strategies

{
"model": "zai-org/GLM-5-FP8",
"messages": [{"role": "user", "content": "Hello"}],
"provider": {
"sort": "latency"
}
}

Routes to the provider with the lowest recently-observed latency for this model.

provider Field Reference

FieldTypeDescription
sortstring"latency" or "price". Ignored if address is set.
addressstringProvider's on-chain address for direct routing.
allow_fallbacksbooleanAllow retrying other providers on failure. Default: true normally, false when address is set.

Discovering Provider Addresses

List the providers serving a model with GET /v1/providers?model_id=… — see Models.

  • Principles — why failover is the default
  • Errors — what 502 and 503 mean for routing