Claude Code
Use gateway to route to any provider to unlock Claude Code ability.
Claude Code Integration
Claude Code brings AI-powered coding directly to your terminal. Connect it to the gateway to use any provider through a single endpoint.
Installation
curl -fsSL https://claude.ai/install.sh | bashFor platform-specific instructions, visit code.claude.com.
Configuration
Method 1: ANTHROPIC_AUTH_TOKEN (Recommended)
Set ANTHROPIC_AUTH_TOKEN to your gateway virtual key:
export ANTHROPIC_AUTH_TOKEN=your-virtual-keyClaude Code sends this token in the Authorization: Bearer header automatically. The gateway recognizes it and uses the virtual key for routing and authentication.
Why this is recommended: No Anthropic account login required. The gateway handles everything through the virtual key.
Method 2: ANTHROPIC_CUSTOM_HEADERS (Alternative)
export ANTHROPIC_CUSTOM_HEADERS="x-bf-vk: your-virtual-key"Caveat: The virtual key is sent as a custom header, so Claude Code falls back to standard Anthropic account authentication. You still need to log in with an Anthropic account.
Shell Profile
Add to your ~/.bashrc or ~/.zshrc for persistence:
export ANTHROPIC_AUTH_TOKEN=your-virtual-keyBasic Usage
# Start an interactive session
claude
# Ask a single question
claude "How do I implement a REST API in Python?"
# Use a specific model
claude --model anthropic/claude-sonnet-4-20250514 "Explain this code"
# Pipe input
echo "Explain this function" | claude
# Continue the last session
claude --continueModel Selection
Claude Code defaults to Anthropic models. To use other providers, specify the model with provider/model format:
# OpenAI models
claude --model openai/gpt-4o "Hello"
# Google models
claude --model gemini-2.5-pro "Hello"
# Any configured provider
claude --model openai/o3-mini "Debug this error"Virtual Keys
Use gateway virtual keys to enforce budgets, rate limits, and provider access controls:
# Create a virtual key in the gateway dashboard, then:
export ANTHROPIC_AUTH_TOKEN=vk_your_virtual_keyVirtual keys let you:
- Set per-key spending budgets
- Apply rate limits
- Restrict access to specific providers
- Track usage per key
Gateway Endpoint
By default, Claude Code connects to https://api.anthropic.com. Point it to your gateway instead:
export ANTHROPIC_BASE_URL=https://viprouter.comTroubleshooting
401 Unauthorized
- Verify your virtual key is valid and not expired
- Check that the gateway is running
- Ensure
ANTHROPIC_AUTH_TOKENis set correctly
404 Not Found
- Ensure the model is configured in the gateway
- Check the model format:
provider/model-name(e.g.,openai/gpt-4o)
Rate Limited
- The gateway will automatically fallback to other providers if configured
- Check your virtual key's rate limits in the dashboard
Connection Refused
- Verify the gateway URL is correct
- Check that the gateway is running and accessible
Next Steps
- OpenAI SDK - Python & Node.js SDK
- Cursor - AI-powered IDE
- Hermes Agent - Terminal AI agent
