Terminal coding agent (through 9router)
How to Use Ruvicode with Claude Code
Claude Code speaks the Anthropic Messages protocol, and Ruvicode serves the OpenAI chat completions protocol. 9router, a free local router, sits in between and translates. This guide connects Claude Code to Ruvicode through it, so you can run Claude Sonnet, GLM, Kimi or any other catalog model inside Claude Code.
Tested on November 3, 2026. Claude Code 2.1.312 with 9router 0.5.112 on Windows read a file, fixed a bug in it and replied, once on GLM 5.3 Flash and once on Claude Sonnet 5.5, with every request billed by api.ruvicode.com.
Set up Claude Code
Base URL
http://127.0.0.1:20128 (9router)
API key
your 9router key
- 1Set up 9router with Ruvicode as a provider first: follow the 9router guide, then create a 9router API key under Endpoint & Key.
- 2In the shell where you start Claude Code, point ANTHROPIC_BASE_URL at 9router (no /v1 at the end) and put the 9router key in ANTHROPIC_AUTH_TOKEN.
- 3Choose models with ANTHROPIC_MODEL and the ANTHROPIC_DEFAULT_*_MODEL variables, using 9router's names: ruvicode/ followed by the Ruvicode model id.
- 4Run claude as usual. /model switches between the models you set.
export ANTHROPIC_BASE_URL=http://127.0.0.1:20128
export ANTHROPIC_AUTH_TOKEN=your-9router-key
export ANTHROPIC_MODEL=ruvicode/claude-sonnet-5.5
export ANTHROPIC_DEFAULT_SONNET_MODEL=ruvicode/claude-sonnet-5.5
export ANTHROPIC_DEFAULT_OPUS_MODEL=ruvicode/claude-opus-5.5
export ANTHROPIC_DEFAULT_HAIKU_MODEL='ruvicode/glm-5.3-flash[1m]'
claude{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:20128",
"ANTHROPIC_AUTH_TOKEN": "your-9router-key",
"ANTHROPIC_MODEL": "ruvicode/claude-sonnet-5.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "ruvicode/glm-5.3-flash[1m]"
}
}Good to know
- Claude Code recognizes Claude model ids inside the 9router name, such as ruvicode/claude-sonnet-5.5, and uses their real context window. For other models it assumes 200K tokens; add [1m] to the id of a model with a 1M window, such as ruvicode/glm-5.3-flash[1m], and Claude Code strips the suffix before sending the request.
- ANTHROPIC_DEFAULT_HAIKU_MODEL runs Claude Code's background tasks such as titles and summaries. A fast, cheap model there keeps those calls small on your bill.
- With a model Claude Code does not know, it prints a [claude-code:unrecognized_model] line. It is informational; the request still goes through.
- The env block in ~/.claude/settings.json moves every Claude Code session to Ruvicode. If you also use a Claude subscription, set the variables in a separate shell (or a shell alias) instead. In our test, the same block in a project's .claude/settings.local.json did not take over sign-in.
- 9router binds to every network interface by default and its dashboard starts with the password 123456. Start it with --host 127.0.0.1 so only your machine can reach it, and change the dashboard password in Settings.
Models for coding agents
These models completed streamed tool calls through Ruvicode on November 3, 2026. Every model in the catalog works with the same base URL and key; each model page shows its live rate, context window and max output.
- GLM 5.3 Flash
glm-5.3-flash - Claude Sonnet 5.5
claude-sonnet-5.5 - Kimi K2.7 Code
kimi-k2.7-code
Common errors
- 401 Invalid API key
- The key is mistyped, revoked or not a Ruvicode key. Copy it again from the dashboard; it starts with rvcd_.
- 404 Model not found
- The model id is not in the catalog. Use an id exactly as listed on the models page or by GET /v1/models. A plain 404 page instead of a JSON error means the base URL is missing /v1.
- 402 insufficient_balance
- The wallet cannot cover the request. Top up in the dashboard; the balance never expires.
- 429 rate limit
- Too many requests per minute, on the key or across the account. Agents that fire many calls in parallel can hit it; most tools retry on their own after a short wait.
Claude Code with Ruvicode: FAQ
- Can Claude Code connect to Ruvicode without 9router?
- No. Claude Code only speaks the Anthropic Messages API (/v1/messages), which Ruvicode does not serve. 9router translates those requests to the OpenAI chat completions format that Ruvicode serves.
- Can I use GLM, Kimi or DeepSeek in Claude Code?
- Yes. Any Ruvicode chat model works: set ANTHROPIC_MODEL to ruvicode/ followed by its id, for example ruvicode/glm-5.3-flash[1m] or ruvicode/kimi-k2.7-code. We tested GLM 5.3 Flash and Claude Sonnet 5.5.
- Who bills the requests?
- Ruvicode, per request from your prepaid wallet at the rate on each model page. 9router itself is free and runs on your machine; it does not need a Claude subscription for this setup.
- Where do I get a Ruvicode API key?
- Create an account, top up your wallet with QRIS or USDC, then open API Keys in the dashboard and create a key. Keys start with rvcd_. You can set a daily or monthly spend limit per key and restrict a key to a list of models.
Guides for other tools
The same base URL and key work everywhere. Setup for each tool: