Setup guide - Documented by DeepSeek
Use DeepSeek in Claude Code
DeepSeek publishes a Claude Code integration guide that points Claude Code at DeepSeek's Anthropic-compatible endpoint (https://api.deepseek.com/anthropic) through environment variables. The default model is deepseek-flash, which serves DeepSeek-V4.1-Flash-1017 (1M context, 384K max output).
Last verified 5 steps4 official sources
Steps
- Step 1.
Install Claude Code (Node.js 18+ required; Windows users also need Git for Windows).
Terminalnpm install -g @anthropic-ai/claude-code - Step 2.
Check that the install worked.
Terminalclaude --version - Step 3.
Get an API key from https://platform.deepseek.com/api_keys, then set the environment variables (Linux / Mac).
Terminalexport ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key> export ANTHROPIC_MODEL=deepseek-flash[1m] export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-flash[1m] export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-flash[1m] export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-flash export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-flash export CLAUDE_CODE_EFFORT_LEVEL=max export CLAUDE_CODE_AUTO_COMPACT_WINDOW=786432 - Step 4.
Windows (PowerShell) equivalent.
Terminal$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic" $env:ANTHROPIC_AUTH_TOKEN="<your DeepSeek API Key>" $env:ANTHROPIC_MODEL="deepseek-flash[1m]" $env:ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-flash[1m]" $env:ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-flash[1m]" $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-flash" $env:CLAUDE_CODE_SUBAGENT_MODEL="deepseek-flash" $env:CLAUDE_CODE_EFFORT_LEVEL="max" $env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="786432" - Step 5.
Go to your project directory and start Claude Code.
Terminalcd /path/to/my-project claude
Caveats
- DeepSeek's guide sets every Claude Code tier to deepseek-flash. deepseek-v4-pro (DeepSeek-V4-Pro-0813) is the other current model id DeepSeek lists for the Anthropic format; using it as ANTHROPIC_MODEL is our combination, not a snippet from the guide. It costs more and does not support vision.
- DeepSeek maps Claude model names it receives: names starting with claude-opus go to deepseek-v4-pro, and claude-haiku / claude-sonnet names go to deepseek-flash. Other unsupported names that do not start with claude return a 400 error.
- On the Anthropic endpoint, DeepSeek ignores cache_control, top_k, mcp_servers and container. It does not support document or mcp_tool_use content blocks. thinking is supported but budget_tokens is ignored.
- The legacy ids deepseek-v4-flash and deepseek-v4-flash-vision-exp still work but are now served by DeepSeek-V4.1-Flash-1017. deepseek-chat and deepseek-reasoner were scheduled for discontinuation on 2026-07-24.
More setup guides
Same tool, other providers
Related reading
- DeepSeek V4.1-Flash-1017: Benchmarks vs Opus 5, Pricing, Switch?DeepSeek V4.1-Flash-1017 jumps 11 points on Terminal-Bench 4.0 at the same deepseek-flash price. Benchmarks vs Opus 5, K3, GLM-5.3 and when to switch.
- DeepSeek 4.1 Flash as a Daily Coding Model: Cache, Peak Hours and LimitsDeepSeek 4.1 Flash as a daily coding model: what a session costs, how peak hours double the bill, why caching matters, and where the subsidy argument holds.
- Where to Run DeepSeek V4.1 Flash Free and CheapDeepSeek V4.1 Flash replaced V4 Flash. Official API: $0.15 input, $0.60 output off-peak. OpenRouter hosts start near $0.05. MIT weights are on Hugging Face.
- DeepSeek V4 Flash Vision Exp: Experimental Vision, Limits, and How to Run It in OpenCodeDeepSeek V4 Flash Vision Exp guide: supported image formats, three input methods, the 384-token per-image cap, and how to run it in OpenCode today.
- We Read DeepSeek Harness: What 453K Lines of Agent Runtime Actually SayDeepSeek Harness (dsh) code read: a 453K-line plugin runtime on a vendored Cordis fork, three patterns worth stealing, and the gaps the launch does not mention.
- DeepSeek V4 Flash Is 90% Off Through Novita on Vercel AI Gateway: The Cost MathDeepSeek V4 Flash via Novita on Vercel AI Gateway was 90% off for Pro customers through August 11. The before/after cost math and the provider-pinning setup.
FAQ
How do I use DeepSeek in Claude Code?
DeepSeek publishes a Claude Code integration guide that points Claude Code at DeepSeek's Anthropic-compatible endpoint (https://api.deepseek.com/anthropic) through environment variables. The default model is deepseek-flash, which serves DeepSeek-V4.1-Flash-1017 (1M context, 384K max output).
Which DeepSeek model ids work in Claude Code?
The official docs read for this guide list deepseek-flash and deepseek-v4-pro. Requests go to https://api.deepseek.com/anthropic.
Is this an official DeepSeek and Claude Code setup?
DeepSeek documents this setup in its own docs. It was last checked against 4 official pages on October 17, 2026.
Sources
Last verified against 4 official pages.
- api-docs.deepseek.comhttps://api-docs.deepseek.com/quick_start/agent_integrations/claude_code
- api-docs.deepseek.comhttps://api-docs.deepseek.com/guides/anthropic_api
- api-docs.deepseek.comhttps://api-docs.deepseek.com/quick_start/pricing
- api-docs.deepseek.comhttps://api-docs.deepseek.com/updates
Newsletter
New models, set up the day they ship
One email per week. New model releases, the coding tools that support them and how to wire them up.