Precedence
Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For ANTHROPIC_MODEL and CLAUDE_CODE_AUTO_CONNECT_IDE, Claude Code reads the variable first and uses the model or autoConnectIde setting only when the variable is unset. For the pair you're setting, check the variable's row below and the key's entry on the settings reference.
When the same variable is set in both your shell and a settings file env block, the settings file value applies. Claude Code writes each env entry into the process environment, replacing the value inherited from the shell. The env setting says when it applies them. A few variables are special-cased; the env setting lists the exceptions.
In a settings file you can set a variable but you can't remove one. To override a variable you can't unset, such as a stale CLAUDE_CODE_USE_VERTEX exported by a shell profile you don't control, set it to an empty string in the env block: "CLAUDE_CODE_USE_VERTEX": "". Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value.
Between settings files, env values follow settings precedence, so a managed settings entry overrides the same variable in user or project settings.
How an environment variable interacts with CLI flags and in-session commands varies per feature: --model and /model override ANTHROPIC_MODEL, while CLAUDE_CODE_EFFORT_LEVEL overrides --effort and /effort. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it.
Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch claude. Variables set under the env key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files.