This guide will help you set up DeepSeek CLI to run completely locally using Ollama, providing free and private AI assistance.
- Free: No API costs or usage limits
- Private: Your code never leaves your machine
- Fast: No network latency for requests
- Offline: Works without internet connection
- Customizable: Full control over models and settings
- Node.js 18+: Download here
- Ollama: Download here
- Sufficient RAM:
- 2GB+ for
deepseek-coder:1.3b - 8GB+ for
deepseek-coder:6.7b(recommended) - 32GB+ for
deepseek-coder:33b
- 2GB+ for
curl -fsSL https://raw.githubusercontent.com/holasoymalva/deepseek-cli/main/install-local.sh | bash-
Install Ollama:
# macOS brew install ollama # Linux curl -fsSL https://ollama.ai/install.sh | sh # Windows: Download from https://ollama.ai
-
Install DeepSeek CLI:
npm install -g run-deepseek-cli
-
Start Ollama:
ollama serve
-
Install DeepSeek Model:
# Choose one based on your system: ollama pull deepseek-coder:1.3b # Lightweight (1GB) ollama pull deepseek-coder:6.7b # Recommended (4GB) ollama pull deepseek-coder:33b # Most capable (19GB)
-
Test Installation:
deepseek chat "Write a hello world function in Python"
Create a .env file in your project or home directory:
# Local mode (default)
DEEPSEEK_USE_LOCAL=true
DEEPSEEK_MODEL=deepseek-coder:6.7b
OLLAMA_HOST=http://localhost:11434deepseekdeepseek chat "Explain how async/await works in JavaScript"deepseek --local --model deepseek-coder:1.3bdeepseek setup# Start Ollama service
ollama serve
# Or run in background
nohup ollama serve > /dev/null 2>&1 &# List installed models
ollama list
# Install missing model
ollama pull deepseek-coder:6.7b# Check if Ollama is accessible
curl http://localhost:11434/api/tags
# Use custom host
deepseek --ollama-host http://192.168.1.100:11434- Use smaller model:
deepseek-coder:1.3b - Close other applications
- Increase system swap space
export DEEPSEEK_USE_LOCAL=true
deepseekexport DEEPSEEK_USE_LOCAL=false
export DEEPSEEK_API_KEY="your-api-key"
deepseek| Model | Size | RAM Needed | Speed | Quality | Best For |
|---|---|---|---|---|---|
deepseek-coder:1.3b |
1GB | 2GB | Fast | Good | Quick completions |
deepseek-coder:6.7b |
4GB | 8GB | Medium | Better | General coding |
deepseek-coder:33b |
19GB | 32GB | Slow | Best | Complex analysis |
Your DeepSeek CLI is now configured to run locally. Enjoy free, private, and powerful AI coding assistance!
For more advanced features and configurations, check the main README.md.