Griffin / Claude Code pricing / DeepSeek in Claude Code
How to use DeepSeek in Claude Code, and what it costs
Short answer: Set ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic, put your DeepSeek key in ANTHROPIC_AUTH_TOKEN, and map Claude Code's models to deepseek-flash, then restart claude.1 DeepSeek V4.1 Flash costs $0.30 per million input tokens and $1.20 per million output tokens, half that off-peak.2 On RouteBench it passed 98.9% of coding tasks at $0.17 per 1,000, against $2.27 for Sonnet 5.5.4
How do I use DeepSeek in Claude Code?
You use DeepSeek in Claude Code by pointing its Anthropic connection at DeepSeek's Anthropic-compatible API with environment variables; no proxy is needed.13 These are DeepSeek's own recommended settings for macOS and Linux:1
export 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
- Create a key on the DeepSeek Platform and top up a balance; usage is deducted from it.2
- Add the lines above to your shell profile (on Windows, set the same names with
$env:), or put them under"env"in~/.claude/settings.json.15 - Open a new terminal, go to your project and run
claude.1 - Run
/statusand check that the base URL ishttps://api.deepseek.com/anthropic.5
| Setting | What it does |
|---|---|
ANTHROPIC_BASE_URL | Sends Claude Code's requests to DeepSeek instead of Anthropic |
ANTHROPIC_AUTH_TOKEN | Your DeepSeek key, sent as a bearer token |
ANTHROPIC_MODEL | The model for the main session; [1m] asks for the 1M-token window |
ANTHROPIC_DEFAULT_OPUS/SONNET/HAIKU_MODEL | What the opus, sonnet and haiku aliases and background tasks run |
CLAUDE_CODE_SUBAGENT_MODEL | The model subagents and teammates use |
CLAUDE_CODE_EFFORT_LEVEL | How hard the model thinks; DeepSeek suggests max |
CLAUDE_CODE_AUTO_COMPACT_WINDOW | When Claude Code compacts the conversation, here at 786,432 tokens |
Which DeepSeek model should Claude Code use?
Claude Code should use deepseek-flash, which DeepSeek now serves as DeepSeek-V4.1-Flash-1017 and recommends for every Claude Code role, including Opus.12 The larger deepseek-v4-pro costs 3 to 4.4 times as much per token and doesn’t read images.2
| Model name | Serves | Context · max output | Images |
|---|---|---|---|
deepseek-flash | DeepSeek-V4.1-Flash-1017 | 1M · 384K | Yes |
deepseek-v4-pro | DeepSeek-V4-Pro-0813 | 1M · 384K | No |
If you leave a Claude name in place, DeepSeek maps it: claude-opus names go to deepseek-v4-pro and are billed at its price, and claude-sonnet and claude-haiku names go to deepseek-flash.3 Set the aliases yourself so an Opus request doesn't quietly cost the Pro rate; how Claude Code's model aliases work explains each one. The old names deepseek-v4-flash still work and are served by the new Flash.2
How much does DeepSeek cost in Claude Code?
DeepSeek in Claude Code costs $0.30 per million input tokens, $0.006 per million cached tokens and $1.20 per million output tokens on deepseek-flash at peak hours, and half that off-peak.2 There is no plan: you pay per token from a prepaid balance.2 For flat-price options, compare the GLM Coding Plan and Claude's own plans in Claude Code pricing.
| Model | Input | Cache hit | Output |
|---|---|---|---|
| deepseek-flash, off-peak | $0.15 | $0.003 | $0.60 |
| deepseek-flash, peak | $0.30 | $0.006 | $1.20 |
| deepseek-v4-pro, peak | $1.32 | $0.044 | $3.96 |
| Claude Sonnet 5.5 | $2.00 | $0.10 | $10.00 |
| Claude Opus 5.5 | $4.00 | $0.20 | $20.00 |
Long Claude Code sessions are mostly cache reads, and there DeepSeek Flash is 17x cheaper than Sonnet at peak and 33x off-peak.26
When is DeepSeek cheapest to use?
DeepSeek is cheapest outside its peak hours, 01:00–04:00 and 06:00–10:00 UTC on weekdays, when every rate is half price; weekends and Chinese public holidays are off-peak all day.2 For a developer in the United States that means a normal working day is entirely off-peak: 9 a.m. to 6 p.m. Eastern is 14:00 to 23:00 UTC in winter.
| Time zone | Peak, weekdays |
|---|---|
| UTC | 01:00–04:00 and 06:00–10:00 |
| US Eastern (UTC−5) | 8–11 p.m. and 1–5 a.m. |
| US Pacific (UTC−8) | 5–8 p.m. and 10 p.m.–2 a.m. |
| Central Europe (UTC+1) | 2–5 a.m. and 7–11 a.m. |
| India (UTC+5:30) | 6:30–9:30 a.m. and 11:30 a.m.–3:30 p.m. |
How does DeepSeek compare with Claude on coding tasks?
DeepSeek V4.1 Flash passed 98.9% of RouteBench's coding tasks at $0.17 per 1,000, while Sonnet 5.5 passed all of them at $2.27 and Opus 5.5 99.1% at $4.78.4 The gap was security review, where Flash passed 97.4%.4
| Model | Code review | Security review | Tool calling |
|---|---|---|---|
| DeepSeek V4.1 Flash | 99.1% · $0.13 | 97.4% · $0.18 | 100% · $0.20 |
| Claude Sonnet 5.5 | 100% · $1.39 | 100% · $1.71 | 100% · $3.77 |
| Claude Opus 5.5 | 100% · $2.97 | 100% · $4.01 | 97.3% · $7.13 |
In our own PR-review agent, DeepSeek held up on real pull requests too: moving security review from GPT-5.6 Terra to DeepSeek V4 Pro cut it from $0.166 to $0.011 per run, and on 54 paired code reviews DeepSeek V4.1 Flash found 41 significant issues to GLM 5.3 Flash's 33, so we kept DeepSeek there.7 RouteBench tasks are single calls; long multi-file sessions are where Claude still pulls ahead, so try DeepSeek on routine work first.4
Is DeepSeek slower than Claude in Claude Code?
DeepSeek V4.1 Flash answered about as fast as Claude on RouteBench's short tasks but had a slower tail: in the November 16, 2026 run its median answer took 329 ms against 274 ms for Sonnet 5.5 and 320 ms for Opus 5.5, while its slowest 5% took 924 ms against Sonnet's 429 ms.8 Across all six runs DeepSeek's slowest 5% ranged from 611 to 1,597 ms.8 Long Claude Code turns write far more tokens than these tasks, so output speed matters more there.
What doesn't work when Claude Code runs on DeepSeek?
Most of Claude Code works on DeepSeek, but DeepSeek's Anthropic API ignores some fields: cache_control (DeepSeek caches by prefix on its own), thinking budget_tokens, mcp_servers and anthropic-beta headers.3
- Images:
deepseek-flashreads images in user messages and tool results;deepseek-v4-prodoesn't.3 - Web search: DeepSeek offers its own
deepseek_web_searchanddeepseek_read_urlserver tools; since November 18, 2026 their calls aren't billed separately, and the results bill as tokens.23 - Output limits: for some Claude Code requests in thinking mode, DeepSeek may raise
max_tokens, so it isn't a strict cap.3 - Unknown model names that don't start with
claudereturn a 400 error.3
Can I use DeepSeek and Claude in the same Claude Code setup?
You can use DeepSeek and Claude together, but not through one ANTHROPIC_BASE_URL, which sends everything to one provider.5 Two common ways: run Claude Code Router locally and send background and subagent requests to DeepSeek while the main session stays on Claude, or use OpenRouter, which serves both behind one key. A simpler split is two terminals: one profile on DeepSeek for bulk edits, your normal login for hard problems.
Sources
- DeepSeek API docs: integrate with Claude Code · checked
- DeepSeek API docs: models and pricing · checked
- DeepSeek API docs: using the Anthropic API · checked
- Griffin: RouteBench coding results, six runs pooled (our data) · checked
- Claude Code docs: connect Claude Code to an LLM gateway · checked
- Claude API docs: pricing · checked
- Winding AI: IonWarp review-agent cost log, September to November 2026 (our own runs, internal) · checked
- Griffin: RouteBench run of November 16, 2026, with latency per arm (our data) · checked
FAQ
Can Claude Code use DeepSeek?
Yes. DeepSeek has an Anthropic-compatible API at https://api.deepseek.com/anthropic, so Claude Code connects to it with environment variables and no proxy.
Is DeepSeek in Claude Code free?
No. DeepSeek bills per token from a prepaid balance: $0.30 per million input tokens and $1.20 per million output tokens on deepseek-flash at peak, half that off-peak.
Should I use deepseek-flash or deepseek-v4-pro?
deepseek-flash. DeepSeek recommends it for every Claude Code role, it reads images, and deepseek-v4-pro costs 3 to 4.4 times as much per token.
Why does Claude Code on DeepSeek cost more than expected?
Usually because a claude-opus model name was left in place: DeepSeek maps it to deepseek-v4-pro and bills the Pro price. Set ANTHROPIC_DEFAULT_OPUS_MODEL to deepseek-flash.
How do I switch back to Claude?
Unset ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN and the model variables, or remove them from settings.json, then restart claude and log in again.
Test a cheaper model on your own calls.
Griffin replays your app's real AI calls on models like DeepSeek and moves a feature only after the cheaper model passed. Watching is free.