Yaha AI Gateway
Routing

Provider preferences

Per-request provider routing options

Provider preferences

Pass a provider object in the request body to influence routing (OpenRouter-compatible field names):

{
  "model": "openai/gpt-4o",
  "provider": {
    "order": ["anthropic", "openai"],
    "only": ["openai", "anthropic"],
    "ignore": ["ollama"],
    "sort": "price",
    "allow_fallbacks": true
  },
  "messages": [{ "role": "user", "content": "Hi" }]
}
FieldDescription
orderPrefer providers in this order when sorting candidates
onlyAllow only listed providers
ignoreExclude listed providers
sortprice (lowest catalog rate first), throughput / latency (reserved; falls back to order)
allow_fallbacksWhen false, disables automatic model failover

Provider preferences are combined with your project allowlist and key hierarchy (project → org → platform keys).

The optional provider_preferences feature key exists for future metering; default price is 0.

On this page