I Pointed Claude Code at DeepSeek for One Project. The Same Task Went From $0.32 to Half a Cent.
Scope Claude Code to DeepSeek for one project and cut costs from $0.32 to $0.005 per task. Real pricing, setup steps, and which projects should never move.
Point Claude Code at DeepSeek for one project using a single file, and nothing else on your machine changes. I ran the same research agent on Claude Opus 5, Kimi K3 and DeepSeek V4-Flash: $0.3183, $0.2485 and $0.0049 for the same task, with DeepSeek also the fastest.
All three passed every capability check. The setup is below, along with which of your projects should move and which should never leave Claude.
Someone repointed their whole machine at a cheap model.
They wanted to save money on a side project. Two weeks later they were wondering why their client work had started producing subtly worse code.
I have argued before that most of this is a workflow problem before it is a pricing problem, and I still think that. Clean up the session first. This post is what you do after that and the bill is still climbing.
They had followed a tutorial. The tutorial was not wrong, exactly. It taught the widest possible version of a thing that should be narrow.
Here is the narrow version. One project talks to DeepSeek. Everything else on your machine carries on exactly as it did.
It takes about four minutes to set up and one line to undo.
I want to be honest about how settled this is, though. People are still working out the sharp edges in public, and I hit five of them writing this. The setup is simple.
Knowing what breaks is the part that took the time.
I also ran the same build three times, on Claude, on Kimi K3 and on DeepSeek, and measured what each one cost. Those numbers are further down and two of them surprised me.
Every cost claim in this space is rate-card multiplication. I ran the same task on three engines and the bill did not match the rate card on any of them.
👋 Julley, I'm Dheeraj, an AI systems builder.
I build production-grade AI systems at work by day and ship my own products by night, 9 and counting, including SubflowAI and the Content OS Agents Toolkit. This newsletter is the bridge between those two worlds. Every system, every build, documented step by step.
Join 2,000+ builders getting the exact AI setups, prompts, and workflows that actually work in your business.
What’s Inside
Three claims almost every version of this post gets wrong
Before any setup, the claims worth correcting.
It is free, right up until it is not.
You will see "run Claude Code for free" everywhere, and most of the people saying it are telling the truth about something. A new API account starts with a credit grant, the chat app costs nothing, and the weights are open.
The API itself needs a balance once that grant runs out. Mine was two dollars, and there is a section just below on which version of free people mean.
It is not always cheaper.
That depends entirely on which Claude model you are comparing against, and most posts pick the flattering one. There is a table below.
Anthropic does not support it.
Not banned, not blessed, and it is worth being precise about that, because Anthropic has enforced against something adjacent. What got blocked was using a Claude Pro or Max subscription to power third-party harnesses.
That is a different thing from what this article does: the official Claude Code client, pointed at a provider you pay directly, with no subscription credential involved. If you saw those headlines and assumed this was the same, it is not.
Their own gateway documentation says they do not support routing Claude Code to non-Claude models through any gateway. It works today.
It can break on any release, and nobody owes you a fix. Anyone who does not tell you that has not read the docs.
Why so many people say DeepSeek in Claude Code is free
DeepSeek is free in four different ways, and only one of them applies to running Claude Code against its API. The chat app costs nothing, a new API account starts with a credit grant, OpenRouter used to host a free variant, and the weights are open.
The chat app is free. DeepSeek's own site has always cost nothing to use. It is a different product from the API, and it is what most people mean.
A new API account starts with a credit grant. DeepSeek's pricing page spends your granted balance before your topped-up one, so the first stretch genuinely costs nothing. It is widely reported as 5 million tokens over 30 days. That figure is not on DeepSeek's own documentation, so treat it as a shape rather than a number.
There was a free DeepSeek on OpenRouter, and every tutorial from that period still says so. Checked on 5 August 2026 against OpenRouter's own model list: 13 DeepSeek models, none of them free. The free slots today belong to Poolside, Cohere, NVIDIA and Gemma.
The weights are open, so it is free if you own the hardware. Same trade as running a local model, with the same hardware bill.
None of those four is Claude Code pointed at the DeepSeek API, which is the thing below. That needs a balance on the account. Mine was two dollars, which is not free and is also not a barrier.
One detail that says more about the status of all this than either vendor's marketing does. DeepSeek publishes an official Integrate with Claude Code page carrying these exact environment variables. Anthropic does not support the arrangement at all.
One side writes it down, the other declines to, and you are standing in the gap between them.
Three of the four are a different product entirely. The one that is about the API runs out, and then the API needs a balance.
Claude Code with DeepSeek setup costs, measured
Real per-million-token prices, read this week from Anthropic's pricing page, DeepSeek's and Moonshot's.
Two points fall out of that table immediately.
The popular claim that a given Chinese model "costs three times less" is usually measured against Fable 5, which is the most expensive model on the list. Against Sonnet 5 the same model can be more expensive. Both statements are true, and only one gets quoted.
And Sonnet 5 is currently on introductory pricing. From 1 September it becomes $3 in and $15 out, which is to the cent what Kimi K3 costs today. If your plan is to save money by leaving Claude, check which Claude you are leaving.
One caveat before you build a budget on that bottom row. DeepSeek has announced a peak/off-peak policy that doubles every billing item between 9:00 and 12:00 and again between 14:00 and 18:00 Beijing time.
It is not live as of this writing and no start date is published, but it would halve the gap overnight. Check the pricing page before you rely on it.
DeepSeek V4-Flash sits in a different bracket entirely. Cached input runs at $0.0028 per million against Sonnet 5's $0.20, roughly seventy times less, and cached input is where an agent spends most of its tokens.
Learn with me: Claude Code Builder cohort
I run the Claude Code Builder cohort on Maven: four weeks, six live sessions, building a real AI system with me. If you would rather build it alongside me than read about it, this is the room.
Each cohort is a small, hands-on group, so seats are limited.
Build it with me, live. See the syllabus →
Why swap the backend instead of switching tools
A fair question before any of this. There are harnesses built for cheap models from the start: OpenCode, Aider, and a few forks of Claude Code that target other providers natively. If price is the whole problem, why not move to one of those?
Because the thing you have invested in is not the model. It is your CLAUDE.md, your slash commands, your subagents, your MCP servers and the habits built around them. Swapping the backend keeps all of it and changes one variable.
Switching harness throws that away and asks you to rebuild it somewhere with fewer tools and a smaller community around them.
The honest exception is if you are barely using any of that. Then a purpose-built tool is a reasonable call and this article is more work than it is worth to you.
Claude Code DeepSeek setup, scoped to one project
You need a DeepSeek API key and about four minutes. Their Anthropic-compatibility guide documents the endpoint and the exact field-by-field support table, which is worth a read before you rely on anything.
The project
I am using a small research agent called scout. It is four files, and each one exists to test something that could plausibly break when you change the model underneath.
scout/
.claude/
CLAUDE.md project rules, so we can check they are still read
agents/researcher.md a subagent, so we can check routing still works
commands/scout.md a slash command
.mcp.json an MCP server, so we can check tools still connect
.env the search API key
briefs/ outputIf your own project has a CLAUDE.md, slash commands, subagents or MCP servers, this is the interesting question: do they survive the swap? Short answer, yes, all of them. Longer answer below.
Point it at DeepSeek
ANTHROPIC_BASE_URL tells Claude Code which API endpoint to send requests to. It defaults to Anthropic's own, and pointing it elsewhere is the single change that makes Claude Code talk to a different provider. Everything else here is scoping.
Create .claude/settings.local.json inside the project:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-your-deepseek-key",
"ANTHROPIC_MODEL": "deepseek-v4-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "deepseek-v4-pro",
"CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1000000"
}
}That file is the whole trick. Claude Code treats `settings.local.json` as personal, machine-local config.
Add it to your .gitignore yourself.
The automatic exclusion applies when Claude Code creates the file; you are hand-creating this one and pasting a key into it, so do not assume you are covered, and because it lives in the project it applies to this folder and nothing else.
Do not stop after the first three lines.
Most guides show base URL, token and model, then move on. The four below them cover background tasks and subagents.
Leave them out and those paths ask DeepSeek for a model called claude-haiku-something. DeepSeek does not reject it. Their docs are explicit that an unrecognised model name is silently remapped to deepseek-v4-flash, so the call succeeds against a model you did not choose.
No error, no warning, and the only symptom is output that is subtly worse than you expected. That is harder to debug than a crash would be.
Confirm the swap took
Restart Claude Code and run /status.
Three lines matter there. The base URL is DeepSeek. The model is deepseek-v4-flash.
And Setting sources: User settings, Project local settings is the proof that the project file did it, not a global change.
/model will not list DeepSeek, and this catches everyone. The picker is a fixed list of Claude aliases and always has been. /status is the only thing that tells you the truth here.
Now open any other project on your machine and run /status there. Still Claude. That is the entire point.
Run it on something real
That is DeepSeek driving Claude Code: the slash command firing, the researcher subagent spawning, the live token counter ticking. The clip stops part way through. The full task took 106 seconds.
The measured results
Same project, same prompt, run three times back to back on 4 August 2026.
Kimi landed at 78% of Claude, not the 60% its pricing page implies. The cache rows are why.
The cheapest was also the fastest.
DeepSeek finished in half Claude's time and a quarter of Kimi's. If you expected cheap to mean slow, it does not, at least not here.
Half a cent. A full multi-source research task with a subagent and ten searches cost less than one cent on DeepSeek and thirty two on Opus 5.
And Kimi came in at 78% of Claude, not the 60% its pricing page implies. Look at the cache rows for why. Claude read 129,561 tokens from cache and paid fresh input on eight. Eight.
Kimi read 51,712 from cache and paid fresh on 34,458. The caching behaviour decided that bill, not the rate card. Anyone quoting a blended saving off a pricing page is quoting a number that will not survive a real run.
Prices here move faster than most people track, and a billing change can rewrite your assumptions overnight. One warning if you go measuring this yourself.
Claude Code's own cost readout is wrong on third-party providers. It reported $1.09, $0.63 and $0.79 for those three runs, which is Anthropic's price list applied to somebody else's tokens. Take the token counts and multiply by your provider's actual rates.
Getting this wrong cost me real money before it taught me anything. One run in the wrong folder read 215,495 tokens of memory it did not need and billed $2.50 for a task that should have cost half a cent.
An unbudgeted search agent then burned 64% of a monthly quota in four days. Both were configuration, both failed silently, and both are written up below so they cost you nothing.
If that is the kind of thing you want more of, there is a bundle of the actual working files further down.
What survived, and what did not
Everything structural survived. The slash command fired, the project rules were followed to the letter, the subagent routed, and the MCP server connected on all three providers. You are swapping an engine, not rebuilding the car.
Four did not, and all four fail quietly:
DeepSeek cannot see images. Not degraded, unsupported. No screenshots, no designs, no visual debugging. For a lot of people that ends the conversation before price enters it.
Subagents fail silently without those model pin variables. No error. They never run.
Tool errors do not surface. DeepSeek ignores the error flag on tool results, so a failed command comes back unflagged and the model carries on as though it worked.
An unrecognised model name is silently remapped. Their docs say it plainly: pass a name DeepSeek does not know and the backend quietly serves you
deepseek-v4-flashinstead. This is the source of most "why did it suddenly get dumber" posts.
Everything structural passed 6/6 on all three providers. The four that did not throw no error at all.
What I got wrong about
Twice during this I nearly published "MCP is broken on third-party providers". Both times I was wrong, and the second time I was one paragraph from writing it up.
The first cause was that a fresh config identity has not approved a project's MCP servers, so a scripted run silently gets no tools. The second was my own subagent definition listing the wrong tools, so it could never reach the search tool on any provider, including Claude.
Both presented as a provider limitation. Neither was. The lesson I am taking from it is that when a cheap model fails at something Claude manages, the first hypothesis should be your configuration, not the model.
It was my configuration both times.
The result I did not expect
Partway through this I discovered my own agent was broken. The subagent's definition listed the wrong tools, so it could never reach the search tool on any provider.
Claude improvised around it. It found another route, produced a perfectly reasonable brief, and the bug stayed invisible.
Kimi stopped and reported the failure. DeepSeek stopped in 106 seconds and said it was refusing to write a brief with invented claims.
The project rules say exactly that: if the subagent returns nothing, stop and say so. Two of the three followed the spec. The expensive one did not, and looked better for it. Had I only tested on Claude, I would have shipped a broken agent and never known.
That is worth sitting with if you are choosing a model for anything unattended.
So which projects should move to DeepSeek with Claude Code?
This is the part that decides whether any of it was worth doing, and the part almost nobody covers. There is one rule underneath it:
If checking the answer is cheaper than producing it, move the work. If checking costs more than producing, keep it on Claude.
A test suite is a cheap checker. A thirty-second diff is a cheap checker. A clickable source URL is a cheap checker.
"It looks plausible and I would have to redo the thinking to know" is an expensive one, and expensive checkers are exactly where a cheap model quietly costs more than it saved.
Run that rule over your own work and the shape appears fast. Bulk mechanical jobs move well. Anything visual cannot move to DeepSeek at all.
Long unattended runs and production refactors should stay where they are.
But the move most people miss is that you do not pick a model per project. You pick one per stage. Plan on Claude and execute cheap. Draft cheap and review on Claude.
That one reframe saves more than any provider switch, and it is not about price at all.
What the rest of this builds
The rest of this post is the working version:
every way to scope a swap of Claude Code with models like DeepSeek, Ollama, Kimi K3, etc..
the precedence model that explains why a config gets ignored,
the Kimi and Ollama setups,
the six silent failures with how to spot each one,
and the routing framework in full.
🎁 Paid subscribers also get the files behind it: the demo project itself so you can clone and run it, the measurement harness that produced the cost table, and the preflight script that refuses to let you run a comparison that would quietly compare a model against itself.
Let's get into it.












