How to Use a Free Local AI in VS Code with Ollama and Continue
Run an AI coding model on your own computer. Your code never leaves your machine. No account, no monthly bill. Ollama runs the model. Continue connects it to VS Code.
In short: install Ollama, run ollama pull qwen2.5-coder:7b, install the Continue extension, and point ~/.continue/config.yaml at Ollama.
Why use a local AI
Some code is private: a bank's code, client data, or code under NDA. A local model keeps it all on your laptop. It also works offline and costs nothing per request. The trade-off: small local models are slower and weaker than big cloud models.
What you need
- Ollama: a free tool that downloads and runs AI models locally. It serves them at
http://localhost:11434. - A coding model: for example
qwen2.5-coder:7bfor chat,qwen2.5-coder:1.5bfor fast autocomplete. - Continue: an open-source extension for VS Code and JetBrains that talks to Ollama.
- Hardware: at least 8 GB RAM (16 GB+ better) and about 10 GB free disk. A GPU makes it much faster.
How it connects
Install steps
- Install Ollama. Windows/Mac: download from ollama.com. Linux:
curl -fsSL https://ollama.com/install.sh | sh. - Check it:
ollama --version. - Make sure it is running:
curl http://localhost:11434should printOllama is running. If not, runollama serve. - Pull the models (use
pull, notrun):ollama pull qwen2.5-coder:7bandollama pull qwen2.5-coder:1.5b. - Check:
ollama listshows both, with the exact tags. - Install Continue: in VS Code press Ctrl+Shift+X, search Continue, install. Or:
code --install-extension Continue.continue. - Open the Continue panel from the Activity Bar.
ollama --version
curl http://localhost:11434
# -> Ollama is running
ollama pull qwen2.5-coder:7b
ollama pull qwen2.5-coder:1.5b
ollama listConfiguration: config.yaml
Open Continue's config (gear icon, or the file ~/.continue/config.yaml). The model name must match ollama list exactly.
name: Local Config
version: 0.0.1
schema: v1
models:
- name: Qwen2.5-Coder 7B
provider: ollama
model: qwen2.5-coder:7b
apiBase: http://localhost:11434
roles:
- chat
- edit
- apply
- name: Qwen2.5-Coder 1.5B
provider: ollama
model: qwen2.5-coder:1.5b
roles:
- autocompleteSettings
- After editing, click Reload config in Continue's config selector.
- Autodetect: instead of listing models, you can set
model: AUTODETECTwithprovider: ollama; Continue lists what you pulled. - “Model requires more system memory” error: add
defaultCompletionOptions: contextLength: 2048under the model, or use a smaller model. - Agent mode needs tool use. Small local models are weak at it; use chat and edit for best results.
- Another PC runs Ollama? set
apiBaseto that machine's address.
First test: a small function
Write a Python function is_palindrome(s) that ignores case and spaces. Only return the code.
A correct answer looks like this. We tested this version:
palindrome.pydef is_palindrome(s: str) -> bool:
"""True if s reads the same both ways, ignoring case and spaces."""
clean = "".join(s.lower().split())
return clean == clean[::-1]test_palindrome.pyfrom palindrome import is_palindrome
def test_yes():
assert is_palindrome("Never odd or even")
def test_no():
assert not is_palindrome("Pune")
def test_empty():
assert is_palindrome("")pytest -q
# -> 3 passedSmall models make more mistakes than big ones. Always run the test.
| Local (Ollama + Continue) | Cloud assistant | |
|---|---|---|
| Privacy | Code stays on your PC | Code goes to the provider |
| Cost | Free after download | Plan or per-token price |
| Quality | Good for small tasks | Stronger on big tasks |
| Speed | Depends on your hardware | Fast |
| Offline | Yes | No |
ollama pull from the official library, and check the exact tag.Quick quiz
1. What does Ollama do?
Downloads and runs AI models on your own computer, at localhost:11434.
2. Which command downloads a model?
ollama pull <model:tag>.
3. Where is Continue's config?
~/.continue/config.yaml.
4. Which role gives fast inline suggestions?
autocomplete, best with a small model like qwen2.5-coder:1.5b.
Save tokens and money
Local models cost no tokens, so use them for practice, boilerplate and private code. Save paid cloud models for hard problems. Keep the context length small for speed.