Variables
Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable's row notes it takes plain digits only. For example, Claude Code reads 2e3 as 2000 and 64_000 as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as 1e6 setting a timeout to 1.
For variables that turn a behavior on or off, set 1 or true to turn it on and 0 or false to turn it off, in any casing.
Some variables read only whether you set them at all, so any non-empty value including 0 turns the behavior on, and you turn the behavior off by unsetting the variable or setting it to an empty value. These variables work that way:
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICDISABLE_TELEMETRYDISABLE_ERROR_REPORTINGCLAUDE_CODE_TMUX_TRUECOLORFALLBACK_FOR_ALL_PRIMARY_MODELSIS_DEMO
One other variable has its own rule: FORCE_HYPERLINK reads a number, so only 0 turns it off. Each variable's row also states its own rule.
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY | API key sent as X-Api-Key header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (-p), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run unset ANTHROPIC_API_KEY |
ANTHROPIC_AUTH_TOKEN | Custom value for the Authorization header (the value you set here will be prefixed with Bearer ) |
ANTHROPIC_AWS_API_KEY | Workspace API key for Claude Platform on AWS, generated in the AWS Console. Sent as x-api-key and takes precedence over AWS SigV4 |
ANTHROPIC_AWS_BASE_URL | Override the Claude Platform on AWS endpoint URL. Use for custom regions or when routing through an LLM gateway. Defaults to https://aws-external-anthropic.\{region\}.api.aws. Claude Code resolves the region with the same precedence as on Amazon Bedrock |
ANTHROPIC_AWS_WORKSPACE_ID | Required for Claude Platform on AWS. Sent on every request as the anthropic-workspace-id header |
ANTHROPIC_BASE_URL | Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, MCP tool search is disabled by default. Set ENABLE_TOOL_SEARCH=true if your proxy forwards tool_reference blocks. As of v2.1.196, Remote Control is disabled when this points at a host other than api.anthropic.com, matching its behavior on Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry |
ANTHROPIC_BEDROCK_BASE_URL | Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an LLM gateway. See Amazon Bedrock |
ANTHROPIC_BEDROCK_MANTLE_BASE_URL | Override the Amazon Bedrock Mantle endpoint URL. See Mantle endpoint |
ANTHROPIC_BEDROCK_REGION_PREFIX | Cross-region inference profile prefix (us, eu, apac, jp, au, or global) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See Amazon Bedrock |
ANTHROPIC_BEDROCK_SERVICE_TIER | Amazon Bedrock service tier (default, flex, or priority). Sent as the X-Amzn-Bedrock-Service-Tier header. See Amazon Bedrock |
ANTHROPIC_BETAS | Comma-separated list of additional anthropic-beta header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an Anthropic API beta before Claude Code adds native support. Unlike the --betas flag, which requires API key authentication, this variable works with all auth methods including Claude.ai subscription |
ANTHROPIC_CUSTOM_HEADERS | Custom headers to add to requests (Name: Value format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can't carry, such as a curly quote or a zero-width space, the request fails with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. Invalid request header value lists the exact character set and where the check runs. A value that sets a credential, org or tenant, routing, or API-behavior header, such as Authorization or Host, counts as a setting that needs approval when server-managed settings deliver it. From project or local settings, such a value follows the rules for when env values apply |
ANTHROPIC_CUSTOM_MODEL_OPTION | Model ID to add as a custom entry in the /model picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See Model configuration |