Esc to close · ⌘K / Ctrl-K opens search anywhere
Point Claude Code’s base URL at BharatRouter and drive it with an open GLM model. The gateway translates the Anthropic Messages wire to GLM and back — so your client holds only a br- key, and GLM is set once as BYOK on the platform.
Anthropic /v1/messages → GLM translation एजेंट मध्यम 8 min
BharatRouter serves the Anthropic Messages API (POST /v1/messages) and now translates non-Anthropic models on it. So you can point Claude Code — Anthropic’s coding client — at the gateway and run an open GLM model as the brain. Claude Code speaks the Anthropic wire; the gateway translates each request to the OpenAI wire, routes it to a GLM host (Zhipu, Baseten or OpenRouter), then translates the reply — streaming and GLM reasoning included — back into Anthropic thinking + text blocks. Your routing, residency and per-key ₹ budgets apply to every call.
You’ll use: the Anthropic-Messages → GLM translation on /v1/messages, with the GLM provider key saved as BYOK on the platform. Default coding model: glm-4.7 (free tier: glm-4.7-flash).
br-… key — sign up and mint one. This is the only credential your client carries.Add this to ~/.claude/settings.json (or a project .claude/settings.json). Set ANTHROPIC_BASE_URL to BharatRouter and put your br-… key in two places — both the same key: ANTHROPIC_API_KEY (so Claude Code runs without an Anthropic login), and on the x-br-api-key side header (the credential the gateway actually reads — Claude Code reserves Authorization for its own session). The model env vars select GLM:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.bharatrouter.com",
"ANTHROPIC_API_KEY": "br-...",
"ANTHROPIC_CUSTOM_HEADERS": "x-br-api-key: br-...",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7-flash"
}
}Both key slots take the same single br-… key — the GLM provider key never leaves the platform. (ANTHROPIC_API_KEY just satisfies Claude Code’s logged-in check; the gateway authenticates off x-br-api-key.) Want a free tier? Point all three model slots at glm-4.7-flash. The gateway handles the wire translation; Claude Code just talks Anthropic as usual.
A real coding loop — file edits, tool calls, multi-turn — driven by GLM, with valid Anthropic responses (thinking + text blocks, stop_reason: end_turn) on both non-streaming and streaming calls. On our 14-task coding benchmark, open GLM held ~99% of frontier quality at roughly a third of the cost — the trade-off is latency, since GLM’s reasoning makes it noticeably slower than a frontier model. A great fit for cost-sensitive, quality-sensitive coding where you can spare the seconds; see the benchmark for the full picture.
If no GLM provider key is saved on the platform, the gateway returns a clear error instead of failing silently — it tells you to save a GLM key as BYOK at https://bharatrouter.com/dashboard#provider-keys, with setup instructions at the cookbook on GitHub. Save the key once and re-run — no client change needed.
Prefer real Claude on this surface (subscription-first, with metered overflow)? See Govern Claude Code. Want an open coding agent that speaks the OpenAI wire instead? See Run an open coding agent on GLM.
और रेसिपी कुकबुक में, या पूरा API reference देखें।