Claude Code
Route Anthropic's official CLI through BeansAI with two environment variables.
Overview
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from its settings.json. Point them at BeansAI and every Claude model in our catalog works — no SDK changes, no proxy.
Installation
shell
npm install -g @anthropic-ai/claude-codeConfiguration
Write these two files. Replace sk-beans-... with your actual key.
~/.claude/settings.json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-beans-...",
"ANTHROPIC_BASE_URL": "https://api.beansai.dev",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [],
"deny": []
}
}macOS / Linux
bash
# 1. Install Claude Code
npm install -g @anthropic-ai/claude-code
# 2. Configure
mkdir -p ~/.claude
cat > ~/.claude/settings.json <<'EOF'
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-beans-...",
"ANTHROPIC_BASE_URL": "https://api.beansai.dev",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [],
"deny": []
}
}
EOF
# 3. Launch
claudeWindows (PowerShell)
powershell
# 1. Install
npm install -g @anthropic-ai/claude-code
# 2. Configure
$dir = "$env:USERPROFILE\.claude"
if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
@"
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-beans-...",
"ANTHROPIC_BASE_URL": "https://api.beansai.dev",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [],
"deny": []
}
}
"@ | Set-Content "$dir\settings.json" -Encoding UTF8
# 3. Launch
claudeBasic usage
Run claude in any project directory. Switch models inline with /model claude-sonnet-4-6. The CLI respects rate limits and cost tracking from BeansAI.
Tips
- Use
CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000to unlock Opus's full output window. - Set
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1to skip Anthropic telemetry entirely — traffic goes only to BeansAI. - Keep separate settings files per project with
--settings ./claude.json.