Esc to close · ⌘K / Ctrl-K opens search anywhere
Fall through an India-resident route → an open-weight fallback → a global model automatically, with circuit-breaker failover.
Collections + circuit breakersReliabilityIntermediate10 min
A single provider will have a bad five minutes. A Collection is an ordered, versioned chain of {model, provider} steps; the gateway walks it top-to-bottom and serves the first healthy step, tripping a circuit breaker on the ones that fail.
You'll use: saved fallback chains (Collections) + automatic circuit-breaker failover. Reference: Collections.
Create a Collection in the console (or via the API), then call it by slug. The chain below tries an India-resident route first and only reaches for global routes if it fails. Every step runs on your BharatRouter credit — no provider keys needed:
| Order | Model | Provider | Why |
|---|---|---|---|
| 1 | gemma-4-e4b-it | krutrim | Cheapest India route, tried first |
| 2 | llama-3.3-70b | groq | Open-weight fallback (global, runs on credit) |
| 3 | gpt-oss-120b | fireworks | Global safety net (runs on credit) |
from openai import OpenAI
client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")
r = client.chat.completions.create(
model="@my-org/resilient-chat", # your Collection slug
messages=[{"role": "user", "content": "namaste"}],
)
# x-br-provider tells you which step actually served the requestHarden it further: add your own endpoint as a ₹0 last step with BYOE, and canary the chain so you're alerted before users notice.
More recipes in the Cookbook, or see the fullAPI reference.