Integrations
Claude Code
Claude Code uses `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` to connect to ApiHub. Use the root domain — no `/v1` suffix.
Last updated: 2026-08-03
Node.js is required. If not installed, set it up first. Node.js Setup
1
Install Claude Code
Install globally and verify the command works.
Terminal
npm install -g @anthropic-ai/claude-code
claude --version2
Recommended: persistent setup
Store the variables in your user environment or shell profile so new terminals load them automatically.
Windows PowerShell (user env vars)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL","https://www.apihub.ink",[System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN","your-apihub-key",[System.EnvironmentVariableTarget]::User)macOS zsh (~/.zshrc)
echo 'export ANTHROPIC_BASE_URL="https://www.apihub.ink"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-apihub-key"' >> ~/.zshrc
source ~/.zshrcLinux bash (~/.bashrc)
echo 'export ANTHROPIC_BASE_URL="https://www.apihub.ink"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="your-apihub-key"' >> ~/.bashrc
source ~/.bashrc3
Optional: project-level settings.json
Place this in your project's .claude/settings.json. It only affects that project and does not touch system env vars. Do not commit the file when it contains a Key.
.claude/settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://www.apihub.ink",
"ANTHROPIC_AUTH_TOKEN": "your-apihub-key"
}
}4
Temporary setup (current terminal only)
Use this only to test connectivity. Variables are lost when the terminal closes.
Windows PowerShell
$env:ANTHROPIC_BASE_URL="https://www.apihub.ink"
$env:ANTHROPIC_AUTH_TOKEN="your-apihub-key"
claudemacOS / Linux
export ANTHROPIC_BASE_URL="https://www.apihub.ink"
export ANTHROPIC_AUTH_TOKEN="your-apihub-key"
claude5
Verify
Navigate to any code project and run claude. Successful replies confirm the setup is complete.
Terminal
cd your-project
claudeVerification
- Claude Code sends requests and returns model replies without 401/403 errors.
Common Errors
- Using /v1 in the base URL breaks the Anthropic protocol path.
- On Windows, not reopening the terminal after setting env vars — changes have not taken effect.