Claude Code
Claude Code can connect directly through the OdiRouter compatible proxy. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, then start Claude Code.
Requirements
Section titled “Requirements”| Requirement | Value |
|---|---|
| Claude Code | Installed and working with its native setup |
| Anthropic Base URL | https://www.odirouter.ai |
| Messages endpoint | https://www.odirouter.ai/v1/messages |
| Auth token | OdiRouter API key |
| Model | A Claude Code model mapping supported by OdiRouter |
Configure Environment Variables
Section titled “Configure Environment Variables”Set these before starting Claude Code:
export ANTHROPIC_BASE_URL="https://www.odirouter.ai"export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"Do not commit a real API key to repository config. Keep it in your shell profile, local environment manager, or CI secrets.
If your Claude Code version reads ANTHROPIC_API_KEY instead of ANTHROPIC_AUTH_TOKEN, set both:
export ANTHROPIC_API_KEY="${ANTHROPIC_AUTH_TOKEN}"Start Claude Code
Section titled “Start Claude Code”cd /path/to/your/projectclaudeStart with a read-only task:
Explain the repository structure. Do not edit files.Unified Proxy URL
Section titled “Unified Proxy URL”Claude Code uses the Anthropic-compatible Base URL. Claude Code appends the Anthropic API path, so do not paste /v1/messages here:
https://www.odirouter.aiIf you are calling the Anthropic Messages API from curl, an HTTP Request node, or another raw HTTP tool, use the full endpoint:
curl -sS "https://www.odirouter.ai/v1/messages" \ -H "x-api-key: Bearer YOUR_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Reply with: Claude Code connected to OdiRouter" } ] }'Troubleshooting
Section titled “Troubleshooting”| Symptom | Fix |
|---|---|
Claude Code returns 401 or invalid key | Check that ANTHROPIC_AUTH_TOKEN is a valid OdiRouter API key |
| Claude Code still calls official Anthropic | Confirm ANTHROPIC_BASE_URL is set in the shell that starts claude |
| Model not found | Use a model name supported by OdiRouter or check the current proxy model mapping |
| Protocol or streaming errors | Confirm the Base URL is https://www.odirouter.ai, not the full /v1/messages endpoint |