Home / Docs / Claude Code

Claude Code

Point Anthropic's CLI agent at the gateway with two environment variables — and avoid the one trap that silently bills the wrong key.

Claude Code reads its endpoint from the environment, so no patching is needed. This is the most common setup on the gateway.

Setup

export ANTHROPIC_BASE_URL="https://aiprimetech.io"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
claude

That is the whole integration. Add both lines to ~/.zshrc or ~/.bashrc to make it permanent.

The trap: if ANTHROPIC_API_KEY is set in your shell, Claude Code may prefer it and bill that key, silently ignoring both your gateway key and any Pro/Max subscription. Run echo $ANTHROPIC_API_KEY — if it prints anything, unset ANTHROPIC_API_KEY before starting.

Per-project configuration

To scope the gateway to one repo rather than your whole shell, use a settings file:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://aiprimetech.io",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key"
  }
}

Place it at .claude/settings.json in the project, or ~/.claude/settings.json for a user-wide default. Add .claude/settings.json to .gitignore — it contains a key.

Verifying it worked

"c"># 1. the gateway answers and the key is valid
curl -s -o /dev/null -w "%{http_code}\n" https://aiprimetech.io/v1/models \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"

"c"># 2. start Claude Code and confirm usage appears in your dashboard
claude

If requests do not appear in your dashboard, they are going somewhere else — almost always the ANTHROPIC_API_KEY trap above.

Choosing a model

claude --model claude-opus-4-8

Any id from Models works. Opus for hard refactors, Sonnet for everyday work — see Cost control for why that choice dominates your bill.

Keeping the cost sane