AI Tools11 min read

DeepClaude: Run Claude Code on DeepSeek for 90% Less

DeepClaude swaps Claude Code's backend to DeepSeek V4 Pro with 4 env vars. The setup, the real quality tradeoff, and when to switch back.

CL

ComputeLeap Team

Share:
DeepClaude shim — Claude Code terminal pointing at DeepSeek V4 Pro endpoint

This morning's #1 story on Hacker News is a four-line shell script. 606 points, 257 comments, and the top reply is the smoking gun: someone cancelled their Claude subscription and switched their entire coding workflow to DeepSeek V4 Pro — same Claude Code CLI, same agent loop, same /resume and sub-agents — for roughly 17× less money per million tokens.

DeepClaude HN front page thread, 606 points and 257 comments — top story of the day

The script lives in a small repo called DeepClaude. It does almost nothing: it sets ANTHROPIC_BASE_URL, sets ANTHROPIC_AUTH_TOKEN to a DeepSeek API key, picks ANTHROPIC_MODEL=deepseek-v4-pro, and runs a tiny Node proxy that forwards Claude Code's tool calls to DeepSeek's Anthropic-compatible endpoint. That's the whole thing.

aattaran/deepclaude GitHub repo — 'Same UX, 17x cheaper' tagline
📊 The pricing gap that started the run on the bank. Claude Sonnet 4.6 lists at $3/M input, $15/M output. DeepSeek V4 Pro lists at $0.27/M input, $1.10/M output — and $0.014/M on a cache hit, which is the path you actually take in an agent loop where the system prompt and file context get re-sent every turn. The math comes out to 90%+ savings on a normal day and 99%+ on cache-heavy sessions.

Pair this with Hmbown/DeepSeek-TUI, which picked up +1,277 stars in 24 hours as the Rust-native sibling of DeepClaude, and you have today's actual story: the agent loop and the model are now decoupled. The harness is one product. The brain is another. You can swap them.

This guide is the four-line shim, the real quality tradeoffs nobody on Twitter is being honest about, and the cases where you should pay full freight to Anthropic anyway. If you've been reading our Run Claude Code for 99% Less guide, this is the 2026-05 sequel — the local-Ollama path is still valid, but DeepClaude is the cloud path that finally makes sense.

The Four-Line Shim, In Full

DeepSeek shipped an Anthropic-compatible endpoint at api.deepseek.com/anthropic. It speaks the same JSON schema Claude Code expects: same tool-call format, same streaming chunks, same messages array. Claude Code already respects the ANTHROPIC_BASE_URL env var (this isn't a hack — it's documented behavior the DeepSeek docs walk through and Anthropic has tolerated since the API was published).

DeepSeek's official Claude Code integration documentation page

So the entire shim is:

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-...your-deepseek-key...
export ANTHROPIC_MODEL=deepseek-v4-pro
claude

That's it. Claude Code launches. The CLI doesn't know it's not talking to Anthropic. Tool calls work. File edits work. /resume, sub-agents, MCP servers — all of it works, because none of those features live on the model side. They live in the harness, and the harness is unchanged.

💡 What deepclaude adds on top of the env vars. The repo's actual binary is a ~50-line Node HTTP proxy. It's not strictly required for normal coding sessions — the env vars alone work. The proxy exists for two narrow cases: (1) routing Claude Code's WebSocket bridge auth back to Anthropic so remote-task features keep working, and (2) injecting per-subagent model overrides so you can keep Opus for planner sub-agents and use V4 Pro for the worker loop. If you don't use either, skip the proxy.

Setup In Two Minutes

1. Get a DeepSeek API key

Go to platform.deepseek.com, sign up (Google login works), top up $5 of credits. The same key works for direct API calls and for the Anthropic-compatible endpoint — DeepSeek doesn't make you mint a separate one.

2. Pick your model

DeepSeek exposes two relevant models through the Anthropic shim:

ModelInputCache hitOutputWhen to pick
deepseek-v4-pro$0.27/M$0.014/M$1.10/MDefault. SWE-bench-Verified parity with Claude Opus 4.6.
deepseek-v4-flash$0.14/M$0.030/M$0.28/MFast, smaller, surprisingly good for read-edit-test loops.

