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

BharatRouter documentation

BharatRouter is India's AI gateway: Krutrim, Sarvam, and the world's best open and frontier models behind one API, with INR pricing, enforceable India data-residency, and price/latency/uptime routing with automatic failover. The API speaks the OpenAI wire format, so any standard SDK works — swap the base URL and key, change nothing else.

Base URLhttps://api.bharatrouter.com/v1
AuthAuthorization: Bearer br-…sign up (GitHub or Google) and mint a key on the dashboard. New orgs get ₹100 free credit.
Wire formatOpenAI-compatible chat completions and embeddings, streaming included.
PricingPrepaid INR credits, per-token rates on the model catalog. No card on file, no surprise bills.

Quickstart

Three steps: sign in, create a key on the dashboard, make a request.

curl

curl https://api.bharatrouter.com/v1/chat/completions \
  -H "Authorization: Bearer br-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen2.5-7b-instruct",
    "messages": [{"role": "user", "content": "namaste"}],
    "stream": true,
    "data_policy": "india_only",
    "optimize": "latency"
  }'

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")

r = client.chat.completions.create(
    model="qwen2.5-7b-instruct",
    messages=[{"role": "user", "content": "namaste"}],
    extra_body={"data_policy": "india_only", "optimize": "price"},
)
print(r.choices[0].message.content)

Node (OpenAI SDK)

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.bharatrouter.com/v1", apiKey: "br-..." });

const r = await client.chat.completions.create({
  model: "qwen2.5-7b-instruct",
  messages: [{ role: "user", content: "namaste" }],
  data_policy: "india_only",   // BharatRouter extensions pass straight through the SDK
});
console.log(r.choices[0].message.content);

Streaming

Set "stream": true and read server-sent events, exactly as with any OpenAI-compatible API. BharatRouter includes a final usage chunk in every stream so you always see what the request cost.

stream = client.chat.completions.create(
    model="qwen2.5-7b-instruct",
    messages=[{"role": "user", "content": "Explain UPI in two lines"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Embeddings

curl https://api.bharatrouter.com/v1/embeddings \
  -H "Authorization: Bearer br-..." \
  -H "Content-Type: application/json" \
  -d '{ "model": "bge-m3", "input": "namaste duniya" }'

India-resident embedding models served on the platform key: bge-m3 (1024-dim, multilingual) — or bring your own via BYOK.

Where to go next

API referenceEvery endpoint — inference, catalog, dashboard, webhooks — with request and response shapes.
Client SDKs & frameworksDrop-in for the OpenAI SDK (Python/Node), Vercel AI SDK, LangChain and LlamaIndex — and where the routing extensions go in each.
AgentsTool-calling loops and MCP, with residency and budgets applied to every agent step.
CookbookCopy-paste recipes — cutting inference costs, failover, india_only, DPDP/PII, BYOK, agents, streaming costs and Sangam consensus.
Migrate to BharatRouterOne-line swap guides per platform: OpenAI, OpenRouter, Together, Fireworks, Groq, Anthropic, Portkey, LiteLLM.
Routing & residencyThe optimize, provider and data_policy extensions, saved fallback chains, failover, and circuit breakers.
Sangam (consensus)Sovereign consensus routing — a panel of models deliberate and a synthesizer returns one answer; the two variants and custom panels via sangam:{panel,synth}.
CollectionsShareable, versioned routing chains — publish, fork and import them into your org.
Reliability monitoringCanary a collection's steps on a schedule; per-step uptime/latency and email/webhook alerts.
Bring your own endpointRegister your own OpenAI-compatible deployment as a ₹0 fallback step.
API keys & limitsTrial vs standard keys, rate limits, per-key monthly ₹ budgets.
BYOKBring your own provider keys — unlock Krutrim Cloud, Sarvam, Mistral and 25+ more.
Credits & billingPrepaid INR credits, top-ups, promo codes, receipts.
Usage & activityToken usage, per-request activity, and public model rankings.
Teams & workspacesInvite teammates with roles, switch orgs, group keys into workspaces.
ErrorsThe error envelope, every error code, and how to handle each one.
MCP for agentsConnect Claude Code or any MCP client straight to the gateway.

Tooling & machine-readable surfaces

⬇ Postman collection Import, set the apiKey variable, test every endpoint.

openapi.jsonOpenAPI 3.1 schema of the full API.
api llms.txtLLM-readable API summary, served by the gateway.
site llms.txtLLM-readable index of this documentation.
MCP server cardMachine-readable MCP discovery for agent clients.
status.bharatrouter.comLive provider health and incident history.