Claude Code
Use Router9 as the backend for Claude Code
Claude Code is Anthropic's official agentic coding CLI. Point it at Router9's Anthropic-compatible endpoint to run it on your flat monthly token plan instead of metered API billing — no code changes required.
Setup
Claude Code reads its endpoint and key from environment variables. Point it at Router9's Anthropic Messages endpoint:
export ANTHROPIC_BASE_URL=https://api.router9.com/anthropic
export ANTHROPIC_API_KEY=sk-r9k-your-key-hereThen start Claude Code as usual:
claudeRouter9's Anthropic endpoint authenticates with the x-api-key header, which the Anthropic SDK behind Claude Code sends from ANTHROPIC_API_KEY.
Choosing a Model
Override the default model with ANTHROPIC_MODEL, or switch mid-session with the /model command:
export ANTHROPIC_MODEL=claude-sonnet-4-20250514Use any Claude model id Router9 routes on.
Add Skills via MCP
Expose Router9 Skills as tools by adding Router9's hosted MCP server over HTTP:
claude mcp add --transport http router9 https://api.router9.com/v1/mcp \
--header "Authorization: Bearer sk-r9k-your-key"Or add it to .claude/settings.json directly:
{
"mcpServers": {
"router9": {
"type": "http",
"url": "https://api.router9.com/v1/mcp",
"headers": {
"Authorization": "Bearer sk-r9k-your-key"
}
}
}
}See Install MCP Server for details.
Tips
- Router9's flat monthly pricing pairs well with long Claude Code sessions — no per-token cost surprises.
- Persist the env vars in your shell profile (
~/.zshrc,~/.bashrc) so everyclaudesession uses Router9. - Keep your
sk-r9k-key in the environment rather than committing it to.claude/settings.json.