Code with a local AI model: Ollama + Continue in VS Code
Updated
This page only uses information from Ollama’s docs (the macOS, Windows, context length and FAQ pages and the download page) and from Continue’s docs (the Ollama guide, Ollama provider, autocomplete, install and quick start pages), checked on October 18, 2026. Both tools change often, so check those pages if a screen looks different.
What is a local model, and when is it worth it?
A local model is an AI model that runs on your own computer, not on a company’s servers. Ollama downloads the model and runs it. Continue is a VS Code extension that sends your requests to it: chat, edits and autocomplete while you type.
It is worth it when you care about:
- Privacy. Ollama’s FAQ says it runs locally and does not see your prompts or data when you run locally.
- Working offline. After the downloads, the model runs on your machine. Continue’s guide presents this setup as a way to code offline.
- No charge per use. There are no credits or tokens to buy for the local model. You can send as many messages as you like.
And the limits:
- It is slower. Ollama’s download page puts it plainly: speed depends on the hardware, and large models are slow on a computer without a strong graphics card.
- It is less capable. The models that fit on a laptop are smaller than the big cloud models. Even for autocomplete, Continue’s docs say closed models are slightly better than open ones.
- It depends on memory. The model and its context must fit in your RAM or in your graphics card’s memory. If they don’t, it runs very slowly or doesn’t start.
Hit your Claude Code usage limit? A local model is a free fallback for small jobs while you wait for the reset, with the limits above. To see what is using your Claude limit, read Claude Code usage limit draining fast?
Before you start: what do you need?
From Continue’s Ollama guide:
- macOS, Linux or Windows.
- At least 8 GB of RAM, 16 GB or more recommended.
- At least 10 GB of free disk space.
- VS Code, where you will install Continue.
From Ollama’s system requirements:
- Mac: macOS Sonoma (14) or newer. Apple M series chips use both processor and graphics; Intel (x86) Macs run on the processor only (docs).
- Windows: Windows 10 22H2 or newer, Home or Pro. With an NVIDIA card, driver 551.61 or newer. With an AMD Radeon card, a driver with ROCm v7 or Vulkan support (docs).
Not sure your computer can handle it? Pick your Mac chip or graphics card in the local LLM calculator and it shows which models fit in your memory and how fast they should run, as an estimate.
1. Install Ollama
Go to ollama.com/download and pick your system.
- Mac: open the downloaded file and drag Ollama into the Applications folder. On first start, Ollama checks that the
ollamacommand works in the terminal and asks permission to set it up if needed. - Windows: run
OllamaSetup.exe. It installs in your user folder without Administrator rights. After that, Ollama runs in the background and theollamacommand works in cmd, PowerShell or any terminal.
The download page also shows a one-line install for the terminal (curl -fsSL https://ollama.com/install.sh | sh on macOS and Linux, irm https://ollama.com/install.ps1 | iex in Windows PowerShell). Either way works.
Ollama can also run cloud models, whose names end in :cloud. Those run on Ollama’s servers, not on your computer. This guide only uses local models.
2. Download the models
Open a terminal and download two models:
ollama pull gpt-oss:20b
ollama pull qwen2.5-coder:1.5b
gpt-oss:20bis for chat and edits. It is our example, chosen only for its memory size and its 128K context; Continue’s docs do not recommend it. Its file is 13.79 GB, and by the calculator’s formulas it needs about 14.9 GB at a 4k context and 16.4 GB at 64k: a graphics card with 16 GB or a Mac with 24 GB or more. For another machine, the calculator shows which models fit, such asqwen3-coder:30bordevstral-small-2:24b, with their download commands.qwen2.5-coder:1.5bis only for autocomplete. Continue’s autocomplete page recommends it for local autocomplete, which needs to be fast.
Two rules from Continue’s guide:
- Use
ollama pull, notollama run.runopens a chat in the terminal, which Continue doesn’t need. - Use the exact tag.
ollama pull qwen2.5-coderwithout:7bdownloads:latest, which may be a different size from the one your config expects.
With less memory than that, gpt-oss:20b does not fit. The calculator shows smaller options for your machine. Keep in mind that the Qwen2.5-Coder models accept at most 32K tokens of context.
3. Check that Ollama is running
ollama list
curl http://localhost:11434
ollama list shows the models you downloaded. curl should answer Ollama is running. That address, http://localhost:11434, is where Continue talks to Ollama.
If curl can’t connect, start Ollama with ollama serve (or open the Ollama app) and try again.
4. Install Continue in VS Code
From Continue’s install page:
- Click Install on the Continue extension page in the Visual Studio Marketplace.
- VS Code opens the same page. Click Install again.
- The Continue logo appears in the left sidebar. Continue suggests moving it to the right sidebar, so it sits next to your code.
5. Point Continue at Ollama
Continue reads its settings from a file called config.yaml (its Ollama guide shows it at ~/.continue/configs/config.yaml). Put the two models in it:
name: Local Config
version: 0.0.1
schema: v1
models:
- name: gpt-oss 20B
provider: ollama
model: gpt-oss:20b
roles:
- chat
- edit
- apply
- name: Qwen2.5-Coder 1.5B
provider: ollama
model: qwen2.5-coder:1.5b
roles:
- autocomplete
provider: ollamatells Continue to use your local Ollama athttp://localhost:11434.modelmust match exactly whatollama listshows.rolessays what each model does. gpt-oss 20B handles chat, edits and applying changes; Qwen2.5-Coder 1.5B only handles autocomplete. If you pick another chat model in the calculator, changenameandmodelto its tag.
Shortcut: autodetect. Instead of listing models one by one, you can let Continue read what Ollama has:
models:
- name: Autodetect
provider: ollama
model: AUTODETECT
roles:
- chat
- edit
- apply
- rerank
- autocomplete
Continue then fills the model list with whatever ollama list shows. You can also pick Autodetect in Continue’s model selector. Roles that the detected models don’t cover have to be set by hand.
Agent mode needs a model that supports tools. If Continue says “Agent mode is not supported”, add capabilities: [tool_use] to the model. If it still fails, the model may not really support tools, and Continue suggests trying another model.
6. Set the context size
The context is how much text the model keeps in memory at once: your question, the code Continue sends along and the answer so far. From Ollama’s context length page:
- Ollama picks the default by your graphics card’s memory (VRAM): 4k tokens with less than 24 GiB, 32k from 24 to 48 GiB, 256k with 48 GiB or more.
- For coding tools and agents, Ollama recommends at least 64,000 tokens.
- Some models accept less. Qwen2.5-Coder is limited to 32K tokens, so it cannot use 64,000; gpt-oss:20b accepts up to 128K.
- A larger context needs more memory.
To change it, move the context slider in the Ollama app settings, or start Ollama from the terminal with:
OLLAMA_CONTEXT_LENGTH=64000 ollama serve
Then check with ollama ps: the CONTEXT column shows the context in use, and PROCESSOR shows whether the model is all on the graphics card (100% GPU) or partly on the processor.
How much extra memory does 64k need? It depends on the model: by the calculator’s formulas, gpt-oss:20b goes from about 14.9 GB at 4k to 16.4 GB at 64k. The calculator has a context selector (4k, 32k and 64k) and recalculates which models still fit.
7. Test chat, edit and autocomplete
Following Continue’s quick start:
- Autocomplete: create a file, type a comment such as
// TODO: sort this list, press Enter and wait for the suggestion. Press Tab to accept. - Edit: select a function and press Cmd + I (Mac) or Ctrl + I (Windows and Linux). Type what you want changed. Continue shows a diff so you can accept or reject each change.
- Chat: press Cmd + L or Ctrl + L to open a chat with the selected code and ask a question about it.
The first answer can take longer, because Ollama has to load the model into memory first. Ollama then keeps it loaded for a while, so the next answers start faster (FAQ).
Common problems
“404 model not found, try pulling it first”
The model in your config isn’t downloaded, or the tag doesn’t match. Run ollama list, then download the exact tag, for example ollama pull gpt-oss:20b. Remember that ollama pull qwen2.5-coder without a tag downloads :latest.
“Model requires more system memory”
Continue may ask for a larger context than other tools do, and the model no longer fits. Continue’s fix is to lower contextLength in the model settings:
defaultCompletionOptions:
contextLength: 2048
Or use a smaller model. The calculator shows which ones fit.
It is very slow
Run ollama ps and look at the PROCESSOR column. 100% GPU means the whole model is on the graphics card. Something like 48%/52% CPU/GPU means part of it didn’t fit and went to system memory, which is slower. Ollama’s advice is to avoid offloading to the CPU. Try a smaller model, a smaller quantization or less context.
On a Mac, part on the CPU means the model went past the share of memory the graphics part uses. The calculator assumes 2/3 of the RAM up to 36 GB and 3/4 from 48 GB (an assumption, not an Apple number). The mlx-lm README shows how to raise that limit: sudo sysctl iogpu.wired_limit_mb=N, with N larger than the model in MB but smaller than your Mac’s memory. Or choose a smaller model or a smaller context.
Autocomplete does nothing
From Continue’s autocomplete troubleshooting:
- Check that Enable Tab Autocomplete is on (click Continue in the VS Code status bar).
- Turn off other completion tools, such as Copilot, because they can interfere.
- Check that
editor.inlineSuggest.enabledis on in VS Code settings.
Using a Mac? There is another way
If you prefer a desktop app with its own chat window, LM Studio on a Mac shows how to run a model on Apple Silicon. LM Studio can also serve the model to other tools, including Continue.
Questions people ask
Is it really free to use?
There is no charge per message or per token, because the model runs on your own computer. The cost is your hardware and the time it takes to answer. Ollama also offers cloud models (their names end in :cloud); those run on Ollama's servers and are not what this guide sets up.
How much memory do I need?
Continue's Ollama guide asks for at least 8 GB of RAM, recommends 16 GB or more, and at least 10 GB of free disk. The exact amount depends on the model and the context size. The chat model in this guide, gpt-oss:20b, is a 13.79 GB file and needs about 14.9 GB at a 4k context by our formulas, so a 16 GB graphics card or a Mac with 24 GB or more. The local LLM calculator shows which models fit your Mac or graphics card.
Which model should I use for autocomplete?
Continue's autocomplete page recommends Qwen2.5-Coder 1.5B for local autocomplete, with the 7B as an alternative. It does not recommend thinking models for autocomplete, because they generate more slowly. In this guide, Qwen2.5-Coder 1.5B is only used for autocomplete.
Does it work without internet?
You need internet to download Ollama, Continue and the models. After that, the model runs on your computer. Continue's guide describes the setup as a way to code offline.
Does Ollama see my code?
Ollama's FAQ says it runs locally and does not see your prompts or data when you run locally. Cloud models are different, because they run on Ollama's servers.
Can I use Continue's Agent mode with a local model?
Only with a model that supports tools (function calling). If Continue says "Agent mode is not supported", add capabilities with tool_use to the model in config.yaml. If it still fails, Continue's docs say the model may not really support tools, so try another one.
Should I use Ollama or LM Studio?
Both run models on your computer. This guide uses Ollama because Continue's docs have a full Ollama guide. On a Mac, LM Studio adds a chat window and can also serve models to other tools; see the LM Studio guide.
New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe