How to use VS Code with Local Models
Run an LLM on your own machine and wire it into VS Code — private, offline, and free. Two backends, one bridge, about ten minutes.
Ollama
CLI-first and the fastest way to start. One command pulls a model; it serves on a local port.
LM Studio
A point-and-click app. Browse and download models in a GUI, then flip on a local server.
What you need
- VS Code — any recent version.
- ~3 GB free disk for the model download.
- A GPU is optional. The model runs fine on CPU alone; a GPU just makes it faster.
The number that matters most is RAM. qwen3:4b at Q4 needs only about 2.5 GB for the weights, so it fits comfortably on modest machines:
| Tier | RAM | What it runs |
|---|---|---|
| Minimum | 8 GB | qwen3:4b on CPU, thinking mode off |
| Recommended | 16 GB | qwen3:4b with room for longer context |
| Optional GPU | 4 GB+ VRAM | Noticeably faster — not required |
Long context and reasoning mode are what push a 4B model toward needing 16 GB+. For quick tasks, 8 GB is enough.
The Continue bridge
VS Code only talks to GitHub Copilot out of the box. To reach a local model server, you need a connector — Continue, a free extension that plugs any local backend into the editor. Install it once; both options below use it.
# search "Continue" in Extensions, or run:
code --install-extension Continue.continue
Heads-up: Continue is now maintained under Cursor and the open-source repo is frozen at its final release — but it still installs and the local-model path works fully. Cline is the active alternative if you prefer.
Run it with Ollama
# macOS / Linux
curl -fsSL https://ollama.com/install.sh | sh
# Windows: download the installer from ollama.com
ollama pull qwen3:4b
ollama run qwen3:4b # chat here, /bye to exit
Ollama now serves on http://localhost:11434 — that's what Continue connects to.
Open ~/.continue/config.yaml (%USERPROFILE%\.continue\config.yaml on Windows) and add:
models:
- name: Qwen3 4B (Ollama)
provider: ollama
model: qwen3:4b
apiBase: http://localhost:11434
roles: [chat, edit]
Run it with LM Studio
- Install LM Studio from lmstudio.ai.
- In the Discover tab, search
qwen3 4band download the Q4_K_M build.
- Open the Developer / Local Server tab and click Start Server.
- It listens on
http://localhost:1234/v1— an OpenAI-compatible endpoint. Note the model ID it shows.
models:
- name: Qwen3 4B (LM Studio)
provider: lmstudio
model: qwen3-4b # match the ID in LM Studio
apiBase: http://localhost:1234/v1
roles: [chat, edit]
Keep LM Studio's server toggled on while you work — if the server stops, Continue can't reach the model.
Use it in VS Code
- Click the Continue icon in the sidebar and pick your model from the dropdown.
- Ask questions in the chat panel, or reference files with
@filename. - Highlight code and press
Ctrl/Cmd + Ito edit it in place.
That's the whole loop. A private Copilot running on your own hardware — your code never leaves the machine, and there's no API bill.
If it breaks
- “Model not found” → the
model:value must match exactly:ollama listfor Ollama, or the loaded ID for LM Studio. - No reply → the backend isn't running. Start Ollama (tray icon) or LM Studio's server.
- Sluggish or out of memory → turn thinking mode off, shorten the context window, or close other heavy apps.