DEV Community

Cover image for How to run DeepSeek Locally in Your Terminal Like a Pro
Aadarsh Nagrath
Aadarsh Nagrath

Posted on

How to run DeepSeek Locally in Your Terminal Like a Pro

If you've been looking for a way to use cutting-edge AI without relying on expensive cloud services, you're in luck! DeepSeek R1 is an open-source reasoning model that runs entirely on your local machine.

With a few simple steps, you can ditch online AI services and gain full control over your own AI assistant. In this guide, I'll show you how to get DeepSeek R1 running in your terminal using Ollama, the easiest way to run open-source models locally.

To follow me -
MY Github, Twitter

Step 1: Install Ollama

Before we can run DeepSeek, we need to install Ollama, which is a tool that lets you download and run AI models with a single command. Here's how you can install it based on your OS:

🖥️ macOS (with Homebrew)

brew install ollama
Enter fullscreen mode Exit fullscreen mode

🖥️ Linux (Debian/Ubuntu)

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

🖥️ Windows (via WSL)

For Windows, you'll need to install Windows Subsystem for Linux (WSL) and then run the Linux installation command inside WSL.

Once installed, restart your terminal and verify the installation by running:

ollama --version
Enter fullscreen mode Exit fullscreen mode

.

Step 2: Download & Run DeepSeek R1

DeepSeek R1 comes in different model sizes, ranging from 1.5 billion to a massive 671 billion parameters. Generally:

  • Smaller models (1.5B - 7B) → Fast but less powerful
  • Larger models (67B - 671B) → Smarter but require high-end GPUs

To get started, let's download and run the 7B model, which is a good balance between performance and intelligence:

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

This command does two things:

  1. Downloads the 7B model (only the first time you run it)
  2. Starts an interactive chat session with DeepSeek R1 in your terminal

If you want a lighter version, you can try:

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

And if you have a powerful setup and want maximum reasoning power, go for:

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

(Just make sure you have enough VRAM, as the largest models require high-end GPUs!)

Step 3: Use DeepSeek R1 in the Terminal

Once the model starts, you'll see a chat-like interface where you can ask it anything:

> How does quicksort work?
Enter fullscreen mode Exit fullscreen mode

DeepSeek will generate a detailed response in real-time!

Customize Your Experience

Ollama provides options to tweak the AI’s behavior. Here are some useful parameters:

.

  • Set a custom system prompt
  ollama run deepseek-r1 --system "You are an expert software engineer. Answer concisely."
Enter fullscreen mode Exit fullscreen mode
  • Use temperature for randomness (higher = more creative)
  ollama run deepseek-r1 --temperature 0.7
Enter fullscreen mode Exit fullscreen mode
  • Limit response length
  ollama run deepseek-r1 --max-tokens 256
Enter fullscreen mode Exit fullscreen mode

Step 4: Run DeepSeek R1 in API Mode

Want to use DeepSeek programmatically? Ollama provides an API mode:

ollama serve
Enter fullscreen mode Exit fullscreen mode

This starts a local API server. Now, you can send requests using cURL:

curl http://localhost:11434/api/generate -d '{"model": "deepseek-r1:7b", "prompt": "Explain recursion."}'
Enter fullscreen mode Exit fullscreen mode

Or integrate it into your Python/Node.js projects.

Conclusion

Congratulations! You just installed, configured, and ran DeepSeek R1 locally in your terminal. Now, you have an open-source AI assistant at your fingertips—no internet, no cloud fees, just raw AI power on your machine.

Go ahead, experiment with different model sizes, tweak the settings, and enjoy the power of local AI! 🚀

Top comments (0)