CLAUDE_AI_ORIGIN
Updated by Alex Sorokoletov
CLAUDE_AI_ORIGIN is a Claude Code environment variable: Overrides the base URL for Claude AI authentication endpoints. This complements the existing CLAUDE_CODE_API_BASE_URL (which controls the inference endpoint) by allowing the OAuth/auth origin to be pointed elsewhere — useful for corporate environments with custom auth gateways, staging environments, or air-gapped…. Added in v2.1.84 and still present in v2.1.294. It is not in the official reference.
| Status | Present in v2.1.294 |
|---|---|
| Added | Added in v2.1.84 |
| Category | Other |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_AI_ORIGIN=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_AI_ORIGIN": "<value>"
}
}Release notes that mention it
- Claude Code v2.1.87 — 2 New Environment Variables: OAuth Console and Trusted Devices
- Claude Code v2.1.86 — 2 New Environment Variables: Trusted Devices and the Final OAuth Override
- Claude Code v2.1.85 — 6 New Environment Variables: MCP Server Config and a 7 MB Diet
- Claude Code v2.1.84 — 6 New Environment Variables: Idle Management and Stream Resilience
Related variables
ANTHROPIC_BETAS: Comma-separated beta feature headers.ANTHROPIC_CUSTOM_HEADERS: Custom HTTP headers (newline-separated Key: Value).ANTHROPIC_FEDERATION_RULE_IDANTHROPIC_ORGANIZATION_IDANTHROPIC_WORKSPACE_IDBETA_TRACING_ENDPOINT: Custom endpoint for beta tracing.CLAUDE_AFK_COUNTDOWN_MSCLAUDE_BASE: Likely overrides the base URL or base configuration path for Claude Code.
Frequently asked questions
What does CLAUDE_AI_ORIGIN do?
Overrides the base URL for Claude AI authentication endpoints. This complements the existing CLAUDE_CODE_API_BASE_URL (which controls the inference endpoint) by allowing the OAuth/auth origin to be pointed elsewhere — useful for corporate environments with custom auth gateways, staging environments, or air-gapped…
Which Claude Code version has CLAUDE_AI_ORIGIN?
Added in v2.1.84 and still present in v2.1.294.
How do I set CLAUDE_AI_ORIGIN?
Export it before starting Claude Code (export CLAUDE_AI_ORIGIN=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.