DEV Community

Gladis Jenkins
Gladis Jenkins

Posted on

Run DeepSeek Locally: A Developer's Guide to Private AI with Ollama

As AI models become more developer-friendly, running them locally has gone from a pipe dream to something you can set up in 10 minutes. DeepSeek's open-source models make this especially practical — here's how to get started.

Why Run DeepSeek Locally?

Before diving into the how, let's talk about the why:

  1. Complete privacy — Your code, your data, your prompts never leave your machine
  2. Zero cost — No API bills, no usage limits, no subscription fees
  3. Offline access — Works without internet, perfect for travel or secure environments
  4. Full control — Choose model size, adjust parameters, integrate however you want
  5. No rate limits — Run as many queries as you need

Hardware Requirements

DeepSeek offers models at various sizes. Here's what you'll need:

Model Size RAM Required GPU (recommended) Disk Space
1.5B 4GB Optional ~1GB
7B 8GB 6GB VRAM ~4GB
14B 16GB 10GB VRAM ~8GB
33B 32GB 20GB VRAM ~19GB
67B 64GB 40GB VRAM ~38GB

For most developers, the 7B or 14B model hits the sweet spot — capable enough for serious coding tasks, but runs smoothly on a modern laptop.

Step 1: Install Ollama

The easiest way to run DeepSeek locally is with Ollama. It handles model downloading, GPU acceleration, and provides a clean CLI.

macOS / Linux:

curl -fsSL https://ollama.com/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Windows:
Download the installer from ollama.com and run it.

Verify the installation:

ollama --version
Enter fullscreen mode Exit fullscreen mode

Step 2: Pull and Run DeepSeek

DeepSeek has several models available through Ollama:

# Pull the 7B model (recommended starting point)
ollama pull deepseek-r1:7b

# Or go bigger if you have the hardware
ollama pull deepseek-r1:14b

# DeepSeek Coder for programming tasks
ollama pull deepseek-coder:6.7b

# DeepSeek V3 for general chat
ollama pull deepseek-v3:7b
Enter fullscreen mode Exit fullscreen mode

Run it immediately:

ollama run deepseek-r1:7b
Enter fullscreen mode Exit fullscreen mode

That's it. You now have a local AI assistant running on your machine.

Step 3: Integrate with Your Dev Tools

VS Code Integration

Use the Continue extension to connect to your local DeepSeek model:

  1. Install Continue from VS Code marketplace
  2. In your Continue config, point it to Ollama:
{
  "models": [{
    "title": "DeepSeek R1 7B",
    "provider": "ollama",
    "model": "deepseek-r1:7b"
  }]
}
Enter fullscreen mode Exit fullscreen mode

Now you have a local, private copilot that costs nothing to run.

API Access

Ollama exposes a local API compatible with OpenAI's format:

import requests

response = requests.post('http://localhost:11434/api/generate', json={
    'model': 'deepseek-r1:7b',
    'prompt': 'Explain the time complexity of quicksort',
    'stream': False
})

print(response.json()['response'])
Enter fullscreen mode Exit fullscreen mode

This means any tool that works with OpenAI's API can be pointed to your local model instead.

Step 4: Choose the Right Model for Your Task

DeepSeek offers different models optimized for different tasks:

  • DeepSeek R1 — Reasoning and logic. Best for debugging complex code, system design, and algorithm optimization.
  • DeepSeek V3 — General chat and writing. Faster responses, great for documentation, code comments, and quick Q&A.
  • DeepSeek Coder — Specialized for code generation and completion. Trained specifically on programming tasks.

For a detailed breakdown of each model's strengths, check out this comprehensive guide.

Performance Tips

After running local models for a while, here's what I've learned:

  • Use quantized models (q4, q5) — Dramatically reduces memory usage with minimal quality loss
  • Enable GPU acceleration — Ollama auto-detects CUDA/Metal, but verify with ollama ps
  • Batch your contexts — Reuse loaded models across multiple queries instead of reloading
  • Monitor temps — Smaller models are fine on laptops, but 33B+ will heat things up

Cloud vs Local: When to Use What

Scenario Best Choice
Quick code generation Cloud (V3 API)
Complex debugging Local (R1 14B+)
Working with sensitive code Local
Building an app with API calls Cloud (cheaper API)
Learning/experimenting Local (free)
Production deployment Cloud API

For most solo developers, the ideal setup is a hybrid approach: use the free cloud version for quick tasks, and run a 7B-14B model locally for deep, private work.

Need help deciding which approach is right for your use case? This comparison covers the trade-offs in detail.


Getting Started Checklist

  • [ ] Install Ollama on your machine
  • [ ] Pull deepseek-r1:7b (or your preferred size)
  • [ ] Test with ollama run deepseek-r1:7b
  • [ ] Set up VS Code Continue extension
  • [ ] Try the API endpoint
  • [ ] Compare results with the cloud version

Local AI isn't just for researchers anymore. With DeepSeek and Ollama, any developer can have a capable AI assistant running entirely on their own hardware. The privacy, speed, and cost benefits make it worth the 10-minute setup.

For the latest installation guides, troubleshooting tips, and model comparisons, deepseekget.com keeps their tutorials up to date with every DeepSeek release.

Are you running AI models locally? Which setup works best for your workflow?

Top comments (0)