How to Run DeepSeek-R1 Locally with Ollama: The Complete Developer Setup
This is the DeepSeek-R1-specific path: distilled tags, thinking traces, and Cursor/Roo wiring. For the general Ollama and llama.cpp stack, start with How to Run LLMs Locally. Current Cursor needs a public HTTPS tunnel, not localhost:11434/v1 — use How to Use a Local LLM in Cursor with Ollama for that hop. Card-by-card VRAM picks sit in the GPU guide for local LLMs.
DeepSeek-R1 has shifted the balance for local AI development. By open-sourcing a 671-billion parameter reasoning model alongside highly optimized “distilled” versions (using Qwen and Llama architectures), developers can now run complex reasoning and self-correcting code assistants entirely on consumer hardware.
If you want to run these reasoning models locally with zero data leakage, here is the complete developer setup.
TL;DR: Install Ollama, run
ollama run deepseek-r1:8b(for 16GB RAM machines) orollama run deepseek-r1:14b(for 32GB RAM machines), and point your IDE (Cursor, VS Code, or Roo Code) tohttp://localhost:11434. Read on for exact hardware sizing and configuration tweaks.
Understanding DeepSeek-R1 Sizing & Sizing Matrix
The full DeepSeek-R1 model requires 671 billion parameters (about 720 GB of storage) and a cluster of high-end enterprise GPUs (like 8x H100s). For local use, DeepSeek released distilled models fine-tuned on R1’s reasoning traces.
Here is how the distilled models size up against typical consumer developer hardware:
| Model Tag | Base Architecture | Min VRAM | Min System RAM | Recommended Hardware | Best Use Case |
|---|---|---|---|---|---|
deepseek-r1:1.5b | Qwen-2.5-Math | 2 GB | 8 GB | Standard laptops (MacBook Air, Intel Core i5) | Ultra-fast simple completions |
deepseek-r1:7b | Qwen-2.5 | 6 GB | 16 GB | Gaming laptops, entry M-series Macs | Budget coding companion |
deepseek-r1:8b | Llama-3.1 | 6 GB | 16 GB | RTX 3060/4060, Apple M1/M2/M3 (16GB) | Balanced code & logic |
deepseek-r1:14b | Qwen-2.5 | 10 GB | 32 GB | RTX 4070/4080, Apple M-series (24GB+) | Sweet Spot: Advanced reasoning |
deepseek-r1:32b | Qwen-2.5 | 20 GB | 48 GB | Dual RTX 3090/4090, Mac Studio (64GB) | Deep refactoring & logic |
deepseek-r1:70b | Llama-3.1 | 40 GB | 64 GB | Dual RTX 4090 (48GB VRAM total) | Commercial API competitor |
Tip: For coding tasks, the 14B and 32B parameters distilled models represent the sweet spot, offering robust reasoning, multi-file comprehension, and logical verification without requiring datacenter hardware.
Desk note — who this is for / what it’s bad at: deepseek-r1:8b or :14b for a reasoning loop on a 16–32 GB machine. Bad as a Cursor localhost base URL — current Cursor needs the HTTPS tunnel setup. The 671B full R1 tag is not a desk recommendation for a single consumer card; size discrete GPUs on the GPU guide.
What to check before you pull (or buy)
This page is a tag and wiring guide. The shopping problem is VRAM and unified memory, not a DeepSeek storefront. Before you ollama pull a 20 GB tag or click a GPU search:
- Match the tag to the machine you already own.
:8bis the 16 GB daily driver (MacBook Air, RTX 4060-class, 16 GB unified).:14bwants ~32 GB unified or a 12–16 GB card.:32bis a 24 GB desktop or a Mac Studio-class box.:70bis dual 24 GB or heavy offload — not a “I’ll try it” pull on a laptop SSD. - Disk and the first-run stall.
:8bis ~4.7 GB.:14band:32bare not. Pulling 70B onto a 256 GB laptop is how you discovernode_modulesand the model cannot share a drive. - Do not buy a flagship card for an 8B tag. If
:8balready answers the coding question, a 5090 search is unused VRAM. The honest upgrade path is:14bon a 16 GB card search or a 32 GB laptop, then:32bon a 24 GB / 4090 search. Those are price checks, not ASINs. - Laptop vs desktop. Portable NVIDIA is the developer laptop G14-class problem (watch TGP and VRAM). Apple Silicon is unified memory — a 16 GB Air runs
:8b; it does not run:32bwell. A desktop 24 GB card plus a cheap travel laptop is often saner than one overloaded chassis. - Cursor is a tunnel, not a model pick. Adding
openai/deepseek-r1:8bdoes nothing if the base URL is stilllocalhost. Do the Cursor + Ollama HTTPS hop first. Roo Code / VS Code can stay onhttp://localhost:11434. - If you wanted a cloud brain instead. Local R1 is for air-gap and $0/token after hardware. Quality-per-hour on messy production code is still often Claude in the cloud. Do not buy a 4090 to avoid a $20 chat plan unless privacy or offline is the actual requirement.
Desk note — who this is for / what it’s bad at: Buy (or keep) hardware for the next tag you will run daily, not the 671B press number. Bad at “pull :70b to see” on a 16 GB laptop — you will swap, then blame Ollama. The install-and-runtime stack without the R1-specific traces is the local LLM setup guide.
Step 1: Installing Ollama and Downloading the Model
If you don’t already have Ollama installed, run the official installer command in your terminal:
# macOS or Linux
curl -fsSL https://ollama.com/install.sh | sh
(Windows users can download the installer executable directly from Ollama’s official website).
Once installed, download and run your chosen distilled model size. For a standard 16GB machine, this desk recommends the 8B model — not :32b “to see if it fits”:
ollama run deepseek-r1:8b
During the first run, Ollama will download the model weights (approx. 4.7 GB for the 8B model). Once complete, you will see a chat prompt. You can test the reasoning capabilities by asking a coding logic problem:
>>> Write a python generator that yields Fibonacci numbers but stops if the number is prime.
You will notice the model outputting its reasoning process enclosed in <think>...</think> tags before rendering the final python script.
Desk note — who this is for / what it’s bad at: The chat prompt is a sanity check that weights loaded, not a proof the model is a staff engineer. If nvidia-smi shows no process, you are on CPU and the “25 tokens/s” laptop claim will not apply. Card-by-card VRAM still lives on the GPU guide; this step is pull-and-prompt only.
Step 2: Integrating DeepSeek-R1 with VS Code (Roo Code)
VS Code extensions like Roo Code (formerly Roo Cline) are built specifically to handle agentic workflows. Hooking up local DeepSeek-R1 gives Roo Code a powerful local brain:
- Open VS Code and install the Roo Code extension.
- Open the Roo Code settings panel (gear icon).
- Under API Provider, select Ollama.
- Set the Ollama Base URL to
http://localhost:11434. - Under Model ID, type or select the exact tag you downloaded, e.g.,
deepseek-r1:8bordeepseek-r1:14b. - Ensure the Context Window is set to at least
8192tokens (R1 models support larger context, but local speeds will scale down as context scales up). - Save settings. Roo Code can now execute terminal commands, edit local files, and debug code using local reasoning.
Desk note — who this is for / what it’s bad at: Roo + local R1 for an agent loop that must not leave the building. Bad if you expected Cursor Composer quality on an :8b tag — small distillations complete and reason; they do not replace a cloud model on a 50-file legacy refactor. Keep the context window honest: 8k is usable; 32k on 16 GB will thrash.
Step 3: Integrating DeepSeek-R1 with Cursor
To use local DeepSeek-R1 inside Cursor as your chat or inline editor model, current Cursor builds will not reach http://localhost:11434/v1. Put Ollama behind a public HTTPS tunnel first — the step-by-step is How to Use a Local LLM in Cursor with Ollama. The model-picker notes below stay R1-specific:
- Open Cursor and head to Settings (
Cmd+,orCtrl+,) ➡️ Models. - Click Add Model under the model listing.
- Enter
openai/deepseek-r1:8b(or whichever tag you are running). - Turn on your new model and turn off the other models if you wish to enforce local-only usage.
- Scroll down to OpenAI API Key configuration.
- Toggle the Override OpenAI Base URL option and enter the public HTTPS tunnel
/v1URL from the Cursor + Ollama tunnel setup — nothttp://localhost:11434/v1. - In the API Key field, you can enter any dummy text (e.g.
ollama), as local Ollama calls do not require authentication. - Save settings and open the Chat sidebar. Select your added model from the dropdown.
Desk note — who this is for / what it’s bad at: Cursor + R1 when you already have the tunnel and want the editor to stay local-only. Bad as a weekend project if you have not opened a public HTTPS URL yet — the model picker will save and still fail. If you only needed a cloud tab, that is ChatGPT vs Claude vs Gemini, not this page.
Essential Configuration Tweaks for Reasoning Models
To get the best performance from reasoning models like DeepSeek-R1, you need to adjust a few parameters that differ from standard LLMs:
1. Maintain Low Temperature
Reasoning models perform their own search-like exploration during generation. Setting the temperature too high causes the model’s chain-of-thought to diverge or loop indefinitely.
- Recommended Temperature:
0.0(for math, security audits, and strict code syntax) or0.6(for general software architecture design).
2. Keep the <think> Tags
Many IDE integrations attempt to parse or strip <think> tags because they look like HTML. However, stripping them mid-generation can break the model’s coherence, as the model’s actual answer is dependent on the reasoning traces it just generated. Verify your extension supports “thinking visualization” or lets the traces stream naturally.
3. GPU Offloading (system with dual GPUs)
If you have a dedicated GPU but also integrated graphics, ensure Ollama uses your discrete GPU. You can check which device Ollama is running on by running:
nvidia-smi # For NVIDIA GPUs
If it is not offloading to the GPU, set the environment variable:
OLLAMA_NUM_PARALLEL=1 to optimize VRAM caching.
Desk note — who this is for / what it’s bad at: Dual-GPU and laptop+iGPU boxes that silently land on the weak adapter. Bad as a substitute for buying more VRAM — OLLAMA_NUM_PARALLEL=1 helps caching; it does not turn 8 GB into 24 GB. If the card is the buy, use the GPU buying notes (search links, not invented ASINs).
FAQ: Common Troubleshooting
Why does DeepSeek-R1 loop or repeat itself in chat?
This typically occurs if the temperature is set too high (above 0.7) or if the context window is saturated. Lower the temperature to 0.0 or restart your Ollama model runner to clear the cache.
How do I stop Ollama from running in the background when not in use?
Ollama keeps the model loaded in VRAM for 5 minutes after the last request before unloading it. If you want to force unload it immediately, run:
ollama gc
Can I run DeepSeek-R1 on a standard MacBook?
Yes! Apple Silicon (M1/M2/M3) unified memory makes it exceptionally good at running large local models. A standard 16GB MacBook Air runs the deepseek-r1:8b model at a fast 25+ tokens per second.
For the broader stack, start with our local LLM setup guide and the GPU buying guide for local LLMs. Portable machines are covered in best laptops for developers.
Related Reading
- How to Use a Local LLM in Cursor with Ollama (2026 Tunnel Setup)
- How to Run LLMs Locally: Ollama, llama.cpp, and Hardware Requirements
- The Best GPUs for Running Local LLMs in 2026
- Best Laptops for Developers in 2026
- Best Open Source AI Coding Tools You Can Self-Host
- Cursor vs GitHub Copilot: Which AI Code Editor Wins?
- ChatGPT vs Claude vs Gemini: Which AI Is Best for Developers?