Appendix H
Environment Variables Reference
Claude Code uses 85+ environment variables. Here are the most important by category:
Authentication & Model
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY | API key for Claude SDK |
ANTHROPIC_MODEL | Model to use (e.g., claude-opus-4-6) |
CLAUDE_CODE_EFFORT_LEVEL | low, medium, high (Opus 4.6 only) |
CLAUDE_CODE_SUBAGENT_MODEL | Model for subagents |
CLAUDE_CODE_USE_BEDROCK | Use AWS Bedrock |
CLAUDE_CODE_USE_VERTEX | Use Google Vertex AI |
CLAUDE_CODE_USE_FOUNDRY | Use Microsoft Foundry |
Context & Token Management
| Variable | Purpose |
|---|---|
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE | Context % at which auto-compaction triggers (default ~95) |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | Max output tokens (default 32,000, max 64,000) |
MAX_THINKING_TOKENS | Extended thinking budget (default 31,999, 0 to disable) |
MAX_MCP_OUTPUT_TOKENS | Max tokens in MCP responses (default 25,000) |
SLASH_COMMAND_TOOL_CHAR_BUDGET | Character budget for skill metadata in context |
Feature Flags
| Variable | Purpose |
|---|---|
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS | Enable agent teams (1) |
CLAUDE_CODE_ENABLE_TASKS | Task system (false to revert to TODO list) |
CLAUDE_CODE_DISABLE_AUTO_MEMORY | Disable auto memory (1) |
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS | Disable background tasks (1) |
ENABLE_TOOL_SEARCH | MCP tool search: auto, true, false |
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS | Disable beta headers for LLM gateways |
Bash Configuration
| Variable | Purpose |
|---|---|
BASH_DEFAULT_TIMEOUT_MS | Default bash command timeout |
BASH_MAX_TIMEOUT_MS | Maximum bash timeout |
BASH_MAX_OUTPUT_LENGTH | Max chars before middle-truncation |
CLAUDE_CODE_SHELL | Override automatic shell detection |
CLAUDE_CODE_SHELL_PREFIX | Wrap all bash commands (e.g., for logging) |
Networking & Proxy
| Variable | Purpose |
|---|---|
HTTP_PROXY / HTTPS_PROXY | Proxy servers |
NO_PROXY | Domains to bypass proxy |
CLAUDE_CODE_CLIENT_CERT | mTLS client certificate path |
CLAUDE_CODE_CLIENT_KEY | mTLS client key path |
MCP
| Variable | Purpose |
|---|---|
MCP_TIMEOUT | MCP server startup timeout (ms) |
MCP_TOOL_TIMEOUT | MCP tool execution timeout (ms) |
MCP_CLIENT_SECRET | OAuth client secret for MCP servers |
UI & Telemetry
| Variable | Purpose |
|---|---|
DISABLE_TELEMETRY | Opt out of Statsig telemetry |
DISABLE_AUTOUPDATER | Disable auto-updates |
CLAUDE_CODE_HIDE_ACCOUNT_INFO | Hide email/org from UI (for streaming) |
CLAUDE_CONFIG_DIR | Custom config directory |
CLAUDE_CODE_TMPDIR | Custom temp directory |