This document outlines all supported environment variables in Claude Code, organized by category.
- API & Authentication
- Model Configuration
- Network & Proxy
- Performance & Optimization
- Debugging & Logging
- Feature Flags
- Remote & Cloud Deployment
- File & Path Configuration
- Shell & Terminal
- Security & Permissions
- Telemetry & Analytics
- Development & Testing
API key for authenticating with Anthropic's API. Takes precedence over OAuth when set.
- Type: String
- Example:
sk-ant-xxxxx
Alternative authentication token for API requests.
- Type: String
- Priority: Lower than
ANTHROPIC_API_KEY
Custom base URL for API requests. Allows routing to different API endpoints.
- Type: URL
- Default:
https://api.anthropic.com - Example:
https://api-staging.anthropic.com
OAuth token for session authentication. Used in remote sessions and CCR environments.
- Type: String
Refresh token for OAuth sessions. Enables automatic token refresh.
- Type: String
Comma-separated list of OAuth scopes requested during authentication.
- Type: String (comma-separated)
- Example:
read,write,admin
Custom OAuth client ID override (e.g., for Xcode integration).
- Type: String
Direct session access token for remote environments.
- Type: String
File descriptor for WebSocket authentication token in remote sessions.
- Type: Integer (file descriptor)
Override the default model used for chat and queries.
- Type: String
- Examples:
claude-opus-4-6,claude-sonnet-4-6,claude-haiku-4-5
Custom Opus model for deployments. Sets the Opus option in model selection.
- Type: String
Custom Sonnet model for deployments.
- Type: String
Custom Haiku model for deployments.
- Type: String
Override the small/fast model used for quick operations.
- Type: String
- Default: Haiku model
AWS region for Bedrock's small/fast model.
- Type: String
- Example:
us-east-1
Define a custom model option not in the standard list.
- Type: String
Display name for custom model option.
- Type: String
Description for custom model option.
- Type: String
Maximum tokens allocated for extended thinking during API calls.
- Type: Integer
- Example:
10000
Disable extended thinking feature globally.
- Type: Boolean (
0or1)
Disable adaptive thinking mode that adjusts token allocation.
- Type: Boolean
Disable interleaved thinking (thinking blocks between tool calls).
- Type: Boolean
Set effort level for processing (low, medium, high, max). Numeric values (ant-only).
- Type: String or Integer
Always enable effort setting even when not normally available.
- Type: Boolean
HTTP proxy server URL for outgoing requests.
- Type: URL
- Example:
http://proxy.example.com:8080
HTTPS proxy server URL for outgoing requests.
- Type: URL
Comma-separated list of hosts/domains to bypass proxy.
- Type: String (comma-separated)
- Example:
localhost,127.0.0.1,*.example.com
Unix socket path for direct socket communication with API.
- Type: Path
- Use Case: Local development, special deployments
Path to additional CA certificate file for SSL/TLS validation.
- Type: File path
- Use Case: Corporate proxies, custom certificate authorities
Path to client certificate for mTLS authentication.
- Type: File path
- Format: PEM
Path to client private key for mTLS authentication.
- Type: File path
- Format: PEM
Passphrase for encrypted client private key.
- Type: String
Let proxy handle hostname resolution instead of local DNS.
- Type: Boolean
Disable fast mode optimization for queries.
- Type: Boolean
Disable prompt caching globally.
- Type: Boolean
Disable prompt caching specifically for Haiku model.
- Type: Boolean
Disable prompt caching specifically for Sonnet model.
- Type: Boolean
Disable prompt caching specifically for Opus model.
- Type: Boolean
Enable 1-hour prompt caching for Bedrock deployments.
- Type: Boolean
API request timeout in milliseconds.
- Type: Integer
- Default:
300000(5 minutes for CLI),120000(2 minutes for remote) - Example:
600000
Disable file checkpointing for undo/redo functionality.
- Type: Boolean
Enable file checkpointing in SDK mode.
- Type: Boolean
Disable virtual scrolling in terminal output (increases memory usage).
- Type: Boolean
Adjustment factor for scroll speed (default: 1).
- Type: Float
- Example:
1.5
Disable background task execution.
- Type: Boolean
Set minimum debug logging level (trace, debug, info, warn, error).
- Type: String
- Example:
debug
Enable general debug logging.
- Type: Boolean
Directory for debug log files.
- Type: Directory path
- Default:
~/.claude/debug/
Path to write diagnostic information.
- Type: File path
Exit immediately after first render (performance testing).
- Type: Boolean
- Ant-only: Yes
Enable detailed startup performance profiling.
- Type: Boolean
Enable query execution profiling.
- Type: Boolean
Log frame timing information to file.
- Type: File path
Enable Perfetto trace output for performance analysis.
- Type: Boolean
Interval for writing Perfetto trace data (seconds).
- Type: Integer
Enable terminal session recording (asciicast format).
- Type: Boolean
- Ant-only: Yes
Dump auto mode classifier outputs for debugging.
- Type: Boolean
- Ant-only: Yes
Run in simple mode with limited tools (Bash, Read, Edit only).
- Type: Boolean
- Use Case: Restricted environments, testing
Enable brief/compact output mode.
- Type: Boolean
Enable streamlined output format.
- Type: Boolean
Globally disable extended thinking.
- Type: Boolean
Disable automatic memory generation.
- Type: Boolean
Disable automatic context compaction.
- Type: Boolean
Disable all compaction (manual and automatic).
- Type: Boolean
Configure auto-compaction triggering window.
- Type: String or JSON
Disable file attachment support.
- Type: Boolean
Disable the advisor tool.
- Type: Boolean
Don't update terminal window title.
- Type: Boolean
Disable mouse support in terminal.
- Type: Boolean
Disable mouse click handling.
- Type: Boolean
Prevent screen flicker (alt-screen mode). Override auto-detection.
- Type: Boolean
- Default: Auto-detect based on terminal
Disable 1M context window usage.
- Type: Boolean
Disable git-related instructions.
- Type: Boolean
Enable accessibility features (screen reader mode).
- Type: Boolean
Disable message action buttons.
- Type: Boolean
Enable brief mode upload functionality.
- Type: Boolean
Indicate running in remote/cloud environment (CCR).
- Type: Boolean
Session ID for remote environment.
- Type: String (UUID)
Directory for storing session memory in remote environments.
- Type: Directory path
Type of remote environment (e.g., 'bridge', 'byoc').
- Type: String
URL for session ingress endpoint in remote mode.
- Type: URL
Override for session ingress URL.
- Type: URL
OAuth token for bridge-based remote sessions.
- Type: String
- Ant-only: Yes
Base URL for bridge service.
- Type: URL
- Ant-only: Yes
Use CCR v2 (newer cloud runtime version).
- Type: Boolean
Force code bundling in CCR environments.
- Type: Boolean
Enable code bundling in CCR.
- Type: Boolean
Enable upstream proxy in CCR.
- Type: Boolean
Kind of deployment environment (bridge, byoc, anthropic_cloud).
- Type: String
Version of the environment runner.
- Type: String
Dynamically detected environment runner version.
- Type: String
Unique identifier for container instance.
- Type: String (UUID)
Type of coworker in team environment.
- Type: String
Enable session persistence across restarts.
- Type: Boolean
Skip saving prompt history in persistent sessions.
- Type: Boolean
Directory for Claude configuration and cache files.
- Type: Directory path
- Default:
~/.claude
Temporary directory for Claude Code operations.
- Type: Directory path
- Default:
/tmp(Unix) or%TEMP%(Windows)
Custom directory for plugin cache.
- Type: Directory path
Directory containing seed plugins.
- Type: Directory path
Timeout for plugin git operations.
- Type: Integer (milliseconds)
Use Cowork plugin directory instead of standard.
- Type: Boolean
XDG standard config directory (Linux/macOS).
- Type: Directory path
- Default:
~/.config
Windows application data directory.
- Type: Directory path (Windows)
Windows local application data directory.
- Type: Directory path (Windows)
User's shell executable path.
- Type: Path
- Examples:
/bin/bash,/bin/zsh
Override shell for Claude Code operations.
- Type: Path
Command prefix for shell operations (e.g., for shell prefix commands).
- Type: String
Enable PowerShell tool (Windows).
- Type: Boolean
- Default: Auto-detect
Maintain project working directory across commands.
- Type: Boolean
Terminal type (affects color and feature support).
- Type: String
- Examples:
xterm-256color,screen,tmux
Terminal program identifier (auto-detected).
- Type: String
- Examples:
iTerm.app,vscode,tmux
Indicates running inside tmux session.
- Type: String
- Set by: tmux automatically
iTerm2 session identifier.
- Type: String
Name of tmux session for Claude Code.
- Type: String
Tmux prefix key configuration.
- Type: String
Enable truecolor in tmux.
- Type: Boolean
Indicate tmux prefix conflicts with Claude.
- Type: Boolean
Enable additional security protections.
- Type: Boolean
Skip command injection detection (not recommended).
- Type: Boolean
Set permission checking mode explicitly.
- Type: String
- Options:
default,accept-edits,plan,auto
Disable policy-based skill restrictions.
- Type: Boolean
Directory for job templates and constraints.
- Type: Directory path
Completely disable telemetry collection.
- Type: Boolean
Disable non-essential network traffic (essential-traffic mode).
- Type: Boolean
Disable error reporting to Anthropic.
- Type: Boolean
Explicitly enable telemetry (3rd party providers).
- Type: Boolean
OpenTelemetry metrics exporter type.
- Type: String
- Examples:
otlp,jaeger,prometheus
OpenTelemetry logs exporter type.
- Type: String
OpenTelemetry traces exporter type.
- Type: String
OpenTelemetry OTLP exporter endpoint.
- Type: URL
- Example:
http://localhost:4318
Custom headers for OTLP exporter.
- Type: String (comma-separated key=value pairs)
Protocol for OTLP exporter (http/protobuf, grpc).
- Type: String
Interval for metrics export (milliseconds).
- Type: Integer
Interval for logs export (milliseconds).
- Type: Integer
Interval for traces export (milliseconds).
- Type: Integer
Log user prompts in telemetry.
- Type: Boolean
Log detailed tool information.
- Type: Boolean
Log tool content in telemetry.
- Type: Boolean
Enable 3rd party telemetry.
- Type: Boolean
Endpoint for beta tracing/telemetry.
- Type: URL
- Ant-only: Yes
Enable enhanced telemetry beta features.
- Type: Boolean
Custom metrics endpoint for ant users.
- Type: URL
- Ant-only: Yes
Node.js environment (development, production, test).
- Type: String
- Values:
development,production,test
Node.js command-line options.
- Type: String
- Example:
--max-old-space-size=8192
Internal user type classification.
- Type: String
- Values:
external,ant(internal) - Note: Build-time constant, affects available features
Type of Claude Code entry point.
- Type: String
- Values:
cli,sdk-ts,sdk-py,sdk-cli,remote,claude-desktop,claude-vscode,local-agent
Automatically determined entry point.
- Type: String
Running in demo mode (limited features).
- Type: Boolean
Root directory of monorepo.
- Type: Directory path
Root directory for test fixtures.
- Type: Directory path
Record VCR cassettes for tests.
- Type: Boolean
Force VCR usage in tests.
- Type: Boolean
Max retries for structured output from API.
- Type: Integer
- Default:
5
Override maximum output tokens (ant-only).
- Type: Integer
Maximum API request retries.
- Type: Integer
Skip Claude Code installation validation.
- Type: Boolean
Disable /doctor command.
- Type: Boolean
Disable auto-update functionality.
- Type: Boolean
Force plugin auto-updates.
- Type: Boolean
Override current date for testing.
- Type: String (ISO date)
- Ant-only: Yes
Enable undercover/testing mode.
- Type: Boolean
- Ant-only: Yes
Indicates running in GitHub Actions CI.
- Type: Boolean (auto-set)
Generic CI environment indicator.
- Type: Boolean
Enable session persistence in tests.
- Type: Boolean
Some variables are evaluated at build time and cannot be changed at runtime:
USER_TYPE- Build-time define, affects feature availability- Various
ANT_prefixed variables - Ant-specific build configuration
Features marked as Ant-only are only available in internal Anthropic builds:
- Extra debugging tools
- Internal model overrides
- Advanced telemetry options
- Undercover mode for testing
When multiple authentication methods are available:
ANTHROPIC_API_KEY(highest priority)ANTHROPIC_AUTH_TOKEN- OAuth tokens
- API key helper
For settings available in multiple places:
- Command-line flags (highest)
- Environment variables
- Configuration files
- Defaults (lowest)