In short.
Claude Code's environment-variable reference is a configuration guide for developers and administrators, but using it correctly requires checking which setting wins and which features depend on it. Its most useful details explain unexpected authentication, ignored settings, timeout behavior and features lost when telemetry or feature-flag fetching is disabled. It also documents limits of subprocess credential scrubbing and differences between releases. Prices and redistribution rights are unknown from this page, and runtime behavior has not been assessed.
Researched and written by an AI model and checked by a second AI model. How it works
The scope is the complete supplied Environment variables page at [https://code.claude.com/docs/en/env-vars.md], including setup, precedence, the variable table, numeric and boolean notices, subprocess credential scrubbing, feature-flag dependencies and first-session behavior. Linked documentation and the documentation index are excluded. Findings describe documented behavior only; no execution, performance measurement, compatibility validation or resulting cost assessment was performed.
The overview
identity
The resource is the Claude Code documentation page titled Environment variables at [https://code.claude.com/docs/en/env-vars.md]. It explains how variables control the coding assistant and supplies a reference table of names, accepted values, defaults, exceptions and version requirements.
assessment
This is useful when Claude Code uses an unexpected model or credential, ignores a setting, times out, or loses a feature after configuration changes. Its strength is explaining exceptions that variable names alone do not reveal. Beginners receive concrete setup examples; experienced operators receive provider, process and precedence details. It does not establish that a configuration improves performance or works with a particular gateway.
users
The page suits individual developers adjusting terminal sessions, teams sharing project settings, administrators deploying managed configuration, and developers running automated or Agent SDK sessions. Beginners can use the setup instructions and consult one variable at a time. Provider routing, monitoring and subprocess controls require more knowledge of credentials, operating systems and deployment environments.
capabilities
The reference covers authentication and API endpoints; model aliases, effort and context limits; command timeouts and output limits; subagents and workflows; plugins; updates; terminal accessibility; and OpenTelemetry monitoring. It also covers Model Context Protocol (MCP), which connects external tools, including connection timing, execution limits and tool discovery.
Several controls have consequences beyond their immediate feature. Increasing CLAUDE_CODE_MAX_OUTPUT_TOKENS reduces the context available before automatic compaction. CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC disables automatic updates, telemetry, error reporting and feature-flag fetching, but does not cover automatic registration of the official plugin marketplace.
Using it
requirements
The examples assume Claude Code is installed and the claude command is available. Shell instructions cover macOS, Linux, WSL, Windows PowerShell and Windows CMD. Complete installation requirements and account eligibility are not established by this page.
Requirements vary by variable and configuration scope. For example, CLAUDE_CODE_DISABLE_FEATURE_FLAGS requires v2.1.319 or later, while v2.1.124 through v2.1.318 read only the older name DISABLE_GROWTHBOOK, which later releases still accept. Project and local settings cannot set some variables, including CLAUDE_CONFIG_DIR and several monitoring controls. An embedding host can also override provider and authentication configuration.
mechanism
Environment variables are named values available to a process. Claude Code reads shell values at startup and writes settings-file env entries into its environment. Those entries replace inherited shell values in most sessions, with documented exceptions. Managed settings override the same variable in user or project settings.
Precedence differs by feature: --model and /model override ANTHROPIC_MODEL, while CLAUDE_CODE_EFFORT_LEVEL overrides --effort and /effort. Saving settings reapplies new and changed env values to a running session, but startup-only features retain their initial values. Removing an env entry does not unset it in an existing session.
setup
For a temporary shell setting, assign the variable before launching claude. The macOS, Linux and WSL example uses export API_TIMEOUT_MS="1200000", followed by claude. Printing the variable in that shell confirms the assignment; it does not establish which value Claude Code ultimately uses after settings precedence applies.
For persistent configuration, place string values under env in settings.json. User settings apply across projects, project settings are shared through source control, and local settings apply to one person in one project. Settings-file values receive no shell expansion, so a path containing ~ or $HOME remains literal; use an absolute path where required.
example
The documented persistent example places {"env":{"API_TIMEOUT_MS":"1200000","BASH_DEFAULT_TIMEOUT_MS":"300000"}} in ~/.claude/settings.json. This allows each API attempt up to 20 minutes to receive response headers and sets a five-minute default for foreground Bash or PowerShell commands. API_TIMEOUT_MS does not limit the duration of a streaming response after headers arrive; positive values also bound completion of non-streaming attempts. This example was not executed.
Assessment & evidence
limitations
Boolean behavior is inconsistent by design. Most switches accept standard true and false values, but any non-empty value, including 0 or false, activates CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, DISABLE_TELEMETRY, DISABLE_ERROR_REPORTING, CLAUDE_CODE_TMUX_TRUECOLOR and IS_DEMO. DO_NOT_TRACK uses standard boolean parsing. Disabling feature-flag fetching also removes capabilities such as account-synced skills and plugins, MCP tasks and Code Mode; Remote Control has additional variable-specific requirements.
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB reduces credential exposure in child processes but leaves GitHub tokens, proxy credentials, Git configuration variables and unrecognized secrets available. On Linux it also isolates Bash process visibility, affecting commands such as ps and kill. The page therefore supports treating scrubbing as one protective layer, with compatibility consequences.
reasoning
The strongest reason to use this reference is to connect a specific symptom to the configuration layer responsible for it. For example, API response-header timeouts, streaming idle watchdogs, command timeouts and MCP timeouts govern different waits. Raising one does not establish that another will stop aborting work. Similarly, a documented feature switch cannot establish account access or gateway compatibility.
alternatives
The page identifies settings-file fields, launch flags and in-session commands as other ways to configure many behaviors. A flag can suit a single invocation, a settings file can retain configuration, and commands such as /model can change an active session. Availability and precedence vary by feature. Other configuration guides or competing tools are not assessed.
evidence
The evidence is the documentation page at [https://code.claude.com/docs/en/env-vars.md]. It supports statements about documented names, defaults, examples, dependencies and exceptions. Linked pages are outside the scope. No commands, installations, API requests or configuration changes were executed, so actual behavior, reliability, performance and compatibility remain unassessed.
Access & freshness
costs
The page supplies no subscription prices, API rates or total cost estimates. The cost of using Claude Code with these settings is unknown. ANTHROPIC_API_KEY changes the authentication source from a subscription to the supplied key: non-interactive sessions use it whenever present, while interactive sessions request approval once before it overrides the subscription.
The documentation states that one-hour prompt-cache writes are billed at a higher rate than five-minute writes, without giving amounts. It documents token limits and retry controls but provides no measured savings or resulting charges for any configuration.
rights
The supplied page does not state a documentation licence, redistribution permission or Claude Code software licence. Rights to redistribute or bundle the page are unknown. Provider account terms and software licensing conditions are not assessed.
freshness
The supplied snapshot was captured at 2026-11-15T02:36:27.055Z. The page does not state a publication or last-update date, and it does not establish the latest Claude Code release.
Version notes materially affect interpretation. Before v2.1.211, scientific notation and digit separators could silently produce smaller numeric values. Before v2.1.251, credential scrubbing removed only ANTHROPIC_API_KEY and AWS_SECRET_ACCESS_KEY among the documented examples. The newer feature-flag variable requires v2.1.319. Removed variables remain listed as no-ops, so individual entries need checking against the installed version.
actions
Start with the behavior you need to change, then check the relevant variable's accepted values, release requirement, provider restrictions and precedence. Choose the appropriate shell or settings scope. Relaunch for startup-only behavior and after removing a settings-file variable.
Before changing authentication, identify whether an API key would replace subscription credentials. Before disabling telemetry or network traffic, inspect the associated feature losses. To reverse a presence-based switch, unset it or use the empty value specified by its rule; writing false may leave it active.
