DeepSeek is the cheapest credible way to keep using Claude Code. It ships an Anthropic-compatible endpoint, so you don’t need a proxy or a router — point Claude Code at DeepSeek with two environment variables and your workflow stays identical while the per-token cost drops to a fraction of Anthropic’s.
This is the native-Windows setup: API key, environment variables, picking the right model, and the errors people hit. Prefer WSL? See run DeepSeek V4 with Claude Code on WSL. For the wider picture, see use cheap AI models with Claude Code.
Step 1: Get a DeepSeek API key
Create an account on the DeepSeek platform, add a few dollars of credit, and generate an API key. Pay-per-token rates are low, so a small top-up goes a long way. Keep the key somewhere safe — you’ll set it as an environment variable, not paste it into a file.
Step 2: Make sure Claude Code is installed
npm install -g @anthropic-ai/claude-code
Step 3: Point Claude Code at DeepSeek
DeepSeek’s Anthropic-compatible endpoint is the key. In PowerShell, set three variables for the session:
$env:ANTHROPIC_BASE_URL = "https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-deepseek-key"
$env:ANTHROPIC_MODEL = "deepseek-chat"
claude
That’s the whole setup. Claude Code now runs on DeepSeek.
To make it persistent across reboots, use setx (note: setx affects new terminals, not the current one):
setx ANTHROPIC_BASE_URL "https://api.deepseek.com/anthropic"
setx ANTHROPIC_AUTH_TOKEN "sk-your-deepseek-key"
setx ANTHROPIC_MODEL "deepseek-chat"
Step 4: Pick the right model
DeepSeek models for Claude Code
| deepseek-chat | General coding; fast and cheapest |
|---|---|
| deepseek-reasoner | Thinking mode for harder problems |
Set ANTHROPIC_MODEL to whichever you want. Use deepseek-chat for everyday work and switch to deepseek-reasoner when a task needs deeper reasoning — it costs more and is slower, so it’s not the default.
Pricing and what to expect
DeepSeek is pay-per-token only — there’s no flat coding plan. It’s among the cheapest serious models, often a fraction of Anthropic’s rates, and it applies cache-hit discounts when prompts repeat context. It also runs off-peak discount windows where the rate drops during set hours, which is worth scheduling heavy work around.
Because these rates shift with promotions and new versions, treat any figure as a snapshot and confirm on DeepSeek’s official pricing page. Full breakdown: DeepSeek V4 pricing explained.
Verify it’s working
claude
# then: "summarize this repo and list the main entry points"
If it reads files and answers normally, DeepSeek is serving Claude Code. Switch models by changing ANTHROPIC_MODEL and reopening the terminal.
Troubleshooting
- Auth errors —
ANTHROPIC_AUTH_TOKENisn’t set in the current shell, or the key is invalid.setxonly affects new terminals, so open a fresh one. - Format/streaming errors — you’re on the
/v1URL; switch to/anthropic. - “Model not found” — check the exact model ID against DeepSeek’s docs.
- Still hitting Anthropic — a previously set variable is overriding yours; confirm with
echo $env:ANTHROPIC_BASE_URL.
DeepSeek + Claude Code checklist
- DeepSeek API key created and funded
- Claude Code installed
- ANTHROPIC_BASE_URL set to the /anthropic endpoint
- ANTHROPIC_AUTH_TOKEN and ANTHROPIC_MODEL set
- Tested on a small task
Wrapping up
Running DeepSeek with Claude Code on Windows is three environment variables: the /anthropic base URL, your auth token, and the model. No proxy needed. Use deepseek-chat for everyday coding and deepseek-reasoner when you need deeper thinking, and time heavy jobs for the off-peak discount.
For a cleaner shell experience, do it in WSL. To use DeepSeek with other agents instead, see DeepSeek with Codex CLI or DeepSeek + OpenCode.