Dec 2026 Release: Native protocol routing & sticky sessions for Claude 5.5, GPT-6.2, Gemini 4 & DeepSeek V4
Explore Model Plaza →
Troubleshooting 2026-12-05 · 4 min read

Fix Claude Code 401 Unauthorized, OAuth Conflicts & /v1/v1 404 Errors

Diagnostic commands and root-cause fixes for Claude Code 401 authentication errors, cached official OAuth collisions, and double-/v1 404 paths on custom API relays.

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.