Model Rover

Claude Code

Connect Claude Code through the Anthropic Messages-compatible gateway.

Claude Code uses Anthropic Messages. Choose a chat model that supports function calling. The protocol and model manufacturer are independent, so an Anthropic Messages client does not require an Anthropic model.

Install

Install Claude Code using the official documentation:

npm install -g @anthropic-ai/claude-code
claude --version

Configure

Edit the user-level ~/.claude/settings.json file. On Windows, use %USERPROFILE%\\.claude\\settings.json.

{
"env": {
  "ANTHROPIC_BASE_URL": "http://127.0.0.1:11113",
  "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
  "ANTHROPIC_API_KEY": "",
  "ANTHROPIC_MODEL": "<FULL_MODEL_ID>",
  "ANTHROPIC_DEFAULT_FABLE_MODEL": "<FULL_MODEL_ID>",
  "ANTHROPIC_DEFAULT_OPUS_MODEL": "<FULL_MODEL_ID>",
  "ANTHROPIC_DEFAULT_SONNET_MODEL": "<FULL_MODEL_ID>",
  "ANTHROPIC_DEFAULT_HAIKU_MODEL": "<FULL_MODEL_ID>",
  "CLAUDE_CODE_SUBAGENT_MODEL": "<FULL_MODEL_ID>"
}
}

ANTHROPIC_BASE_URL must not include /v1; Claude Code requests /v1/messages itself. ANTHROPIC_AUTH_TOKEN is sent as a Bearer token. Keep ANTHROPIC_API_KEY empty so a direct x-api-key credential does not conflict; clear any saved Claude login separately as described below. Using the same complete model ID for every role is the most stable starting point; you can replace roles separately later, but every value must remain a complete public model ID.

Protect the settings file

The settings file contains a plaintext local key. Never commit it. For team environments, prefer system secret management or Claude's apiKeyHelper.

Verify

Run claude, then enter /status in the session. You should see the current Base URL and ANTHROPIC_AUTH_TOKEN. Send a read-only test task.

Troubleshooting

  • 401: Check the platform key and token status.
  • Model not found: Check that you copied the complete public model ID from /models.
  • Claude login still appears: Run /logout, fully quit Claude Code, and reopen it.
  • count_tokens returns 404: The platform does not expose this optional endpoint. Claude Code can continue without it.

Help us improve this page

Found something unclear, outdated, or incorrect?

Last updated on