Source: DeepSeek pricing docs. The cache-hit price is the one to internalize — agent loops re-send the same system prompt and tool definitions every turn, so after the first request you spend almost all your input budget at cache rates.

3. Set the env vars

The minimal version, for a single shell session:

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-deepseek-...
export ANTHROPIC_MODEL=deepseek-v4-pro

If you want the assignment to stick across sessions, drop those into ~/.zshrc or ~/.bashrc. If you want to keep your Anthropic-key setup AND have a one-command toggle, save the block to ~/.deepclaude and source ~/.deepclaude when you want DeepSeek; unset the three vars (or open a new shell) when you want Anthropic back.

4. Run Claude Code

claude

That's the entire migration. The /model command inside Claude Code will now show deepseek-v4-pro instead of claude-sonnet-4-6. Type /cost mid-session to verify you're paying DeepSeek prices.

⚠️ One gotcha: subagent routing. Claude Code's sub-agents inherit the model setting from ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL. If those are unset, sub-agents fall back to whatever the harness was compiled with — which means a sub-agent might silently try to call claude-opus-4-7 on the DeepSeek endpoint and 404. Set all three to deepseek-v4-pro (or whichever DeepSeek model you want) and the routing settles.
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

The DevTk team has a walkthrough with the same fix if you hit a sub-agent error and need to see the env-var matrix laid out.

Where DeepSeek V4 Pro Actually Wins And Loses

This is the part the four-line shim crowd is glossing over. Same harness does not mean same code quality. Here's what the public benchmarks and our own dogfooding show.

What V4 Pro matches or wins on

  • SWE-bench Verified: V4 Pro scores 80.6 vs Claude Opus 4.7's 80.8 — within the noise floor (buildfastwithai analysis). On Sonnet 4.6, the comparison isn't even close: V4 Pro pulls ahead on most coding subsets.
  • Terminal-Bench: V4 Pro 67.9% vs Claude Sonnet 4.6 65.4% (benchlm.ai). Shell-driven workflows actually run slightly better on DeepSeek.
  • LiveCodeBench: V4 Pro 93.5% vs 88.8% for Claude. Competitive-programming-style problems favor DeepSeek.
  • Single-file edits, narrow refactors, regex, SQL, dependency upgrades: essentially indistinguishable. We did 50+ of these on both endpoints. Neither was reliably better.

What V4 Pro loses on

  • Multi-file architectural reasoning. When the task requires holding a 6-file mental model and proposing a coordinated change, Claude Opus 4.7 still produces cleaner plans. AkitaOnRails's independent benchmark write-up lands the same conclusion: V4 trails on multi-step planning.
  • SWE-bench Pro (the harder version). V4 Pro 55.4 vs Opus 4.7 64.3. The gap widens with complexity.
  • Long-horizon agent loops where the agent has to recover from its own mistakes. V4 Pro is more likely to double down on a wrong path than Claude is.
  • English literary nuance — docstrings, commit messages, design-doc prose. Claude still writes prettier prose.
  • Computer Use tooling. Codex Pro's GPT-5.4 leads Terminal-Bench 2.0 at 77.3% (Builder.io comparison) and Anthropic's Computer Use is more mature than DeepSeek's tool-call recovery. If your loop is browser-driven, this is not the migration for you yet.

The honest verdict: for ~80% of normal coding work, V4 Pro is indistinguishable from Sonnet 4.6 and within a hair of Opus 4.6. For the hard 20% — large refactors, architecture, agent loops that need to self-correct — Claude is still worth the money.

What The Bill Actually Looks Like

Three workload profiles, real numbers (assumes typical agent-loop cache hit ratios of 80%+):

WorkloadSonnet 4.6 / dayV4 Pro / daySavings
Light (5 sessions, 50K in / 10K out each)$1.50$0.1888%
Medium (15 sessions)$4.50$0.5588%
Heavy (40 sessions, longer contexts)$20–40$1.50–3.0092–93%
Power-user "agent ran all day"$80–150$4–895%+

The percentage gap grows with usage because DeepSeek's cache-hit rate dominates the bill once a session is more than a few turns deep. A power user with a $2,000/month Claude API bill is looking at a ~$100/month DeepSeek bill for the same shape of work.

