Best practices
Short, opinionated guidance for getting the most out of the gateway. Each section links to the deeper docs.
Pick the right optimize mode
- Leave it on
price (the default) for most traffic — the cheapest healthy route that can serve the request. - Use
latency for interactive, user-facing paths where responsiveness matters more than the per-token cost. - Use
uptime for critical jobs that must not fail — it favours the route with the lowest observed failure rate. - Use
auto when you don’t want to think about it: reliability comes first, then latency and price trade off sensibly.
Set a per-key default and override per request only where a specific call needs it. Full scoring is in Routing & residency.
Build a fallback chain before you need it
- Make chains cross-provider, not just cross-model — the point is to survive one provider going down. Put an India-resident step first if residency matters.
- Add a BYOE endpoint of your own as a ₹0 last resort so you always have somewhere to land.
- Save the chain as a Collection, version it, andfork before you use someone else’s so an upstream change can’t alter your routing silently.
- Watch it with reliability monitoring rather than assuming it works.
Enforce residency where it actually matters
- Send
data_policy: "india_only" on regulated or sensitive workloads — it fails closed rather than leaving India, so it’s a guarantee, not a preference. - Don’t set it blanket-wide if you don’t need it: it shrinks the route pool and can remove cheaper or faster global options.
Keep keys clean
- Use a separate key per environment or workspace (dev / staging / prod) so you can revoke one without disrupting the rest.
- Set a monthly ₹ budget, rate limit and expiry on every key — a leaked key then has a hard ceiling and a shelf life.
- For agents, mint ephemeral scoped keys rather than handing over a long-lived one — see MCP for agents.
- The full key is shown once; store it in a secret manager, never in source control.
Control cost
- Prefer the smallest model that clears your quality bar; reserve frontier models for the calls that need them.
- Use BYOK to ride your own provider rates where you already have an account — free during beta.
- Set per-key and (where available) per-workspace budgets so spend can’t run away, and reviewusage & activity regularly.
Before you call it production
- BharatRouter is a developer beta today — provided as-is with no SLA yet. Treat it accordingly for critical workloads and keep an eye onstatus.
- Handle errors idempotently and respect the error codes; a fallback chain plus monitoring is your safety net, not a reason to skip retries.
Questions? See the FAQ or email[email protected].