One command, two coding agents: Codex- or Claude-Code-style on GLM
Zero to a GLM coding agent stood up an open
harness in one command. BharatRouter Code is the next step:
the same one-command install, now with a choice of two
front-ends — a Codex-style open harness
(OpenCode) or a Claude-Code-style
agent (the real claude CLI) — both pointed at
GLM-4.7, governed and metered through your own
BharatRouter key.
One install, your pick of front-end
Same script, two harnesses. It asks one question at the top — Codex-style or Claude-Code-style? — and wires whichever you choose:
curl -fsSL https://bharatrouter.com/install/code.sh | bash Already know which you want? Skip the prompt:
BR_FRONTEND=claude curl -fsSL https://bharatrouter.com/install/code.sh | bash # real Claude Code CLI
BR_FRONTEND=opencode curl -fsSL https://bharatrouter.com/install/code.sh | bash # OpenCode (default) - Codex-style drives OpenCode, the open agentic harness, over the standard chat-completions surface.
- Claude-Code-style installs and launches the real
claudeCLI, unmodified, just pointed at BharatRouter via standardANTHROPIC_*env vars — so Opus/Sonnet map toglm-4.7and Haiku toglm-4.7-flash. It never writes to your~/.claude, so your own Claude config is left untouched.
bharatrouter-code launcher, then runs the first query for you. Six steps, no config files to hand-edit.Before you begin: one BharatRouter key, one BYOK
Two prerequisites, both on the dashboard — the installer prompts for the first and detects the second:
- A BharatRouter key (
br-…) — sign up, mint a key, keep it handy. The installer prompts for it (hidden), stores it600at~/.config/bharatrouter/env— outside your shell rc — and smoke-tests it against/v1/models. - A GLM provider key as BYOK — from Zhipu (z.ai), Baseten, or OpenRouter, set once under Provider keys on the dashboard. GLM-4.7 is BYOK-only, so without it the model won't route — the installer catches the no-route shape and points you straight to the dashboard rather than failing silently.
The rough edges it handles for you
The installer is idempotent and safe to re-run on macOS and Linux. It quietly absorbs the things that usually eat an afternoon:
- the broken
opencode-ainpm postinstall — installs the platform binary and shims it onto yourPATH(Codex-style); - a global-npm quirk that leaves
claudeoffPATH— links it from the npm root into a writable bindir, no sudo (Claude-Code-style); - a root-owned
~/.cache— redirectsXDG_CACHE_HOMEto~/.local/cache; - a non-writable
PATHdir on Linux — falls back to~/.local/bin; - first-time keys — hidden prompt, stored
600, then smoke-tested before anything runs.
Your first query, automatically — and it makes the case itself
Once the BharatRouter key checks out and GLM routes, the installer immediately asks GLM-4.7 “roughly how much can a team save on coding-agent token costs versus a frontier model — and is it fast enough?” through whichever front-end you picked. So the very first thing you see is the agent working, metered on your own gateway, before you type anything — answering, in effect, why you'd route a coding agent this way at all.
And asked plainly, in a real run through BharatRouter, GLM-4.7 agrees:
Cost-efficient and fast — the numbers
The pitch isn't a vibe — it's measured. On the same execution-checked coding benchmark, all metered through one BharatRouter key:
- ~12× cheaper at parity accuracy. GLM-4.7 on Baseten scored 99.9% at ₹0.033/task — against Claude Opus 4.8 (100%, ₹0.395) and GPT-5.5 (100%, ₹0.440). That's roughly a tenth of the price, in real measured tokens.
- And faster. 1.5s median latency vs the frontier's 2.5–2.9s. The “GLM is slow” reputation is a host artifact — on a host built for it, GLM wins speed too (host showdown).
- On a token-hungry loop, that compounds. A coding agent burns tokens by the thousand per turn; an order-of-magnitude unit price is the difference between a budget that holds and one that doesn't.
Then use it from anywhere
Either front-end leaves you the same launcher — bharatrouter-code (with an oc-glm back-compat alias). Open a new terminal so the launcher loads:
bharatrouter-code # interactive
bharatrouter-code -p "<task>" # one-shot (Claude-Code-style)
bharatrouter-code run --model bharatrouter/glm-4.7 "<task>" # one-shot (Codex-style)
Swap the brain on the same key — bharatrouter/glm-4.7-flash
(free tier, cheapest) or bharatrouter/glm-4.5-air (cheap) — and
BharatRouter handles host failover (Baseten → Zhipu → OpenRouter) underneath,
so a single host hiccup doesn't stall your loop.
Why route a coding agent through BharatRouter
- Governance — per-org/team/model ₹ budgets and caps on a loop that burns tokens fast.
- Metering — every turn logged with provider, model and token usage.
- Routing & failover — host failover across GLM providers without touching the harness.
- No lock-in — open, MIT-licensed GLM weights, one key, swap models or front-ends freely.
A word on the names
BharatRouter Code is a thin, branded wrapper — it configures and launches OpenCode and the unmodified Claude Code CLI, it doesn't reimplement them. It is not affiliated with, sponsored by, or endorsed by OpenAI or Anthropic; “Codex-style” and “Claude-Code-style” describe the category of tool, nothing more. GLM weights are MIT-licensed by zai-org / Zhipu AI. Full attributions & notices ship next to the install.
Step-by-step instructions and recipes: View on GitHub → · Set up BYOK: BYOK docs
Earlier in the series: zero to a GLM coding agent in one command · which GLM host is fastest or cheapest · can open GLM match a frontier model? (we benchmarked it)