For comparison, the Claude Max subscription at $200/month has hard usage caps that heavy users hit by mid-month. DeepSeek has no rate-limit cliff at that volume.

When You Should NOT Use DeepClaude

Three cases where the savings are not worth it:

1. You're shipping enterprise code with a compliance review. DeepSeek is a Chinese company. Your data goes to servers in China. If your employer has a "no PRC processors" policy, this is a non-starter regardless of how the code reads. Use the Anthropic API directly or the local Ollama path.

2. Your workflow leans heavily on Computer Use or browser-based sub-agents. Codex Pro and Claude both have a real lead here. V4 Pro can call browser tools but its recovery from a mis-click is noticeably worse.

3. You're doing system-design work, not feature implementation. Architecture conversations are where Claude's marginal IQ shows up. A bad architecture suggestion costs days of rework. The $20 you save in tokens isn't worth it.

For everything else — feature work, bug fixes, refactors, scripts, glue code, dotfile tweaks — DeepClaude is the new default.

The Rust-Native Alternative: DeepSeek-TUI

If you don't want Claude Code in the loop at all, Hmbown/DeepSeek-TUI is the Rust binary that ships its own agent loop optimized for DeepSeek V4. It picked up +1,277 stars in a single day because it solved an annoying tax: a single binary, no Node, no Python, ~12MB at idle.

Hmbown/DeepSeek-TUI Rust coding agent on GitHub trending — +1,277 stars in 24 hours

Install:

cargo install deepseek-tui-cli --locked   # provides `deepseek` dispatcher
cargo install deepseek-tui --locked       # provides `deepseek-tui`
deepseek

It exposes its own MCP client, sandbox, sub-agents, and a streaming view of V4's thinking-mode tokens. The aisignal.dev write-up has a clean teardown of the architecture.

Pick DeepClaude if you already love Claude Code's UX and just want to swap the brain. Pick DeepSeek-TUI if you want a tool designed around DeepSeek from the first line — visible thinking-mode streaming, ratatui interface, fast cold start. Both are valid; they're solving slightly different problems.

Why This Matters Beyond Saving Money

The reason this is the #1 HN story today isn't the four-line shim. It's what the four-line shim implies.

For two years, the bull case for the frontier labs was: the model is the product, the harness is a commodity wrapper. Claude Code, Cursor, Codex, Cline — they were viewed as thin shells around the real moat, which was the model.

DeepClaude inverts the polarity. The harness is the product. Claude Code's sub-agents, MCP, /resume, hooks, settings.json, plugins, the IDE integrations — that's the moat. The model is the swappable component. Anthropic now has a product (Claude Code) that runs on a competitor's brain and a competitor's bill, with Anthropic making nothing on the inference. Watch what they do next; the obvious responses are (a) tighten the protocol so swap-in stops working cleanly, or (b) reprice the API so the gap closes.

What's unlikely to happen is the genie going back in the bottle. The Anthropic-compatible API spec is now an industry standard. DeepSeek implements it. OpenRouter implements it. Local Ollama implements it. The contract is too valuable for the rest of the market to abandon — and Anthropic was the one who shipped it.

Bottom Line

If you've been paying $200/month for Claude Max and you do mostly feature-implementation work: try DeepClaude this week. Spend $5 on DeepSeek credits. Set the four env vars. Run a normal day's work through it. If the output quality is acceptable for your tasks, you've just bought yourself an order of magnitude more runway. If it's not, you've spent twenty minutes and five dollars to find out.

Either way, the agent-loop-vs-model decoupling is now real and broadly accessible. The four-line shim is the cleanest demonstration of that we've seen, and it's not going away.


Related on ComputeLeap:

CL

About ComputeLeap Team

The ComputeLeap editorial team covers AI tools, agents, and products — helping readers discover and use artificial intelligence to work smarter.

💬 Join the Discussion

Have thoughts on this article? Discuss it on your favorite platform:

The ComputeLeap Weekly

Get a weekly digest of the best AI infra writing — Claude Code, agent frameworks, deployment patterns. No fluff.

Weekly. Unsubscribe anytime.