DeepSeek API - 1M Context Window
Run Claude Code at full capability - file I/O, terminal commands, MCP tools, subagents - powered by DeepSeek V4 Pro via the Anthropic-compatible endpoint. No Anthropic API key required.
Platforms: Windows · macOS · Linux
Claude Code subscriptions give you a fixed token budget with double limits (5-hour rolling window + weekly cap). DeepSeek API gives you pure pay-as-you-go -- no windows, no caps. Same Claude Code features, same terminal, same MCP tools.
| Claude Pro | Claude Max 5x | Claude Max 20x | DeepSeek V4-Pro | DeepSeek V4-Flash | |
|---|---|---|---|---|---|
| Monthly cost | $20 | $100 | $200 | $20 (pay-as-you-go) | $20 (pay-as-you-go) |
| Est. monthly token budget | ~1.3M tokens | ~5M tokens | ~9M tokens | ~20M tokens (15M in + 5M out) | ~60M tokens (45M in + 15M out) |
| Context window | 1M | 1M | 1M | 1M | 1M |
| 5h window cap? | ✓ | ✓ | ✓ | -- | -- |
| Weekly cap? | ✓ | ✓ | ✓ | -- | -- |
| Peak throttling? | throttled | throttled | throttled | -- | -- |
| Token/$ value (vs Claude Pro) | 1x | ~0.77x | ~0.69x | ~15x | ~46x |
| Lockout risk (heavy week) | Weds-Thu | Thu-Fri | Fri-Sat | None | None |
Claude Code token estimates (Opus 4.8) are based on community measurements (Feb 2026, ~3.6K API snapshots -- see source below). Anthropic does not publish exact token limits -- they express caps in opaque "hours." These estimates are ~95% Opus usage and predate Claude Fable 5's plan changes, so they don't reflect any Fable 5 usage. As of 2026-07-20, Fable 5 is bundled into Max/Team Premium plans at 50% of normal usage limits; Pro and Team Standard no longer get it in their fixed monthly quota -- it now runs on pay-as-you-go usage credits at $10/M input and $50/M output tokens instead (source). That's why the Pro-plan figure below (
What $20 Gets You) is Opus-only -- Fable 5 usage on Pro would draw down separate credits, not the $20 subscription budget. The V4-Pro / V4-Flash figures above are the worst-case floor: off-peak rates from Pricing assuming zero cache hits. With realistic cache-hit rates for agentic coding (~90%+), actual budgets run roughly 1.8x higher -- see theWhat $20 Gets Yousection below for the full floor-vs-realistic breakdown and sourcing.
Anthropic applies two simultaneous caps -- hitting either one blocks usage:
| Limit | Reset |
|---|---|
| 5-hour rolling window | Resets 5 hours after your first prompt in the window |
| Weekly quota | Resets every 7 days |
The relationship (measured across 3,664 API snapshots, ~95% Opus usage):
| Max 5x ($100) | Max 20x ($200) | |
|---|---|---|
| 1 full 5h window consumes | ~8-9% of weekly | ~15% of weekly |
| Full windows per week | ~12 | ~7 |
Max 20x gives you 4x the 5-hour burst of Max 5x, but only ~2.1x the weekly budget. You go faster, not longer -- which is why each window burns a bigger chunk of the week (15% vs 8-9%). The name "20x" refers to burst capacity relative to the Pro plan, not weekly sustained throughput.
Source: Claude Max $100 vs $200: What You Actually Get (Measured, Not Guessed) by Alex Dobrushskiy -- ~3,600 usage-API snapshots polled every ~60s across two consecutive billing cycles (Max 5x: Feb 22-28, 2,947 snapshots across two cycles; Max 20x: Feb 28-Mar 1, 717 snapshots, only 1.9 days into the cycle -- a partial sample), from autonomous coding-agent workloads (~95% Opus). The 8-9% figure spans the article's own two Max 5x cycles (8.2% and 8.9%); the 4x/2.1x burst-vs-weekly ratio is the article's own reported figure, not independently re-derived here.
| Scenario | Claude Code Pro | This Setup -- V4-Pro | This Setup -- V4-Flash |
|---|---|---|---|
| Worst-case floor (0% cache hit) | ~1.3M tokens (then locked) | ~20M tokens (15x more) | ~60M tokens (46x more) |
| Realistic (~90% cache hit, typical agentic coding) | ~1.3M tokens (fixed either way) | ~36M tokens (28x more) | ~107M tokens (82x more) |
No lockouts, no weekly reset to wait for, 1M context window. Same Claude Code interface.
How these are calculated: both rows use the off-peak rates from the Pricing table with a 75% input / 25% output token split.
Worst-case floor: assumes every input token is a cache miss -- $20 / (0.75 x $0.66 + 0.25 x $1.98 per 1M) ≈ 20.2M tokens for V4-Pro, and $20 / (0.75 x $0.22 + 0.25 x $0.66 per 1M) ≈ 60.6M tokens for V4-Flash. A hard floor, not a typical outcome.
Realistic: assumes a 90% cache-hit rate on input tokens, the conservative end of the 90-97% range reported for agentic coding workloads with stable system prompts (real-world DeepSeek reports run higher: a documented r/DeepSeek bill hit 98.07% on V4-Flash, while a 100.9M-token Claude Code audit reported ~84% -- both examples via ofox.ai's cache-hit math breakdown). At 90%: $20 / (0.75 x (0.9x$0.022 + 0.1x$0.66) + 0.25 x $1.98 per 1M) ≈ 35.8M tokens for V4-Pro, and $20 / (0.75 x (0.9x$0.007 + 0.1x$0.22) + 0.25 x $0.66 per 1M) ≈ 107.4M tokens for V4-Flash. At the upper end of the range (97%) this rises to ~38M / ~114M. Claude Code's own prompt caching (system prompt, tool definitions, and repeated context are cached) is exactly the pattern that drives cache hit rates this high, so the realistic row -- not the floor -- is the more representative number for actual usage. Cache-hit rate isn't guaranteed by either provider and depends on your workload; monitor
usage.prompt_cache_hit_tokensin API responses to check your own.
Official DeepSeek API pricing (api.deepseek.com, Anthropic-compatible endpoint at api.deepseek.com/anthropic). Model versions: DeepSeek-V4-Flash-0731 and DeepSeek-V4-Pro-0813. Both support 1M context, JSON output, tool calls, and thinking mode (default; can be disabled -- see Thinking Mode).
| Model | deepseek-v4-flash | deepseek-v4-pro |
|---|---|---|
| Model version | DeepSeek-V4-Flash-0731 | DeepSeek-V4-Pro-0813 |
| Context length | 1M | 1M |
| Max output | 384K | 384K |
| Concurrency limit | 2500 | 500 |
Token pricing (per 1M tokens):
| Off-Peak | Peak | |
|---|---|---|
| Input (cache hit) -- Flash | $0.007 | $0.014 |
| Input (cache hit) -- Pro | $0.022 | $0.044 |
| Input (cache miss) -- Flash | $0.22 | $0.44 |
| Input (cache miss) -- Pro | $0.66 | $1.32 |
| Output -- Flash | $0.66 | $1.32 |
| Output -- Pro | $1.98 | $3.96 |
Peak hours: 01:00-04:00 and 06:00-10:00 UTC (09:00-12:00 and 14:00-18:00 Beijing time); all other hours are off-peak. This table matches the official DeepSeek Models & Pricing page verbatim as of 2026-08-16. Off-peak/peak billing (replacing DeepSeek's previous flat-rate pricing) took effect 2026-08-16 16:00 UTC (00:00 Beijing time, Aug 17) -- see DeepSeek Raises API Prices by Up to 12x With the Official V4 Pro Release for background on the increase (cache-hit input rose 6x off-peak/12x peak for Pro, 2.5x/5x for Flash; cache-miss input and output rose 1.5-2.25x off-peak, 3-4.5x peak).
Agentic & coding benchmark comparison. Includes the previous-generation DeepSeek releases (Preview) for reference alongside current frontier models. Bold = best in row. - = not reported. DS-V4-Pro-0813 and DS-V4-Flash-0731 are the models used in this setup.
Source: DeepSeek-V4-Pro-0813 model card on Hugging Face (deepseek-ai, official) -- table reproduced verbatim, cross-checked against DeepSeek's pricing page and coverage of the release. These are vendor-reported figures: code-agent tasks were evaluated with the minimal mode of DeepSeek Harness,
maxreasoning effort,temperature=1.0, top_p=0.95-- DeepSeek's own harness and settings, not independently reproduced by a third party.
| Benchmark | DeepSeek-V4-Pro-0813 | DeepSeek-V4-Flash-0731 | DeepSeek-V4-Pro (Preview) | DeepSeek-V4-Flash (Preview) | GLM-5.2 | Kimi K3 | Opus-4.8 | Fable-5 (w/ fallback) |
|---|---|---|---|---|---|---|---|---|
| HLE (wo / w tools) | 42.7 / 60.0 | 37.8 / 51.5 | 37.7 / 48.2 | 34.8 / 45.1 | 40.5 / 54.7 | 43.5 / 56.0 | 49.8 / 57.9 | 53.3 / 63.0 |
| Terminal Bench 2.1 | 87.9 | 82.7 | 72.1 | 61.8 | 81.0 | 88.3 | 85.0 | 88.0 |
| NL2Repo | 61.5 | 54.2 | 38.5 | 39.4 | 48.9 | -- | 69.7 | -- |
| Cybergym | 83.3 | 76.7 | 52.7 | 38.7 | -- | 80.0 | 78.3 | 83.1 |
| DeepSWE | 62.7 | 54.4 | 12.8 | 7.3 | 46.2 | 67.5 | 58.0 | 70.0 |
| Toolathlon-Verified | 74.1 | 70.3 | 55.9 | 49.7 | 59.9 | 76.5 | 76.2 | 77.9 |
| Agents' Last Exam | 25.7 | 25.2 | 16.5 | 15.8 | 23.8 | 27.6 | 25.7 | -- |
| AutomationBench (Public) | 31.8 | 25.1 | 12.8 | 10.8 | 12.9 | 30.8 | 27.2 | 29.1 |
| DSBench-FullStack † | 71.1 | 68.7 | 41.8 | 37.0 | 61.8 | 73.7 | 71.6 | 77.2 |
| DSBench-Hard † | 67.2 | 59.6 | 31.1 | 25.8 | 54.5 | 63.0 | 71.7 | 68.3 |
Key takeaways: DS-V4-Pro-0813 is a substantial jump over the Preview release it replaces -- e.g. DeepSWE 62.7 vs 12.8, Cybergym 83.3 vs 52.7, AutomationBench 31.8 vs 12.8. It now leads or is competitive with GLM-5.2 and Kimi K3 on most agentic/coding benchmarks, and edges out Claude Opus-4.8 on Cybergym and AutomationBench, though Opus-4.8 and Fable-5 still lead on general reasoning (HLE) and full-stack/hard dev tasks. DS-V4-Flash-0731 similarly improves well past its own Preview predecessor while staying far cheaper -- see Pricing.
Pro-0813 outperforms Flash-0731 across every agentic and coding benchmark, with the largest gaps in HLE with tools (60.0 vs 51.5) and DeepSWE (62.7 vs 54.4) -- Flash trades some capability for its ~3x cheaper pricing (across cache-hit, cache-miss, and output rates) and 5x higher concurrency limit (see Pricing).
"(w/ fallback)": Fable 5 ships with a safety mechanism where queries on certain topics are answered by Claude Opus 4.8 instead, tuned conservatively -- Anthropic reports this triggers in under 5% of sessions on average. That's a per-query safety behavior inside Fable 5 itself, unrelated to which subscription plan you're on (see the Claude Code Plans vs. This Setup section above for Fable 5's actual plan-tier access).
†: per the model card, DSBench-FullStack is DeepSeek's internal full-stack development test set, and DSBench-Hard is DeepSeek's internal test set of difficult coding-agent problems -- both are internal (not third-party) benchmarks.
- Node.js ≥ 18 - nodejs.org
- Claude Code installed globally:
npm install -g @anthropic-ai/claude-code
- DeepSeek API key - platform.deepseek.com/api_keys
GUI (persistent):
- Open Start, type
environment→ Edit the system environment variables - Click Environment Variables… → under User variables, click New…
- Variable name:
DEEPSEEK_API_KEY - Variable value:
sk-your-deepseek-api-key - Click OK and restart your terminal
PowerShell (one-liner):
[Environment]::SetEnvironmentVariable("DEEPSEEK_API_KEY", "sk-your-key-here", "User")Add the following to your shell profile (~/.bashrc, ~/.zshrc, or ~/.bash_profile):
export DEEPSEEK_API_KEY="sk-your-deepseek-api-key"Then reload:
source ~/.zshrc # or ~/.bashrc / ~/.bash_profileTwo options per platform - pick whichever fits your workflow.
Place deepseek.bat in a directory on your PATH (e.g. C:\Users\%USERNAME%\bin\) and invoke it from any terminal:
deepseekAdd the deepseek function to your PowerShell profile:
# Open your profile (creates it if missing)
notepad $PROFILE.CurrentUserCurrentHostPaste the contents of Microsoft.PowerShell_profile.ps1 into the file, save, and open a fresh PowerShell window:
deepseekPowerShell sources this profile automatically on startup. The
deepseekfunction sets the required environment variables and launches Claude Code.
Make deepseek.sh executable and place it on your PATH:
chmod +x deepseek.sh
sudo mv deepseek.sh /usr/local/bin/deepseekThen run from any directory:
deepseekPaste the contents of shell-profile.sh into your shell profile (~/.bashrc, ~/.zshrc, or ~/.bash_profile):
# Add to ~/.zshrc (or ~/.bashrc)
cat shell-profile.sh >> ~/.zshrc
source ~/.zshrcThen run from any directory:
deepseekThe shell function sets environment variables in the current session and launches Claude Code. It's lighter than a script - no extra process, no
PATHsetup needed.
Critical. Claude Code defaults to 200K context window for any third-party model it doesn't recognize. Appending [1m] to the model name signals that the model supports a 1-million-token context window:
deepseek-v4-pro → 200K (default)
deepseek-v4-pro[1m] → 1M ✅
The [1m] suffix is stripped before the API request is sent - DeepSeek's servers never see it; they receive deepseek-v4-pro. It is a client-side hint processed exclusively by Claude Code's getContextWindowForModel().
| Variable | Value | Purpose |
|---|---|---|
ANTHROPIC_BASE_URL |
https://api.deepseek.com/anthropic |
DeepSeek's Anthropic-compatible endpoint |
ANTHROPIC_AUTH_TOKEN |
$DEEPSEEK_API_KEY |
Your API key (read from global env var) |
ANTHROPIC_MODEL |
deepseek-v4-pro[1m] |
Primary model - [1m] enables 1M context |
ANTHROPIC_DEFAULT_OPUS_MODEL |
deepseek-v4-pro[1m] |
Model used for Opus-tier requests |
ANTHROPIC_DEFAULT_SONNET_MODEL |
deepseek-v4-pro |
Model used for Sonnet-tier requests |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
deepseek-v4-flash |
Model used for Haiku-tier requests |
ANTHROPIC_DEFAULT_FABLE_MODEL |
deepseek-v4-pro |
Model Claude Code treats as "Fable 5" for its built-in safety-fallback routing on third-party providers -- see note below |
CLAUDE_CODE_SUBAGENT_MODEL |
deepseek-v4-flash |
Faster/cheaper model for subagents |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC |
1 |
Disable telemetry and non-essential network calls |
DISABLE_GROWTHBOOK |
1 |
Disable GrowthBook feature flags |
ANTHROPIC_DEFAULT_FABLE_MODEL: Claude Code has a built-in safety mechanism that reroutes certain flagged prompts to a "Fable 5" fallback model (official docs, see "automatic model fallback"). On third-party providers, this variable tells Claude Code which model ID to use for that reroute. It's not in most third-party setup guides, and if left unset, a flagged prompt on this DeepSeek setup may simply end in a refusal instead of rerouting (per the docs: "When the flagged category has no fallback model... the request ends with the refusal"). Setting it todeepseek-v4-progives it a valid target instead of none -- untested against DeepSeek's own safety behavior, so treat this as a reasonable default, not a guarantee.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICandDISABLE_GROWTHBOOKoverlap: settingCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1already disables GrowthBook feature-flag evaluation as a side effect, making the explicitDISABLE_GROWTHBOOK=1redundant (harmless to keep both). More importantly,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1also disables Claude Code's auto-updater and breaks the--channelscommand as undocumented side effects (anthropics/claude-code#45918, #53899) -- worth knowing since this setup pins a specific version in Troubleshooting below rather than relying on auto-update.
Once Claude Code starts, run /context. You should see:
Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ deepseek-v4-pro
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ 15.2k/1m tokens (1.5%)
If the top bar shows 1m (1 million), you're good to go.
| Issue | Platform | Solution |
|---|---|---|
| Context shows 200K instead of 1M | All | Verify the [1m] suffix is present in ANTHROPIC_MODEL |
| API authentication error | All | Confirm DEEPSEEK_API_KEY is set |
| Windows | echo $env:DEEPSEEK_API_KEY (PowerShell) or echo %DEEPSEEK_API_KEY% (CMD) |
|
| macOS/Linux | echo $DEEPSEEK_API_KEY |
|
claude command not found |
All | Reinstall: npm install -g @anthropic-ai/claude-code@latest (npm install is deprecated since v2.1.15, Jan 2026, in favor of the standalone installer -- npm still works but isn't the primary supported path anymore) |
deepseek not recognized |
Windows (PS) | notepad $PROFILE.CurrentUserCurrentHost - verify the function is in your profile |
| Windows (CMD) | Ensure deepseek.bat is in a directory on your PATH |
|
| macOS/Linux | Run type deepseek to check if the function or script is loaded |
|
| Permission denied (script) | macOS/Linux | chmod +x deepseek.sh |
| Thinking mode not working | All | DeepSeek V4 Pro natively supports thinking - no extra configuration needed |
| File | Platform | Purpose |
|---|---|---|
deepseek.bat |
Windows | Batch launcher for CMD |
Microsoft.PowerShell_profile.ps1 |
Windows | PowerShell function - paste into your profile |
deepseek.sh |
macOS / Linux | Shell script - make executable, place on PATH |
shell-profile.sh |
macOS / Linux | Shell function - paste into .bashrc / .zshrc |
README.md |
All | This document |
MIT - use freely, modify, distribute.