For AI agents: the public content index is available at https://we0.ai/llms.txt, and the English article bundle is available at https://we0.ai/llms-full.txt.
For AI agents: the complete content index is available at https://we0.ai/llms.txt, the full English article bundle is available at https://we0.ai/llms-full.txt, and this page is available as Markdown at https://we0.ai/articles/claude-code-deepseek-setup-tutorial-anthropic.md.
This tutorial shows how to connect Claude Code to DeepSeek's Anthropic-compatible endpoint using environment variables. It covers Windows Po...

If you are using Claude Code and want to point its backend API calls to DeepSeek's Anthropic-compatible endpoint, this is the setup guide you can follow directly.
The core idea is simple: you do not need to change how you use Claude Code. You only need to change environment variables so the request route, auth token, and default model mapping all point to DeepSeek instead of Anthropic's default path.
This guide is useful for two groups:
Claude Code CLI users
IDE plugin users, such as people using VS Code
If you only use the IDE integration, you can skip the CLI install section and go straight to the environment variable setup.
If Claude Code CLI is not installed yet, run:
npm install -g @anthropic-ai/claude-codeIf you already have it installed, or you mainly use the IDE plugin, you can skip ahead.
This is the real center of the tutorial. The environment variables below are what determine whether Claude Code continues using its default backend path or starts sending requests through DeepSeek's Anthropic-compatible endpoint.
The key variables are:
DEEPSEEK_API_KEY
ANTHROPIC_BASE_URL
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_MODEL
the default model mapping variables used for Opus, Sonnet, Haiku, and subagents
Overview of connecting Claude Code to a DeepSeek-compatible endpoint
On Windows, open PowerShell as Administrator and run the commands below.
[Environment]::SetEnvironmentVariable("DEEPSEEK_API_KEY", "your-actual-api-key-here", "Machine")[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.deepseek.com/anthropic", "Machine")[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", $env:DEEPSEEK_API_KEY, "Machine")At a practical level, this tells Claude Code to route Anthropic-style requests through DeepSeek's compatible endpoint instead.Windows PowerShell setup for the DeepSeek-compatible endpoint
High-performance model:
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "deepseek-v4-pro", "Machine")Faster model:
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "deepseek-v4-flash", "Machine")
You only need one of those. Use deepseek-v4-pro if you care more about quality. Use deepseek-v4-flash if you care more about speed and cost.
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_OPUS_MODEL", "deepseek-v4-pro", "Machine")
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_SONNET_MODEL", "deepseek-v4-pro", "Machine")
[Environment]::SetEnvironmentVariable("ANTHROPIC_DEFAULT_HAIKU_MODEL", "deepseek-v4-flash", "Machine")
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_SUBAGENT_MODEL", "deepseek-v4-pro", "Machine")
This block is useful because it keeps Claude Code consistent across different model tiers and subagent use cases.
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", "1", "Machine")
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK", "1", "Machine")
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_EFFORT_LEVEL", "max", "Machine")
These settings are commonly understood as:
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: disable nonessential traffic
CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK: disable non-streaming fallback
CLAUDE_CODE_EFFORT_LEVEL:set a higher reasoning effort level
If you want to start cautiously, you can leave the effort level for later tuning.
On Linux and macOS, the more natural pattern is to append the variables to your shell config file.
Common locations include:
~/.bashrc
~/.zshrc
~/.bash_profile
Linux and macOS shell-based configuration for Claude Code and DeepSeek
Describe your idea once, and We0 AI can generate a showcase site, pages, and CMS, then help you attract customers and traffic after launch.
One complete project generation for free registration
Best for trying one complete generation flow and seeing a first project draft quickly.
export DEEPSEEK_API_KEY="your-actual-api-key-here"
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="$DEEPSEEK_API_KEY"
High-performance model:
export ANTHROPIC_MODEL="deepseek-v4-pro"
Faster model:
export ANTHROPIC_MODEL="deepseek-v4-flash"
Again, choose one.
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-pro"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
export CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK="1"
export CLAUDE_CODE_EFFORT_LEVEL="max"
This is where many setups fail. The variables may be correct, but your current shell session still has the old environment loaded.
Run the matching command for the file you edited:
source ~/.bashrc
or:
source ~/.zshrc
or:
source ~/.bash_profile
If you are using an IDE plugin, restart the IDE itself so the host process reloads the updated environment variables.
Open a fresh terminal and run:
claude
If Claude Code starts normally and no longer complains about the default Anthropic-side auth flow, your setup is usually working.
For IDE users, the simplest flow is:
restart the editor
open the Claude Code integration
send a normal request
confirm that the request behaves as expected with your configured endpoint and model
If your IDE or plugin exposes logs, it is worth checking them once to confirm the traffic is really going to the DeepSeek-compatible base URL.
Verification checklist for the Claude Code and DeepSeek setup
At a practical level, this whole configuration can be reduced to three moves:
1. give Claude Code your DeepSeek credentials
2. replace the default Anthropic base URL with DeepSeek's compatible endpoint
3. map the default and subagent models to the DeepSeek variants you want
Before you call the setup done, quickly verify:
your API key is valid
ANTHROPIC_BASE_URL is exactly https://api.deepseek.com/anthropic
your shell has been reloaded, or your IDE has been restarted
If those three checks pass, Claude Code is usually ready to run against the DeepSeek-compatible endpoint.
Start from one sentence and have a complete website in minutes.