A local ai coding assistant ollama setup lets you get code completions and chat help without sending your source code to a cloud server. With Ollama running models on your own machine and the Continue extension inside VS Code, you can ask questions about your code, generate functions, and refactor files while your code stays local. This guide walks through the full setup, from install to daily use.
Local models are not as strong as the best cloud models, and that trade-off is the whole point of this guide. You give up some raw skill in exchange for privacy, offline use, and no per-token bill. For many everyday tasks, such as writing boilerplate, explaining a function, or drafting tests, a good local model is enough. For hard design problems, you can still turn to a cloud tool when you need it.
What You Need Before You Start
You need a machine with enough RAM to hold a code model, VS Code, and a stable internet connection for the first download. A model in the 7 to 8 billion parameter range usually needs around 8 GB of free RAM, while smaller 3 billion parameter models can run on less. A machine with a discrete GPU will answer faster, but a modern CPU-only laptop can still work for chat and short completions if you pick a small model.
Check your disk space too. Model files are several gigabytes each, and it is easy to end up with three or four models before you settle on one. Start with one model, learn how it behaves on your code, and only then try a second one. If you want a deeper comparison of local runtimes first, our guide to Ollama versus LM Studio and llama.cpp lays out where each runtime fits.
Install Ollama and Pick a Model
Download Ollama from its official site and install it for your operating system. On macOS and Windows it ships as a normal app, while on Linux you install it from the official install script. Once it runs, check that the service is up by opening a terminal and asking for the version.
ollama --version
ollama pull qwen2.5-coder:7b
ollama run qwen2.5-coder:7b
The pull command downloads the model, and the run command starts a short chat session so you can check that it answers. Qwen2.5-Coder in the 7B size is a solid starting point for a local coding assistant, and smaller sizes exist if your machine struggles. Our roundup of open source models for self-hosting covers other options, including Llama and Mistral variants, if you want to compare before you commit to one model.
Local AI Coding Assistant Ollama: Wiring Up Continue
Continue is a free VS Code extension that adds a chat panel and inline completions, and it can point at Ollama instead of a cloud API. Install it from the VS Code marketplace, open the Continue panel, and add Ollama as a provider. A basic ollama continue setup takes only a few minutes, and most of the work is choosing the right model names.
Open the Continue config file and add a model block that points at your local Ollama server. The default Ollama address is http://localhost:11434, and Continue reads that address unless you change it. Here is a minimal example to start from:
models:
- name: Qwen2.5-Coder 7B (local)
provider: ollama
model: qwen2.5-coder:7b
apiBase: http://localhost:11434
roles: [chat, edit, apply]
Save the file, reload the Continue panel, and pick the new model from the model list. Ask it a simple question about a file you have open, such as what a function does. If it answers with the right context, the wiring works. If it answers in general terms, check that the model name matches exactly what Ollama has installed, since a small typo in the name is the most common failure.
Configure Continue for Your Project
Once the basic link works, tune it for real work. Add a second, smaller model for fast autocomplete, and keep the larger model for chat and edits. Continue lets you set different models for chat, edit, and autocomplete, so a quick model can handle keystrokes while a stronger model handles questions.
Point Continue at your project docs as well. A short context file that names your stack, your test command, and your folder layout helps the assistant give answers that fit your project instead of generic advice. Keep that file short. Ten lines of real project facts beat fifty lines of vague guidance. For a broader look at what local inference can do, see our local LLM inference benchmark guide, which compares Ollama with vLLM and llama.cpp on speed and memory use.
Daily Habits That Keep Suggestions Useful
A local coding assistant works best when you treat it as a junior pair, not as an oracle. Ask it to explain code before you ask it to change code, and read every edit it makes before you accept it. The model will sometimes invent a function that does not exist or call an API with the wrong arguments, and a quick read catches those slips.
Keep your requests small and specific. Ask for one function at a time, name the file it belongs in, and say what the function should return. Big, open-ended requests produce big, vague answers that take longer to fix than to write by hand. An ollama code assistant also improves a lot when you paste the error message with the failing code, instead of describing the error from memory.
When Local Models Struggle
Local models struggle most with large refactors, unfamiliar libraries, and code that spans many files. They can lose track of a plan halfway through a long edit, and they may repeat a pattern from one file in another file where it does not belong. When that happens, split the task into smaller steps and check each step before you move on.
They also know less about very new libraries, since their training data has a cut-off date. If you work with a library released in the last year, paste the relevant docs into the chat instead of expecting the model to know the API. That one habit fixes a large share of bad local suggestions, and it costs you less than a minute per question.
Privacy, Speed, and Hardware Trade-offs
Privacy is the main reason to run a local coding assistant. Your code never leaves your machine, which matters for client work, unreleased products, and code under strict contracts. You also keep working when your internet drops, and you pay nothing per request once the model is downloaded. Model weights and tools are free to download in most cases, but check official pricing and licenses for any hosted service you add later, such as a cloud model for hard tasks.
Speed is the trade-off. A local model on a laptop answers slower than a cloud model on a data center GPU, and long answers can take a while. You can close much of that gap with a better GPU or a smaller model. Our guide to the best GPUs for LLM inference covers which cards make sense for local inference if you decide to upgrade. Until then, a small model with a fast first answer often feels better than a large model that keeps you waiting.
Start with one model and one workflow, such as explaining code or writing tests, and add more once that feels smooth. A local ai coding assistant ollama setup rewards patience in the first week and pays it back every day after, in private, offline, and free code help that sits inside the editor you already use.