Running a DeepSeek model locally with Ollama gives you something the cloud can’t: zero API bill and complete privacy — your code never leaves the machine. Connect it to Claude Code through Claude Code Router and you keep the agent workflow while everything runs offline. It’s the setup to reach for when privacy matters or you want no per-token cost at all.
This covers the install, model choice for your hardware, and the router config. For the trade-offs versus hosted models, read on — they’re real. For hosted DeepSeek, see run DeepSeek V4 with Claude Code.
Step 1: Install Ollama
Download and install Ollama for Windows from its site (it also runs in WSL). Ollama serves models on a local OpenAI-compatible endpoint at http://localhost:11434/v1.
Step 2: Pull a DeepSeek model that fits your hardware
ollama pull deepseek-r1:8b
Test it directly first:
ollama run deepseek-r1:8b
Step 3: Route Claude Code to Ollama
Ollama speaks the OpenAI format, so use Claude Code Router to connect Claude Code:
{
"Providers": [
{
"name": "ollama",
"api_base_url": "http://localhost:11434/v1/chat/completions",
"api_key": "ollama",
"models": ["deepseek-r1:8b"]
}
],
"Router": { "default": "ollama,deepseek-r1:8b" }
}
Then run:
ccr code
Claude Code now runs on your local DeepSeek model, fully offline.
The honest trade-offs
Local DeepSeek vs hosted DeepSeek API
| Cost | Local: no API bill · Hosted: cheap pay-per-token |
|---|---|
| Privacy | Local: fully private · Hosted: sent to provider |
| Quality | Local: lower (smaller model) · Hosted: full model |
| Speed | Local: limited by your GPU · Hosted: fast |
Be realistic: a model that fits your PC is smaller than the hosted DeepSeek, so quality and speed are lower. Local wins decisively on privacy and zero API cost; it doesn’t win on raw capability. For the hardest tasks, the hosted API is cheap enough that many people use local for sensitive work and hosted for everything else.
WSL or native?
Ollama runs on native Windows and in WSL. If your GPU drivers are set up for WSL, either works; native Windows is the simplest for GPU access on most setups. The router config is identical.
Troubleshooting
- Slow or out of memory — the model is too big for your hardware; pull a smaller/quantized variant.
- Claude Code can’t connect — Ollama isn’t running, or the port/URL is wrong.
- Poor results — expected with small local models; escalate hard tasks to the hosted API.
- Config not applied — run
ccr restart.
Local DeepSeek + Claude Code checklist
- Ollama installed and running
- A DeepSeek model pulled that fits your hardware
- Claude Code Router provider pointed at localhost:11434
- Launched with ccr code
- Hard tasks optionally routed to the hosted API
Wrapping up
Running DeepSeek locally with Ollama and Claude Code gives you private, offline coding with no API bill: install Ollama, pull a model that fits your hardware, and route Claude Code to localhost:11434 via Claude Code Router. The trade-off is honest — local quality is lower than the hosted model — so it shines for privacy and free background work, with the cheap hosted API there for hard tasks.
For another local route, see run Qwen3-Coder locally with LM Studio and self-hosted coding agent on Windows.