Claude Code
Point Claude Code at SupaNexus’s Anthropic-compatible Messages API — same CLI, gateway billing.
1. Get a SupaNexus API key
Sign in to the Developer Console, open your project → API Keys, create a key, and copy the secret immediately (shown once). One project key works across OpenAI-compatible and Anthropic-compatible clients.
2. Install Claude Code
Prefer the native installer. npm also works if you already have Node.js 18+.
# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
# or
npm install -g @anthropic-ai/claude-code3. Point environment variables at SupaNexus
Claude Code talks Anthropic protocol. Set ANTHROPIC_BASE_URL to the SupaNexus host only (no /v1). Put the project key in ANTHROPIC_AUTH_TOKEN (Bearer). Explicitly blank ANTHROPIC_API_KEY so Claude Code does not send x-api-key to Anthropic directly. Persist these in ~/.zshrc or ~/.bashrc, then source the profile (or open a new terminal).
export ANTHROPIC_BASE_URL="<BASE_URL>"
export ANTHROPIC_AUTH_TOKEN="sk-snx-..."
export ANTHROPIC_API_KEY="" # must be empty4. Optional: project-scoped settings
To keep settings per repo (and avoid shell profile keys), create .claude/settings.local.json in the project root. Do not put these vars in a plain .env — the native Claude Code installer does not load .env files.
{
"env": {
"ANTHROPIC_BASE_URL": "<BASE_URL>",
"ANTHROPIC_AUTH_TOKEN": "sk-snx-...",
"ANTHROPIC_API_KEY": ""
}
}5. Clear a cached Anthropic login
If you previously signed into Claude Code with an Anthropic account, run /logout once, quit, and relaunch. A cached login plus gateway credentials often causes confusing model-not-found errors on startup.
claude
> /logout
# quit, then start again6. Start in your project and verify
Run claude in the repo. Inside the session, /status should show Auth token: ANTHROPIC_AUTH_TOKEN and Anthropic base URL pointing at SupaNexus. Then send a short prompt and confirm usage in the console.
cd /path/to/your/project
claude
> /status7. Optional: pin model tiers
Claude Code routes work across Opus / Sonnet / Haiku (and related) slots. Override with catalog IDs if you want every role on a specific SupaNexus model. Prefer Anthropic-family IDs for best tool-use reliability.
export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-3-5-sonnet"
export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-3-5-sonnet"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-3-5-haiku"
export CLAUDE_CODE_SUBAGENT_MODEL="anthropic/claude-3-5-sonnet"8. Troubleshooting
Auth failures: ensure ANTHROPIC_API_KEY is literally empty, the key is in ANTHROPIC_AUTH_TOKEN, and you reloaded the shell. Wrong host: Base URL must be the endpoint host without /v1. Still seeing Anthropic login in /status: run /logout again and relaunch.