Claude Code
Connect Claude Code to APIClaw through Anthropic-compatible environment variables.
Claude Code is Anthropic's terminal coding assistant. APIClaw supports Anthropic-compatible requests, so you can point Claude Code at APIClaw instead of Anthropic's hosted API.
Prerequisites
- Install Claude Code on your machine.
- Create an API key in the API Keys dashboard.
- Copy a model ID from the model hub if your workflow requires an explicit model override.
Install Claude Code
curl -fsSL https://claude.ai/install.sh | bashOn Windows PowerShell:
irm https://claude.ai/install.ps1 | iexSkip official onboarding (optional)
If Claude Code keeps asking you to sign in to Anthropic, merge this into ~/.claude.json:
{
"hasCompletedOnboarding": true
}Configure APIClaw
Add these variables to your shell profile (~/.bashrc, ~/.zshrc, or Windows environment variables):
export APICLAW_API_KEY="sk-your-apiclaw-key"
export ANTHROPIC_BASE_URL="https://apiclaw.biz/v1"
export ANTHROPIC_AUTH_TOKEN="$APICLAW_API_KEY"
export ANTHROPIC_API_KEY=""Leave ANTHROPIC_API_KEY empty so Claude Code does not fall back to Anthropic's official service.
Reload your shell:
source ~/.zshrcVerify
cd /path/to/your/project
claudeInside Claude Code, run:
/statusYou should see Anthropic base URL: https://apiclaw.biz/v1 and your auth token source. Send a simple prompt to confirm responses arrive and appear in logs.
IDE plugins
The VS Code and JetBrains Claude Code extensions reuse the same environment variables. Launch your IDE from a terminal where the variables above are loaded, or set them in the extension's environment settings.
Troubleshooting
Still connecting to api.anthropic.com
Restart the terminal or IDE after exporting variables. Confirm ANTHROPIC_BASE_URL points to https://apiclaw.biz/v1.
401 authentication errors
Regenerate the API key, remove extra spaces, and confirm the key is active in the dashboard.