Skip to content
docs

Claude Code

Claude Code speaks the Anthropic Messages API. Waibee Router accepts requests in the same format on POST /v1/messages, so Claude Code connects to it through environment variables, with no changes to the client itself.

VariableValue
ANTHROPIC_BASE_URLThe router’s base URL, without the /v1/messages suffix (the client adds the path itself).
ANTHROPIC_AUTH_TOKENYour Waibee API key (sk_live_...). Sent as Authorization: Bearer.
ANTHROPIC_API_KEYAn empty string, so the client does not send a different key from the environment in x-api-key. If both headers arrive, the router takes the key from x-api-key.
Terminal window
export WAIBEE_API_KEY="sk_live_..."
export ANTHROPIC_BASE_URL="https://api.waibee.com"
export ANTHROPIC_AUTH_TOKEN="$WAIBEE_API_KEY"
export ANTHROPIC_API_KEY=""
claude

A key from the variable takes precedence over a saved claude.ai sign-in. If Claude Code warns about two authentication sources at startup, run /logout, and only the Waibee key remains.

  • For one run: claude --model <name>. Both catalog IDs and Anthropic names without a prefix work; see Anthropic-compatible clients.
  • By role: ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL set the models behind the opus, sonnet, and haiku aliases, and CLAUDE_CODE_SUBAGENT_MODEL sets the subagent model. They accept both short Anthropic names and catalog IDs.
  • Background tasks: with the key in ANTHROPIC_AUTH_TOKEN, Claude Code runs them on the main model. To run them on a cheaper one, set it in ANTHROPIC_DEFAULT_HAIKU_MODEL.

For Claude models, pass the short Anthropic names: claude-sonnet-4-6, claude-haiku-4-5. Claude Code interprets catalog IDs its own way: it does not recognize anthropic/claude-haiku-4.5, warns about it, and keeps the session within 200,000 tokens. It also mistakes anthropic/claude-sonnet-4.6 for the deprecated Claude Sonnet 4. For a model Claude Code does not know, the CLAUDE_CODE_MAX_CONTEXT_TOKENS variable sets the context window.

The extension checks the key before it starts Claude Code, and it takes the variables from its own claudeCode.environmentVariables setting in the editor’s user settings. Values from ~/.claude/settings.json do not reach this check.

settings.json
{
"claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "https://api.waibee.com" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk_live_..." }
]
}

In a Claude Code session, run /status. The Anthropic base URL line should show https://api.waibee.com, and the Auth token line should name ANTHROPIC_AUTH_TOKEN.

The router has no /v1/messages/count_tokens endpoint. Without it, Claude Code estimates tokens from the character count, so /context shows approximate numbers.