| 1 | --- |
| 2 | title: "Using Ollama with Continue: A Developer's Guide" |
| 3 | description: "Complete guide to setting up Ollama with Continue for local AI development. Learn installation, configuration, model selection, performance optimization, and troubleshooting for privacy-focused offline coding assistance" |
| 4 | --- |
| 5 | |
| 6 | ## What Are the Prerequisites for Using Ollama |
| 7 | |
| 8 | Before getting started, ensure your system meets these requirements: |
| 9 | |
| 10 | - Operating System: macOS, Linux, or Windows |
| 11 | - RAM: Minimum 8GB (16GB+ recommended) |
| 12 | - Storage: At least 10GB free space |
| 13 | - Continue extension installed |
| 14 | |
| 15 | ## How to Install Ollama - Step-by-Step |
| 16 | |
| 17 | ### Step 1: Install Ollama |
| 18 | |
| 19 | Choose the installation method for your operating system: |
| 20 | |
| 21 | ``` |
| 22 | # macOS |
| 23 | brew install ollama |
| 24 | |
| 25 | # Linux |
| 26 | curl -fsSL https://ollama.ai/install.sh | sh |
| 27 | |
| 28 | # Windows |
| 29 | # Download from ollama.ai |
| 30 | ``` |
| 31 | |
| 32 | ### Step 2: Start Ollama Service |
| 33 | |
| 34 | After installation, start the Ollama service: |
| 35 | |
| 36 | ```bash |
| 37 | # Check Ollama version - verify it's installed |
| 38 | ollama --version |
| 39 | |
| 40 | # Start Ollama (runs in background) |
| 41 | ollama serve |
| 42 | |
| 43 | # Verify it's running |
| 44 | curl http://localhost:11434 |
| 45 | # Should return "Ollama is running" |
| 46 | ``` |
| 47 | |
| 48 | ### Step 3: Download Models |
| 49 | |
| 50 | <Warning> |
| 51 | **Important**: Always use `ollama pull` instead of `ollama run` to download |
| 52 | models. The `run` command starts an interactive session which isn't needed for |
| 53 | Continue. |
| 54 | </Warning> |
| 55 | |
| 56 | Download models using the exact tag specified: |
| 57 | |
| 58 | ```bash |
| 59 | # Pull models with specific tags |
| 60 | ollama pull deepseek-r1:32b # 32B parameter version |
| 61 | ollama pull deepseek-r1:latest # Latest/default version |
| 62 | ollama pull mistral:latest |
| 63 | ollama pull qwen2.5-coder:1.5b |
| 64 | |
| 65 | # List all downloaded models |
| 66 | ollama list |
| 67 | ``` |
| 68 | |
| 69 | **Common Model Tags:** |
| 70 | |
| 71 | - `:latest` - Default version (used if no tag specified) |
| 72 | - `:32b`, `:7b`, `:1.5b` - Parameter count versions |
| 73 | - `:instruct`, `:base` - Model variants |
| 74 | |
| 75 | <Note> |
| 76 | If a model page shows `deepseek-r1:32b` on Ollama's website, you must pull it |
| 77 | with that exact tag. Using just `deepseek-r1` will pull `:latest` which may be |
| 78 | a different size. |
| 79 | </Note> |
| 80 | |
| 81 | ## How to Configure Ollama with Continue |
| 82 | |
| 83 | There are multiple ways to configure Ollama models in Continue: |
| 84 | |
| 85 | ### Method 1: Using Hub Model Blocks in Local config.yaml |
| 86 | |
| 87 | The easiest way is to use [pre-configured model blocks](/reference#local-blocks) from the Continue Hub in your local configuration: |
| 88 | |
| 89 | ```yaml title="~/.continue/agents/My Local Agent.yaml" |
| 90 | name: My Local Agent |
| 91 | version: 0.0.1 |
| 92 | schema: v1 |
| 93 | models: |
| 94 | - uses: ollama/deepseek-r1-32b |
| 95 | - uses: ollama/qwen2.5-coder-7b |
| 96 | - uses: ollama/gpt-oss-20b |
| 97 | ``` |
| 98 | |
| 99 | <Warning> |
| 100 | **Important**: Hub blocks only provide configuration - you still need to pull |
| 101 | the model locally. The hub block `ollama/deepseek-r1-32b` configures Continue |
| 102 | to use `model: deepseek-r1:32b`, but the actual model must be installed: |
| 103 | ```bash |
| 104 | # Check what the hub block expects (view on hub.continue.dev) |
| 105 | # Then pull that exact model tag locally |
| 106 | ollama pull deepseek-r1:32b # Required for ollama/deepseek-r1-32b hub block |
| 107 | ``` |
| 108 | If the model isn't installed, Ollama will return: |
| 109 | `404 model "deepseek-r1:32b" not found, try pulling it first` |
| 110 | </Warning> |
| 111 | |
| 112 | ### Method 2: Using Autodetect |
| 113 | |
| 114 | Continue can automatically detect available Ollama models. You can configure this in your YAML: |
| 115 | |
| 116 | ```yaml title="~/.continue/config.yaml" |
| 117 | models: |
| 118 | - name: Autodetect |
| 119 | provider: ollama |
| 120 | model: AUTODETECT |
| 121 | roles: |
| 122 | - chat |
| 123 | - edit |
| 124 | - apply |
| 125 | - rerank |
| 126 | - autocomplete |
| 127 | ``` |
| 128 | |
| 129 | Or use it through the GUI: |
| 130 | |
| 131 | 1. Click on the model selector dropdown |
| 132 | 2. Select "Autodetect" option |
| 133 | 3. Continue will scan for available Ollama models |
| 134 | 4. Select your desired model from the detected list |
| 135 | |
| 136 | <Note> |
| 137 | The Autodetect feature scans your local Ollama installation and lists all |
| 138 | available models. When set to `AUTODETECT`, Continue will dynamically populate |
| 139 | the model list based on what's installed locally via `ollama list`. This is |
| 140 | useful for quickly switching between models without manual configuration. For |
| 141 | any roles not covered by the detected models, you may need to manually |
| 142 | configure them. |
| 143 | </Note> |
| 144 | |
| 145 | You can update `apiBase` with the IP address of a remote machine serving Ollama. |
| 146 | |
| 147 | ### Method 3: Manual Configuration |
| 148 | |
| 149 | For custom configurations or models not on the hub: |
| 150 | |
| 151 | ```yaml |
| 152 | models: |
| 153 | - name: DeepSeek R1 32B |
| 154 | provider: ollama |
| 155 | model: deepseek-r1:32b # Must match exactly what `ollama list` shows |
| 156 | apiBase: http://localhost:11434 |
| 157 | roles: |
| 158 | - chat |
| 159 | - edit |
| 160 | capabilities: # Add if not auto-detected |
| 161 | - tool_use |
| 162 | - name: Qwen2.5-Coder 1.5B |
| 163 | provider: ollama |
| 164 | model: qwen2.5-coder:1.5b |
| 165 | roles: |
| 166 | - autocomplete |
| 167 | ``` |
| 168 | |
| 169 | ### Model Capabilities and Tool Support |
| 170 | |
| 171 | Some Ollama models support tools (function calling) which is required for Agent mode. However, not all models that claim tool support work correctly: |
| 172 | |
| 173 | #### Checking Tool Support |
| 174 | |
| 175 | ```yaml |
| 176 | models: |
| 177 | - name: DeepSeek R1 |
| 178 | provider: ollama |
| 179 | model: deepseek-r1:latest |
| 180 | capabilities: |
| 181 | - tool_use # Add this to enable tools |
| 182 | ``` |
| 183 | |
| 184 | <Warning> |
| 185 | **Known Issue**: Some models like DeepSeek R1 may show "Agent mode is not |
| 186 | supported" or "does not support tools" even with capabilities configured. This |
| 187 | is a known limitation where the model's actual tool support differs from its |
| 188 | advertised capabilities. |
| 189 | </Warning> |
| 190 | |
| 191 | #### If Agent Mode Shows "Not Supported" |
| 192 | |
| 193 |  |
| 194 | |
| 195 | 1. First, add `capabilities: [tool_use]` to your model config |
| 196 | 2. If you still get errors, the model may not actually support tools despite documentation |
| 197 | 3. Use a different model known to work with tools (e.g., Llama 3.1, Mistral) |
| 198 | 4. Alternatively, you can turn on [System Message tools](/features/agent/model-setup#how-system-message-tools-work) |
| 199 | |
| 200 | See the [Model Capabilities guide](/customize/deep-dives/model-capabilities) for more details. |
| 201 | |
| 202 | ### How to Configure Advanced Settings |
| 203 | |
| 204 | For optimal performance, consider these advanced configuration options: |
| 205 | |
| 206 | ```yaml |
| 207 | models: |
| 208 | - name: Optimized DeepSeek |
| 209 | provider: ollama |
| 210 | model: deepseek-r1:32b |
| 211 | contextLength: 8192 # Adjust context window (default varies by model) |
| 212 | completionOptions: |
| 213 | temperature: 0.7 # Controls randomness (0.0-1.0) |
| 214 | top_p: 0.9 # Nucleus sampling threshold |
| 215 | top_k: 40 # Top-k sampling |
| 216 | num_predict: 2048 # Max tokens to generate |
| 217 | # Ollama-specific options (set via environment or modelfile) |
| 218 | # num_gpu: 35 # Number of GPU layers to offload |
| 219 | # num_thread: 8 # CPU threads to use |
| 220 | ``` |
| 221 | |
| 222 | For GPU acceleration and memory tuning, create an Ollama Modelfile: |
| 223 | |
| 224 | ``` |
| 225 | # Create custom model with optimizations |
| 226 | FROM deepseek-r1:32b |
| 227 | PARAMETER num_gpu 35 |
| 228 | PARAMETER num_thread 8 |
| 229 | PARAMETER num_ctx 4096 |
| 230 | ``` |
| 231 | |
| 232 | ## What Are the Best Practices for Ollama |
| 233 | |
| 234 | ### How to Choose the Right Model |
| 235 | |
| 236 | Choose models based on your specific needs (see [recommended models](/customization/models#recommended-models) for more options): |
| 237 | |
| 238 | 1. **Code Generation**: |
| 239 | |
| 240 | - `qwen2.5-coder:7b` - Excellent for code completion |
| 241 | - `codellama:13b` - Strong general coding support |
| 242 | - `deepseek-coder:6.7b` - Fast and efficient |
| 243 | |
| 244 | 2. **Chat & Reasoning**: |
| 245 | |
| 246 | - `llama3.1:8b` - Latest Llama with tool support |
| 247 | - `mistral:7b` - Fast and versatile |
| 248 | - `deepseek-r1:32b` - Advanced reasoning capabilities |
| 249 | |
| 250 | 3. **Autocomplete**: |
| 251 | |
| 252 | - `qwen2.5-coder:1.5b` - Lightweight and fast |
| 253 | - `starcoder2:3b` - Optimized for code completion |
| 254 | |
| 255 | 4. **Memory Requirements**: |
| 256 | - 1.5B-3B models: ~4GB RAM |
| 257 | - 7B models: ~8GB RAM |
| 258 | - 13B models: ~16GB RAM |
| 259 | - 32B models: ~32GB RAM |
| 260 | |
| 261 | ### How to Optimize Performance |
| 262 | |
| 263 | To get the best performance from Ollama: |
| 264 | |
| 265 | - Monitor system resources with `ollama ps` to see memory usage |
| 266 | - Adjust context window size based on available RAM |
| 267 | - Use appropriate model sizes for your hardware |
| 268 | - Enable GPU acceleration when available (NVIDIA CUDA or AMD ROCm) |
| 269 | - Use `ollama logs` to debug performance issues |
| 270 | |
| 271 | ## How to Troubleshoot Ollama Issues |
| 272 | |
| 273 | ### Common Configuration Problems |
| 274 | |
| 275 | #### "404 model not found, try pulling it first" |
| 276 | |
| 277 | This error occurs when the model isn't installed locally: |
| 278 | |
| 279 | **Problem**: Using a hub block or config that references a model not yet pulled |
| 280 | **Solution**: |
| 281 | |
| 282 | ```bash |
| 283 | # Check what models you have |
| 284 | ollama list |
| 285 | |
| 286 | # Pull the exact model version needed |
| 287 | ollama pull model-name:tag # e.g., deepseek-r1:32b |
| 288 | ``` |
| 289 | |
| 290 | #### Model Tag Mismatches |
| 291 | |
| 292 | **Problem**: `ollama pull deepseek-r1` installs `:latest` but hub block expects `:32b` |
| 293 | **Solution**: Always pull with the exact tag: |
| 294 | |
| 295 | ```bash |
| 296 | # Wrong - pulls :latest |
| 297 | ollama pull deepseek-r1 |
| 298 | |
| 299 | # Right - pulls specific version |
| 300 | ollama pull deepseek-r1:32b |
| 301 | ``` |
| 302 | |
| 303 | #### "Agent mode is not supported" |
| 304 | |
| 305 | **Problem**: Model doesn't support tools/function calling |
| 306 | **Solutions**: |
| 307 | |
| 308 | 1. Add `capabilities: [tool_use]` to your model config |
| 309 | 2. If still not working, the model may not actually support tools |
| 310 | 3. Switch to a model with confirmed tool support (Llama 3.1, Mistral) |
| 311 | |
| 312 | #### Using Hub Blocks in Local Config |
| 313 | |
| 314 | **Problem**: Unclear how to use hub models locally |
| 315 | **Solution**: Create a local agent file: |
| 316 | |
| 317 | ```yaml |
| 318 | # ~/.continue/agents/Local.yaml |
| 319 | name: Local Agent |
| 320 | version: 0.0.1 |
| 321 | schema: v1 |
| 322 | models: |
| 323 | - uses: ollama/model-name |
| 324 | ``` |
| 325 | |
| 326 | ### How to Fix Connection Problems |
| 327 | |
| 328 | - Verify Ollama is running: `curl http://localhost:11434` |
| 329 | - Check service status: `systemctl status ollama` (Linux) |
| 330 | - Ensure port 11434 is not blocked by firewall |
| 331 | - For remote connections, set `OLLAMA_HOST=0.0.0.0:11434` |
| 332 | |
| 333 | ### How to Resolve Performance Issues |
| 334 | |
| 335 | - Insufficient RAM: Use smaller models (7B instead of 32B) |
| 336 | - Model too large: Check available memory with `ollama ps` |
| 337 | - GPU issues: Verify CUDA/ROCm installation for GPU acceleration |
| 338 | - Slow generation: Adjust `num_gpu` layers in model configuration |
| 339 | - Check system diagnostics: `ollama ps` for active models and memory usage |
| 340 | |
| 341 | ## What Are Example Workflows with Ollama |
| 342 | |
| 343 | ### How to Use Ollama for Code Generation |
| 344 | |
| 345 | ```python |
| 346 | # Example: Generate a FastAPI endpoint |
| 347 | from fastapi import FastAPI, HTTPException |
| 348 | from pydantic import BaseModel |
| 349 | |
| 350 | app = FastAPI() |
| 351 | |
| 352 | class User(BaseModel): |
| 353 | name: str |
| 354 | email: str |
| 355 | age: int |
| 356 | |
| 357 | @app.post("/users/") |
| 358 | async def create_user(user: User): |
| 359 | # Continue will help complete this implementation |
| 360 | # Use Cmd+I (Mac) or Ctrl+I (Windows/Linux) to generate code |
| 361 | pass |
| 362 | ``` |
| 363 | |
| 364 | ### How to Use Ollama for Code Review |
| 365 | |
| 366 | Use Continue with Ollama to: |
| 367 | |
| 368 | - Analyze code quality |
| 369 | - Suggest improvements |
| 370 | - Identify potential bugs |
| 371 | - Generate documentation |
| 372 | |
| 373 | ## Conclusion |
| 374 | |
| 375 | Ollama with Continue provides a powerful local development environment for AI-assisted coding. You now have complete control over your AI models, ensuring privacy and enabling offline development workflows. |
| 376 | |
| 377 | --- |
| 378 | |
| 379 | _This guide is based on Ollama v0.11.x and Continue v1.1.x. Please check for updates regularly._ |