Environment Variables
An environment variable is a named setting that a program reads when it starts.
Claude Code 2.1.312 reads well over a thousand of them.
This section lists 1458 variables that you can use. It splits them into groups, so you can find them.
The official docs list a few of them. Only the program shows most of them.
Set a variable in your shell, or under the env key of ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, or managed settings.
To change a value, edit it, then restart claude. When the file changes, values in a settings env block also apply to a running session.
How Claude Code Reads Variables
Claude Code starts with the environment it inherits from your shell.
It then reads the env key of every settings file and writes each entry into its own process environment.
Source: the official Environment Variables page.
A feature then reads the variable from the process environment. For some variables, a CLI flag or a settings key can win instead.
Which Value Wins
- A value in a settings
envblock replaces the value from your shell in most sessions. The official docs list the sessions that keep the shell value. - Between settings files,
envvalues follow the normal settings order. A managed entry beats the same variable in user or project settings. - Some behaviors have a variable, a settings key, and a flag. Which one wins differs for each pair. For example,
--modeland/modelbeatANTHROPIC_MODEL, andANTHROPIC_MODELbeats themodelkey. ButCLAUDE_CODE_EFFORT_LEVELbeats--effortand/effort. - Project and local settings cannot set some variables, such as
CLAUDE_CONFIG_DIRand the OpenTelemetry exporter variables. Claude Code applies most otherenvvalues from a project only after you trust the folder. - You cannot remove a variable from a settings file. To cancel one that a shell profile exports, set it to an empty string, for example
"CLAUDE_CODE_USE_VERTEX": "". Claude Code treats the empty value as unset for provider selection, but child processes still inherit the empty value.
Each row says what applies to it. Look in the Notes column for the words "Project env can set it before trust" or "Not set from project env before trust".
Set Variables in settings.json
Put variables under the env key. Claude Code copies the values as written. No shell expands them, so ~ and $HOME stay as typed. Use absolute paths.
{
"$schema": "https://clawdipedia.cc/schemas/claude-code-settings.json",
"env": {
"API_TIMEOUT_MS": "1200000",
"BASH_DEFAULT_TIMEOUT_MS": "300000",
"CLAUDE_CODE_EFFORT_LEVEL": "high"
}
}
Alternatively, set one in your shell for one session.
export API_TIMEOUT_MS=1200000
claude
Removing a variable from the file does not unset it in a running session. The removal applies the next time you start claude.
Features that read their variables only once at startup, such as OpenTelemetry, keep their startup values until you restart.
Numeric variables, such as timeouts and token budgets, accept forms like 2e3 (2000) and 64_000 (64000) as well as plain digits. A few rows say they take plain digits only.
Twenty Useful Variables
| Variable | Page | What it does |
|---|---|---|
ANTHROPIC_ | Auth and Accounts | Your API key. |
ANTHROPIC_ | Network and Proxy | Send API calls to another address. |
ANTHROPIC_ | Models and Effort | The model for the session. |
ANTHROPIC_ | Models and Effort | The model ID that the sonnet alias means. |
CLAUDE_ | Models and Effort | How hard the model thinks. Wins over -- and /. |
CLAUDE_ | Models and Effort | The most output tokens for a request. |
CLAUDE_ | Cloud Providers | Use Amazon Bedrock. |
CLAUDE_ | Cloud Providers | Use Google Vertex AI. |
HTTPS_ | Network and Proxy | Send traffic through an HTTPS proxy. |
NO_ | Network and Proxy | Hosts that skip the proxy. |
API_ | Network and Proxy | How long an API request may take. Default is 600000. |
BASH_ | Tools and Bash | Default time limit of a foreground shell command. |
BASH_ | Tools and Bash | How many characters of shell output Claude reads back. |
CLAUDE_ | Context and Compaction | Start compaction earlier. |
CLAUDE_ | Sessions and Storage | Use another folder instead of ~/.. |
DISABLE_ | Sessions and Storage | Stop automatic background updates. |
DISABLE_ | Telemetry and Debug | Opt out of telemetry. Any non-empty value counts. |
CLAUDE_ | Telemetry and Debug | Turn on OpenTelemetry metrics and logs. |
MCP_ | Plugins and MCP | How long an MCP server gets to start. |
CLAUDE_ | Features and Toggles | Run a minimal mode. -- sets it. |
Variable Groups
| Page | What is in it | Variables |
|---|---|---|
| Models and Effort | Environment variables that pick the model, pin model aliases, set thinking effort, and limit output size | 84 |
| Auth and Accounts | Environment variables for API keys, login tokens, credential helpers, and account details | 79 |
| Cloud Providers | Environment variables for Amazon Bedrock, Google Vertex AI, Microsoft Foundry, and gateway setups | 78 |
| Network and Proxy | Environment variables for API addresses, proxies, TLS certificates, time limits, and retries | 68 |
| Context and Compaction | Environment variables for the context window, compaction, memory, and the prompt cache | 49 |
| Tools and Bash | Environment variables for the Bash tool, file tools, search, permissions, and the sandbox | 102 |
| UI and Terminal | Environment variables for the terminal screen, colors, voice, keys, and notifications | 88 |
| Sessions and Storage | Environment variables for config folders, session files, resume, install, and updates | 78 |
| Telemetry and Debug | Environment variables for usage data, OpenTelemetry, debug logs, and error reports | 141 |
| Plugins and MCP | Environment variables for plugins, MCP servers, skills, hooks, and marketplaces | 102 |
| Agents and Teams | Environment variables for subagents, agent teams, background tasks, and workers | 80 |
| Features and Toggles | Environment variables that turn single features on or off, including server-gated features | 67 |
| Remote and Cloud Sessions | Environment variables for cloud sessions, the bridge, the desktop app, Chrome, Cowork, and Slack | 186 |
| SDK and Automation | Environment variables for programs that host Claude Code, the Agent SDK, and automation | 25 |
| System and Third-Party | Environment variables owned by your system or other tools that Claude Code reads, such as HOME, TERM, and ALL_PROXY | 130 |
| Bundled Libraries | Environment variables read only by libraries bundled inside Claude Code, such as the AWS SDK, gRPC, and cloud detectors | 126 |
How to Read the Tables
Every group page has the same columns.
| Column | Meaning |
|---|---|
| Variable | The exact name. Names are case sensitive. |
| Status | Badges. Documented: An official docs page names this item. means the official docs name it. Undocumented: Only the program shows this item. It can change without notice. means only the program shows it. Differs: The official docs and the program disagree. The row says how. means the docs and the program disagree. Gated: Works only behind a flag or a server gate. means a feature flag or server gate affects it. |
| What it does | The effect, in plain words. |
| Values and default | The accepted values and the default, as far as the program shows. A dash means the source gave no detail. |
| Notes | Where it applies, and whether a project env block can set it before you trust the folder. |
Treat
2.1.312, but nothing promises they will work in the next release.Some rows mention a probe. That means a run of the real binary against a local stub showed what the variable changed in the request. No model call leaves the machine in a probe. A run with no visible effect does not prove that a variable does nothing.
What Is Left Out
The tables list only variables you can use. They leave out removed or inert names, test-only names, names for Anthropic staff, and flags whose purpose nobody knows. For every item that only the program shows, see Undocumented Items.
Related Pages
- How to Read These Docs
- What Changed
- Settings Files and Scopes and the
envkey