Docs / Tools / Claude Code

Claude Code

Use CJROUTER as the model backend for Claude Code by switching the Anthropic base URL. Works with every Claude model CJROUTER supports, with no code or version changes required.

Prerequisites

  • Claude Code installed
  • A CJROUTER API Key created in the CJROUTER Console

Setup

Set the environment variables for the current terminal session:

export ANTHROPIC_BASE_URL=https://api.cjrouter.com/v1
export ANTHROPIC_API_KEY=<your-api-key>

To persist across sessions, append them to your shell config:

echo 'export ANTHROPIC_BASE_URL=https://api.cjrouter.com/v1' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY=<your-api-key>' >> ~/.zshrc
source ~/.zshrc

Choosing a Model

Claude Code ships with its own Claude model selector. Once configured, pick a model the way you normally would. Claude Code sends the chosen model name to CJROUTER, which routes the request to the corresponding upstream provider.

Verification

Start Claude Code:

claude

Send a message in the session. If you receive a normal response, CJROUTER is wired up correctly.

Next Steps