Skip to main content
Claude Code reads a number of environment variables at startup and throughout a session. These complement settings.json for cases where you need machine- or process-level control without modifying files.
ANTHROPIC_API_KEY is required when authenticating via API key. Without it (and without an active OAuth session), Claude Code cannot make API calls.

Authentication

Cloud provider routing

Vertex AI per-model region overrides

Each variable below pins a specific model to a Vertex AI region:

Configuration paths

Operational modes

Memory

Context and compaction

Thinking and model behavior

Telemetry and observability

Shell and editor behavior

Networking

How environment variables interact with settings

Environment variables are evaluated at the process level and take effect for the lifetime of the Claude Code process. They are not written to settings.json. The env field in settings.json lets you set environment variables that are applied to each Claude Code session:
Truthy values for boolean environment variables are 1, true, yes, and on (case-insensitive). Falsy values are 0, false, no, and off. An unset variable is treated as falsy.