# How to Configure Environment Variables for Claude Code on Windows: Complete Guide

> Learn how to configure environment variables for Claude Code on Windows. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in PowerShell or system settings for seamless integration.

- Repository: [DeepSeek/awesome-deepseek-agent](https://github.com/deepseek-ai/awesome-deepseek-agent)
- Tags: how-to-guide
- Published: 2026-08-15

---

**To configure Claude Code on Windows, set the `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, and model-specific variables in your PowerShell session or system environment variables, then launch the tool to automatically apply the configuration.**

Claude Code reads its runtime configuration from environment variables that override any values stored in [`settings.json`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/settings.json). According to the `deepseek-ai/awesome-deepseek-agent` repository, this mechanism lets you keep sensitive credentials like your DeepSeek API key outside of source-controlled files while enabling per-session customization on Windows systems.

## Essential Environment Variables for Claude Code

The [`docs/claude_code.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/claude_code.md) file in the repository defines eight key variables that control Claude Code behavior on Windows【/cache/repos/github.com/deepseek-ai/awesome-deepseek-agent/main/docs/claude_code.md#L77-L88】. When present, these variables take precedence over configuration file settings.

- **`ANTHROPIC_BASE_URL`** – The endpoint URL for the DeepSeek Anthropic API (typically `https://api.deepseek.com/anthropic`)
- **`ANTHROPIC_AUTH_TOKEN`** – Your DeepSeek API authentication key
- **`ANTHROPIC_MODEL`** – The default model for general requests
- **`ANTHROPIC_DEFAULT_OPUS_MODEL`** – Model identifier for high-capacity "opus" requests
- **`ANTHROPIC_DEFAULT_SONNET_MODEL`** – Model identifier for balanced "sonnet" requests  
- **`ANTHROPIC_DEFAULT_HAIKU_MODEL`** – Model identifier for fast "haiku" requests
- **`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`** – Set to `1` to disable telemetry traffic
- **`CLAUDE_CODE_EFFORT_LEVEL`** – Controls reasoning effort (e.g., `max` for maximum capability)

## Setting Variables in PowerShell

PowerShell is the recommended shell for configuring Claude Code on Windows. You can apply settings temporarily for the current session or persist them permanently.

### Temporary Session Configuration

Use the `$env:` prefix to define variables that last only until you close the terminal window. This approach is ideal for testing different API keys or endpoints without affecting other applications.

```powershell
$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN="<your DeepSeek API Key>"
$env:ANTHROPIC_MODEL="deepseek-v4-pro[1m]"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro[1m]"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro[1m]"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash[1m]"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
$env:CLAUDE_CODE_EFFORT_LEVEL="max"

```

### Persistent User Environment Variables

To maintain these settings across system restarts, use the .NET environment method to write to the User registry hive. This makes the variables available to all future PowerShell sessions and the Claude Code VS Code extension.

```powershell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.deepseek.com/anthropic", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "<your DeepSeek API Key>", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "deepseek-v4-pro[1m]", "User")
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", "1", "User")
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_EFFORT_LEVEL", "max", "User")

```

Alternatively, open **System Properties → Advanced → Environment Variables** and add each variable manually through the GUI.

## Setting Variables in Command Prompt (CMD)

If you prefer Command Prompt, use the `set` command to configure the runtime environment. These settings apply only to the current CMD session and disappear when the window closes.

```cmd
set ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
set ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key>
set ANTHROPIC_MODEL=deepseek-v4-pro[1m]
set ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-v4-pro[1m]
set ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-pro[1m]
set ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash[1m]
set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
set CLAUDE_CODE_EFFORT_LEVEL=max

```

After executing these commands, launch Claude Code from the same terminal window to inherit the configuration.

## Verifying Your Configuration

Once you have set the environment variables, verify that Claude Code recognizes them by checking the application startup logs or running a test query. The tool automatically detects these variables at launch and routes API requests to the DeepSeek endpoint specified in `ANTHROPIC_BASE_URL`. If you configured persistent variables, restart your terminal or VS Code to ensure the new environment state loads.

## Summary

- **Environment variables override** any values in Claude Code's [`settings.json`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/settings.json) configuration file.
- **Eight specific variables** control the API endpoint, authentication, model selection, and telemetry settings.
- **PowerShell syntax** uses `$env:VARNAME="value"` for temporary settings and `[Environment]::SetEnvironmentVariable()` for permanent configuration.
- **Command Prompt** supports temporary configuration via `set` commands but requires manual system settings for persistence.
- **Source documentation** in [`docs/claude_code.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/claude_code.md) lines 77-88 provides the authoritative variable list for Windows users.

## Frequently Asked Questions

### Do environment variables override the settings.json file in Claude Code?

**Yes.** When you configure environment variables for Claude Code on Windows, they take precedence over values stored in [`settings.json`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/settings.json). This hierarchy allows you to commit non-sensitive configuration files to version control while keeping API keys and endpoint URLs in your local environment.

### How do I persist environment variables across PowerShell restarts?

**Use the .NET environment method.** Execute `[Environment]::SetEnvironmentVariable("VARIABLE_NAME", "value", "User")` for each variable you need to persist. The `"User"` scope writes to your Windows user profile, making the variables available in all future PowerShell sessions and GUI applications like VS Code.

### Can I use Command Prompt instead of PowerShell to configure Claude Code?

**Yes, but only for temporary configuration.** The `set` command in CMD applies variables to the current session only. For permanent configuration on Windows, PowerShell's `[Environment]::SetEnvironmentVariable()` method or the System Properties GUI is required, as CMD does not provide a native command to modify user-level environment variables.

### Where is the official documentation for Claude Code Windows configuration?

**The authoritative guide resides in [`docs/claude_code.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/claude_code.md).** The `deepseek-ai/awesome-deepseek-agent` repository maintains this file, which documents the specific environment variable names, their purposes, and Windows-specific syntax for both PowerShell and Command Prompt【/cache/repos/github.com/deepseek-ai/awesome-deepseek-agent/main/docs/claude_code.md】.