DeepCode is an AI coding agent that uses Ollama (local AI models) to help you build REST APIs, apps, and more. It doesn't work as a traditional REST API - instead, it communicates with Ollama running on your machine.
- Download: https://ollama.ai
- Windows: Run installer
- Verify:
ollama --version
cd "c:\Users\Liver\OneDrive\Desktop\DeepCode"
pip install requests rich watchdogollama serveLeave this terminal window open. You should see:
Listening on 127.0.0.1:11434
# Fast model (for quick iterations)
ollama pull qwen2.5-coder
# Powerful model (for complex tasks)
ollama pull deepseek-coder-v2:16b# Navigate to project
cd "c:\Users\Liver\OneDrive\Desktop\DeepCode"
# Run the agent
python deepcode.py┌─────────────────────────────────────────┐
│ Your Task (e.g., "Build REST API") │
└────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ DeepCode Agent (this script) │
│ - Analyzes your task │
│ - Selects appropriate model │
│ - Breaks down into actions │
└────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Ollama Server (localhost:11434) │
│ - Qwen2 model (fast) │
│ - DeepSeek model (powerful) │
└────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ Generated Code & Changes │
└─────────────────────────────────────────┘
You > build a rest api with flask for a todo app
This will:
- Detect it's a simple task → Use Qwen2 (fast)
- Read existing files
- Generate code
- Write files to disk
- Run commands as needed
You > optimize the database queries and add caching
This will:
- Detect it's complex → Use DeepSeek (powerful)
- Analyze your code
- Suggest optimizations
- Implement improvements
These are what DeepCode uses internally:
| Endpoint | Purpose |
|---|---|
GET /api/tags |
List available models |
POST /api/generate |
Generate text (simple) |
POST /api/chat |
Chat interface (advanced) |
Note: These are NOT exposed publicly - only accessible locally at http://localhost:11434
Cause: Ollama server not running or not accessible
Fix:
- Open new terminal
- Run:
ollama serve - Wait for message:
Listening on 127.0.0.1:11434 - Go back to DeepCode terminal and try again
Cause: Model not installed
Fix:
ollama pull qwen2.5-coder
ollama pull deepseek-coder-v2:16bDeepCode automatically chooses the best model:
Uses Qwen2 (⚡ Fast) for:
- "Create a simple REST API"
- "Add error handling"
- "Fix typo in main.py"
- "Update the homepage"
Uses DeepSeek (🚀 Powerful) for:
- "Optimize database performance"
- "Refactor architecture"
- "Add machine learning model"
- "Implement caching system"
Force a specific model:
You > use qwen
You > use deepseek
Enable to have 5 agents work together:
You > multiagent on
Agents:
- Architect: Plans structure and design
- Coder: Writes implementation
- Reviewer: Reviews for bugs
- Tester: Writes and runs tests
- Optimizer: Optimizes performance
See how your code changes:
You > evolution
You > context
Shows:
- Tech stack detected
- Dependencies found
- File structure
- Relevant files
This usually means:
- Ollama server crashed or stopped
- Connection lost between DeepCode and Ollama
- Model was unloaded from memory
Quick fix:
# Terminal 1: Restart Ollama
Stop-Process -Name ollama -Force
ollama serve
# Terminal 2: Run DeepCode again
python deepcode.pySolutions:
- Check if Ollama is responding:
curl http://localhost:11434/api/tags - Restart Ollama
- Check available RAM (models need 4GB+)
- Close other applications
Solutions:
# Remove and reinstall model
ollama rm qwen2.5-coder
ollama pull qwen2.5-coder
# Or restart Ollama
ollama serve| Resource | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB | 8+ GB |
| Disk | 5 GB | 10+ GB |
| CPU | Any | Multi-core |
| GPU | Not required | NVIDIA/AMD |
- Start Ollama:
ollama serve - Run DeepCode:
python deepcode.py - Try a task:
build a simple rest api - Check results: Look at generated files
- View logs: Use troubleshooting guide if issues occur
- See TROUBLESHOOTING.md for detailed fixes
- Type
helpin DeepCode for commands - Check Ollama docs: https://ollama.ai