Run AI coding tools through one LLM gateway
Every AI coding tool wants its own API key, billing account, and base URL — and each one can quietly burn a budget. Routing them through one gateway changes that: Claude Code, OpenAI Codex CLI, and any OpenAI-compatible agent share one wallet, get their own scoped keys, and leave a cost trace for every request. One integration covers 25+ models, reachable globally and from Mainland China.
What the gateway gives your coding stack
Claude Code, natively
Point ANTHROPIC_BASE_URL at https://api.router.one and Claude Code runs through the gateway — same workflow, plus traces, budgets, and failover behind it.
Codex CLI, natively
OpenAI Codex CLI reads OPENAI_BASE_URL. Set it to https://api.router.one/v1 and every Codex request is metered, traced, and budget-capped like the rest of your stack.
Any OpenAI-compatible agent
Cline, Aider, and other tools that accept a custom OpenAI-compatible base URL work the same way — change the URL and key, keep the workflow.
A key per tool, a budget per key
Give each tool its own API key with its own maxSpend cap, rate limit, and per-minute token ceiling. An agent stuck in a retry loop hits its cap — it cannot drain the shared wallet.
A cost trace per request
Every tool call lands in the dashboard with model, tokens, cost, latency, and route. You can finally answer which tool — and which kind of task — your spend goes to.
Failover during incidents
When an upstream has a bad hour, requests fail over to a healthy same-family route and the coding session keeps moving. The trace records what happened.
One wallet for every coding agent
Coding agents are the easiest workloads to lose track of: they run long sessions, retry on failure, and multiply across a team. Putting them behind one gateway gives you a single prepaid wallet with per-key attribution — every tool spends from the same balance, every request is priced at the posted model rate, and per-key caps decide how much any one agent may use. Top up by card, WeChat Pay, Alipay, Stripe, or USDT/USDC.
Two environment variables, both tools
Claude Code uses the Anthropic-compatible endpoint; Codex CLI and OpenAI-compatible tools use the OpenAI-compatible one. Set both and your whole coding stack routes through the gateway.
# Route Claude Code and Codex through one gateway export ANTHROPIC_BASE_URL=https://api.router.one export OPENAI_BASE_URL=https://api.router.one/v1 export OPENAI_API_KEY=sk-your-router-one-key
FAQ
Which AI coding tools work with Router One?
Claude Code (via the Anthropic-compatible endpoint), OpenAI Codex CLI, and any tool that accepts an OpenAI-compatible base URL — including Cline and Aider. If the tool lets you set a base URL and API key, it can route through the gateway.
How do I set up Claude Code?
Set ANTHROPIC_BASE_URL to the Anthropic-compatible endpoint and use your Router One key. The Claude Code in China page documents the full walkthrough, including verification and troubleshooting.
How do I set up Codex CLI?
Set OPENAI_BASE_URL to the OpenAI-compatible endpoint and OPENAI_API_KEY to your Router One key. The Codex CLI in China page has the complete setup guide.
Can I give each tool its own budget?
Yes. Create one API key per tool and set a maxSpend cap, rate limit, and per-minute token ceiling on each. A tool that hits its cap stops spending; the others keep working.
What happens if a provider has an outage mid-session?
Requests fail over to a healthy route in the same model family, typically adding under 200ms, and the per-request trace records the fallback decision. Coding sessions degrade gracefully instead of dying.
Where do I see what each tool is spending?
Dashboard -> Usage breaks down requests, tokens, and spend per API key — so a key per tool means a spend line per tool. Dashboard -> Logs shows the individual request traces.
Related
Give every coding agent one gateway and one budget.
Get started free