Step 1: Audit Active Environment Variables
env | grep -iE "ANTHROPIC|CLAUDE"
Ensure you do not have both ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN exported simultaneously, and confirm ANTHROPIC_BASE_URL equals https://www.aiozium.com (no /v1).
Step 2: Clear Residual Official OAuth State
claude logout
Also inspect project-local .claude/settings.local.json files to make sure a repo override is not redirecting traffic back to api.anthropic.com.
Step 3: Isolate the Gateway with Direct curl
curl -i -sS https://www.aiozium.com/v1/messages \
-H "x-api-key: sk-your-aiozium-api-key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-haiku-5-5",
"max_tokens": 32,
"messages": [{"role": "user", "content": "ping"}]
}'
A 200 OK response from curl confirms your key and group permissions are healthy and narrows the fault strictly to local CLI environment overrides.
Related Questions
Why does curl succeed with my API key while Claude Code throws 401?
curl sends only the explicit header you supply, whereas Claude Code may prefer a cached official OAuth credential in ~/.claude/ or your OS keychain unless you run claude logout.