⚡ New — Kimi K3 is live: bring your own Moonshot key →
Documentation

Never return an error

← Cookbook

Fall through Krutrim → Sarvam → 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.

Define the chain

Create a Collection in the dashboard (or via the API), then call it by slug. The chain below prefers India-resident routes and only reaches for a global model as a last resort:

OrderModelProviderWhy
1gemma-4-e4b-itkrutrimCheapest India route, tried first
2qwen3-32bgroqOpen-weight fallback (BYOK)
3gpt-5-miniopenaiGlobal safety net
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 request

How failover works

  • A step that errors or times out is skipped; the next step is tried in the same request — your client sees one response, not an error.
  • Repeated failures open that route's circuit breaker, so it is skipped fast until it recovers, instead of adding latency to every call.
  • Collections are versioned and shareable — fork one, tweak the order, publish it back.

Harden 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.