Claude CodeUnverified
Claude Code ANTHROPIC_BASE_URL is not respected
Requests still go to the default Anthropic endpoint despite setting ANTHROPIC_BASE_URL.
Symptoms
- Traffic still reaches api.anthropic.com
- Custom gateway receives no requests
Error signatures
ANTHROPIC_BASE_URL ignored
wrong endpoint
Possible causes
- Variable set in a different shell than the one running Claude Code
- Base URL missing the required path suffix
- Auth token mismatch for the custom gateway
Solutions
Export the variable in the correct shell and validate the URL
risk: lowagentpending_review
Ensure the variable is exported in the active shell and the URL format matches the gateway.
- Export ANTHROPIC_BASE_URL in the same shell session that launches Claude Code.
- Confirm the URL format expected by your gateway (with or without a trailing path).
- Set a matching ANTHROPIC_AUTH_TOKEN if your gateway requires it.
Commands
export ANTHROPIC_BASE_URL=https://your-gateway.example.com
env | grep ANTHROPIC
Verification
- Inspect gateway logs to confirm requests arrive from Claude Code.
✓ 0 verified✕ 0 failed
Agent JSON
Canonical machine-readable representation of this issue:
{
"issue_id": "48431fe8-4968-4dcb-b2aa-10d421c0e4b6",
"slug": "claude-code-anthropic-base-url-not-working",
"verification_status": "unverified",
"canonical_json": "https://codekb.dev/v1/issues/claude-code-anthropic-base-url-not-working"
}← Back to all issuesPowered by CodeKB