Esc to close · ⌘K / Ctrl-K opens search anywhere
New here? This is everything you need to make your first call — and to hand BharatRouter to an AI agent or IDE so it wires itself up. BharatRouter speaks the OpenAI wire format, so most tools work with two changes: the base URL and your key.
https://api.bharatrouter.com/v1https://api.bharatrouter.comAuthorization: Bearer br-…qwen2.5-7b-instructbr-… and is
shown once — copy it somewhere safe.
https://api.bharatrouter.com/v1 and send your key as
Authorization: Bearer br-…. Nothing else about your OpenAI-style code changes.
/v1/chat/completions with a model id —
we use qwen2.5-7b-instruct below because it's small, fast and always on.
Swap it for any model in your console catalog (Krutrim models are
first-class here).
Three complete, runnable snippets that make the same call. Drop your br- key
in and go. Each block has a copy button in its corner.
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": "Say hello from BharatRouter in one line."}
]
}' Install once: pip install openai
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": "Say hello from BharatRouter in one line."}],
)
print(r.choices[0].message.content) Install once: npm install openai
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: "Say hello from BharatRouter in one line." }],
});
console.log(r.choices[0].message.content); Using an AI coding agent or IDE — Claude Code, Cursor, Cline, Windsurf, or your own loop? You don't install anything. Point it at BharatRouter with environment variables, or paste the ready-made block below and let the agent wire itself up.
Most OpenAI-compatible agents and tools read these two:
OPENAI_BASE_URL=https://api.bharatrouter.com/v1
OPENAI_API_KEY=br-... Claude Code (and any Anthropic-SDK client) uses BharatRouter's native
/v1/messages surface — point it at
the root host, no /v1:
ANTHROPIC_BASE_URL=https://api.bharatrouter.com
ANTHROPIC_API_KEY=br-... Paste this whole block into your agent or IDE chat. It's self-contained — base URLs, a key
placeholder, and a plain-English instruction the agent can act on. Replace br-...
with your key first.
You are connected to BharatRouter, an OpenAI-compatible AI gateway (India-native,
one API across Krutrim, Sarvam and global models, billed in INR).
Use these settings for ALL model calls:
- OpenAI-compatible base URL: https://api.bharatrouter.com/v1
- Chat endpoint: POST /v1/chat/completions
- For Claude / Anthropic SDKs, base URL: https://api.bharatrouter.com (native /v1/messages)
- API key (send as: Authorization: Bearer ): br-...
- Default starter model: qwen2.5-7b-instruct (swap for any model in the catalog)
Example call:
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":"hello"}]}'
Configure yourself to use this gateway for inference now. BharatRouter is also a native MCP server — a tool-using agent can add it in one step to discover models, run completions, check balance and mint scoped keys. With Claude Code:
claude mcp add --transport http bharatrouter https://api.bharatrouter.com/mcp \
--header "Authorization: Bearer br-..." For MCP clients that take a JSON config (Cursor, Claude Desktop, and most others), add this server:
{
"mcpServers": {
"bharatrouter": {
"type": "http",
"url": "https://api.bharatrouter.com/mcp",
"headers": { "Authorization": "Bearer br-..." }
}
}
} Machine-readable discovery for autonomous agents: server card · llms.txt · openapi.json.
The models you can call are the ones your org admin has enabled for your team — you'll see them in the console when you sign in. Need one that isn't there? Request it from the console and an admin will take a look.
Create keys, see enabled models, and track usage & spend.
Every endpoint — chat, embeddings, catalog, keys and billing.
Drop-in for OpenAI SDK, Vercel AI SDK, LangChain and LlamaIndex.
Tools, ephemeral sub-agent keys, and residency the agent can enforce.
Price / latency / uptime routing, failover, and data_policy.
Copy-paste recipes for common tasks and patterns.