How to Build a Local LLM Coding Assistant: A Complete Setup Guide
This guide walks through building a fully local LLM-powered coding assistant, from choosing hardware and models to wiring up the runtime, inference service, and editor integration. It explains how Ollama serves an OpenAI-compatible API, how Continue and Cline connect to it, how to size hardware by parameter count, quantization, and context length, and how to troubleshoot common errors. You will also find security and rollback practices for keeping a local setup safe, so you can run an offline, privacy-preserving development environment with predictable responses.
1. Understand the Pipeline First
A local coding assistant is not something you get by installing a single piece of software. It is usually made up of four parts:
- Runtime environment: Node.js LTS 22, plus a VS Code/JetBrains extension host or a local CLI runtime.
- Coding assistant: Tools that support connecting to a local model, such as Continue or Cline.
- Local inference service: Ollama, which listens on
127.0.0.1:11434by default and exposes an OpenAI-compatible API. - Local model file: Quantized model weights, for example 7B or 14B GGUF models.
The whole pipeline looks like this:
Node.js / editor extension → coding assistant → Ollama → local model file
If any link in this chain does not line up, you will typically see one of these failures:
- The assistant cannot call tools;
- Requests to the endpoint fail to connect;
- The model name does not match;
- There is not enough VRAM or system memory;
- Permissions are insufficient, so the assistant cannot read/write files or run commands.
This guide uses Node.js 22 + Ollama + Continue/Cline as the main path. If you use another coding assistant that supports an OpenAI-compatible interface, you can follow the same approach.
2. Choosing Hardware: Estimate Resources by Parameters, Quantization, and Context
Whether a local model will run does not come down to parameter count alone. It depends on three factors at once: parameter count, quantization level, and context length.
The table below is a rough reference. Measurements are based on a single NVIDIA GPU, Ollama’s default inference backend, an 8K context, and a concurrency of 1. Actual usage varies with GPU model, inference backend, context length, concurrency, and the framework’s scheduling strategy.
| Parameters | Quantization | Context | Inference VRAM (ref.) | Recommended RAM | CPU offload needed? | Expected experience |
|---|---|---|---|---|---|---|
| 7B–9B | Q4_K_M | 8K | ~5–6 GB | Start at 16 GB, 32 GB recommended | No | Smooth; good for completion, rewriting, and explaining code |
| 7B–9B | Q8_0 | 8K | ~8–9 GB | 32 GB | An 8 GB GPU may need a little offload | Smooth but tight; quality slightly better than Q4 |
| 14B | Q4_K_M | 8K | ~9–10 GB | 32 GB | Yes, some layers in memory | Usable, but speed drops noticeably |
| 14B | Q8_0 | 8K | ~15–16 GB | 32 GB or more | Heavy offload | Barely interactive; not recommended for long tasks |
| 30B and up | Q4_K_M | 8K | 20 GB+ | 48 GB+ or multi-GPU | Required | Not suitable for interactive coding |
Keep two hard constraints in mind:
- Running out of VRAM immediately triggers
Out of Memory. - System RAM is an often-underestimated bottleneck. It has to serve not only the OS and your IDE, but also the model layers that get offloaded out of VRAM.
The selection principle is simple: start small, then scale up. Get the whole pipeline working with a 7B or 9B model first, then gradually try 14B or larger.
3. Installing the Runtime and Coding Assistant
3.1 Install Node.js LTS 22
Download the current LTS release from the official Node.js website; 22.x is recommended.
Windows:
- Download the
.msiinstaller; - Keep the default
Add to PATHoption checked during installation; - Reopen the terminal after installing.
Linux/macOS can use nvm:
nvm install --ltsnvm alias default lts/*
Verify the installation:
node -vnpm -v
If node -v returns command not found, PATH is not active yet.
Windows users should check that the system environment variable Path contains an entry like:
C:\Program Files\nodejs\
After changing environment variables, you must reopen the terminal, otherwise the change will not take effect.
3.2 Install Continue or Cline
Install the extension in VS Code or a compatible editor:
- Continue: good for users who prefer managing a config file;
- Cline: good for users who prefer a graphical setup.
Steps:
- Open VS Code;
- Go to the extensions marketplace;
- Search for
ContinueorCline; - Install it and restart the editor.
If you use a CLI-style coding assistant, always pin the version, for example:
npm install -g <package-name>@<version>
Verify after installing:
<package-command> --version
Do not assume tools like Claude Code are local-model assistants by default. This guide is about solutions that point at a local Ollama instance—that is, Continue, Cline, or any assistant that supports an OpenAI Compatible interface.
3.3 What If You Hit EACCES?
When installing global npm packages on Linux/macOS, an EACCES or permission denied error means you should not just reach for sudo. A safer approach is to point the global directory at your user directory:
npm config set prefix ~/.npm-global
Then add ~/.npm-global/bin to PATH.
On Windows, verify the current npm prefix with PowerShell:
npm config get prefix
After modifying PATH, reopen the terminal and run:
node -vnpm -v
to confirm the environment is working.
4. Installing Ollama and Changing the Model Directory
4.1 Install Ollama
Download the installer for your OS from the official Ollama website. After installing, first confirm the service is running.
On Linux, check the service status:
systemctl status ollama
On Windows, the service is usually managed by the Ollama tray program.
4.2 Change the Model Storage Directory
By default, Ollama stores models on the system disk or in your user directory. To avoid filling up the C: drive, set the model directory in advance.
Windows PowerShell:
setx OLLAMA_MODELS "D:\ollama\models"
After running this, you need to:
- Close the current terminal;
- Open a new terminal;
- Restart the Ollama tray program.
Linux/macOS:
export OLLAMA_MODELS="/data/ollama/models"
To make this permanent, add it to ~/.bashrc or ~/.zshrc.
If you manage Ollama with systemd, back up the original service file first:
cp /etc/systemd/system/ollama.service /etc/systemd/system/ollama.service.bak
Then edit the service file and add the following under the [Service] section:
Environment="OLLAMA_MODELS=/data/ollama/models"
Save it and run:
systemctl daemon-reloadsystemctl restart ollama
4.3 Create the Directory and Pull a Model
mkdir -p /data/ollama/modelsollama pull qwen2.5-coder:7b
Note: do not copy complex tags that do not exist. Model names and tags must match what the official Ollama library actually provides. After pulling, list the current models:
ollama list
Expected output looks like:
NAME ID SIZE MODIFIEDqwen2.5-coder:7b 1234567890ab 4.7 GB 2 minutes ago
4.4 Confirm Service Status Before Running ollama serve
If you manually run ollama serve while Ollama is already auto-started, you may get:
address already in use
On Linux, stop the auto-started service first:
systemctl stop ollamaollama serve
Or simply restart the service:
systemctl restart ollama
On Windows, if the Ollama tray program is already running, you usually do not need to run ollama serve manually. If you do want to start it manually, exit the tray program first, then run:
ollama serve
4.5 Verify the Environment
Run these in order:
ollama listcurl http://127.0.0.1:11434/api/tagscurl http://127.0.0.1:11434/v1/models
If the second and third commands return JSON, the local inference service is up and working.
If ollama pull fails, troubleshoot in this order:
- Check whether the network can reach the official Ollama library;
- Check that there is enough disk space (
df -h); - Check that the model name is spelled correctly;
- Download models only from the official library or trusted sources;
- Retry the download to avoid corruption from an interrupted transfer.
5. Choosing a Model and Quantization
When picking a model, the first priority is not parameter count—it is whether the model supports tool calling.
If it does not, you may run into these issues after connecting the assistant:
- The operation is unsupported;
- Tools cannot be called;
- Files cannot be read or written;
- Shell commands cannot be executed.
You can check a model’s capabilities with:
ollama show qwen2.5-coder:7b
Look for Capabilities in the output; it should include tools.
Recommended Path
Try the following in order:
- First use
qwen2.5-coder:7bor a comparable 7B/9B model to validate the pipeline; - Then try
qwen2.5-coder:14b, provided you have enough VRAM or system memory; - Only when resources are sufficient, consider Q8 or larger models.
Always confirm exact model tags against the official Ollama library, and do not use tags you cannot verify.
Quantization Strategy Reference
| Quantization | Relative resource usage | Quality | Applicable scenario |
|---|---|---|---|
| FP16/BF16 | 100% | Best | VRAM of 24 GB or more |
| Q8_0 | ~55% | Close to original quality | Plenty of VRAM; stable tool calling |
| Q5_K_M | ~45% | Minimal loss | General-purpose compromise |
| Q4_K_M | ~35% | Slight drop | Default choice for consumer GPUs |
For most local coding assistant scenarios, Q4_K_M is the easiest place to start.
6. Configuring Continue/Cline and Enabling Tool Calling
6.1 Continue Configuration Example
Continue config file location:
- Linux/macOS:
~/.continue/config.yaml - Windows:
%USERPROFILE%\.continue\config.yaml
Example:
models:- name: Local Qwen Coder 7Bprovider: openaimodel: qwen2.5-coder:7bapiBase: http://127.0.0.1:11434/v1apiKey: ollamaroles: [chat, edit, apply]
Note: Continue’s config fields change across versions. Fields such as provider: openai, roles, and apiBase may differ between releases. Prefer Continue 1.0 or later, and follow the examples in the official documentation. If a copied config does not work, check your extension version and the official docs first—do not blindly change other fields.
6.2 Configuring Cline
Cline usually does not require editing a separate config file. Configure it in the VS Code sidebar:
- Set API Provider to
OpenAI Compatible; - Set Base URL to:
http://127.0.0.1:11434/v1
- Enter any non-empty string for API Key;
- The Model ID must match the output of
ollama listexactly.
For example:
qwen2.5-coder:7b
Do not omit the tag. A missing tag may produce:
model not found
6.3 Troubleshooting Tool-Calling Failures
Work through three layers:
Model capability
Useollama showto check whethertoolsis listed. If it is not, switch to another model.Model naming
The model name in the assistant must matchollama listexactly, including the tag.Permissions
Having the assistant run shell commands and write files are system-level operations. Open up the working-directory scope as needed in the permission settings. Otherwise, you may see a message about lacking permission to operate on system-level applications.
7. Troubleshooting Common Errors
| Symptom | Common cause | Fix |
|---|---|---|
command not found: node |
PATH not active | Check environment variables and reopen the terminal |
Out of Memory when loading the model |
Insufficient VRAM | Use a smaller model, lower quantization, or shorter context |
connection refused 127.0.0.1:11434 |
Ollama service not running | Start Ollama, or run ollama serve |
address already in use |
Port already in use | Stop the existing service, or change OLLAMA_HOST |
model not found |
Model name mismatch | Use the full name from ollama list |
| Tools not supported / cannot call tools | Model lacks tools capability |
Switch to a newer model that supports tool calling |
| No permission to operate on system-level apps | Assistant permissions are restricted | Open up the required directories and commands in settings |
| Model download failed | Network, disk, or name error | Check the network, disk space, and model tag |
| Replies get truncated or slower over time | Context is too long | Attach fewer files, or switch to a larger-context model |
8. Staying Safe and Keeping Rollback Options
A local assistant works offline, but it can still delete files, run dangerous commands, or leak sensitive information from your config. Prepare the following before any real use.
8.1 Writing Task Instructions
Keep instructions specific:
- Deliver one small, verifiable change at a time;
- State the goal, input files, constraints, and expected output clearly;
- Make a Git commit before any complex change;
- For bulk edits, have the assistant list a plan first, then execute it step by step.
8.2 Backup and Rollback Checklist
Back things up before changing configuration.
Back up the Continue config:
Linux/macOS:
cp ~/.continue/config.yaml ~/.continue/config.yaml.bak
Windows:
copy %USERPROFILE%\.continue\config.yaml %USERPROFILE%\.continue\config.yaml.bak
Export Ollama-related environment variables:
Linux/macOS:
env | grep OLLAMA > ~/ollama-env-backup.txt
PowerShell:
Get-ChildItem Env: | Where-Object Name -like "OLLAMA*" > ollama-env-backup.txt
If you modified the systemd service, back it up in advance:
cp /etc/systemd/system/ollama.service /etc/systemd/system/ollama.service.bak
8.3 Security Practices
- Limit the assistant’s working directory to your project; do not grant write access to the whole disk or system directories;
- Do not let it auto-execute destructive operations such as bulk deletion, overwriting production data, or changing system configuration;
- Redact logs, error stacks, and config files before pasting them to the assistant;
- Strip out tokens, keys, internal addresses, and customer data;
- Download model weights only from the official Ollama library or trusted channels;
- Do not casually load GGUF files from file-sharing or cloud-storage sources;
- Prefer pinned versions for global npm packages;
- Be cautious with
curl | bashstyle install scripts; - Ollama’s OpenAI-compatible endpoint has no authentication by default—keep it bound to
127.0.0.1; - Do not set
OLLAMA_HOSTto0.0.0.0just so colleagues can reach it.
9. Summary
The core of building a local coding assistant is connecting the pipeline—runtime → coding assistant → inference service → model file—while keeping three constraints under control:
- Hardware sets the ceiling on model size;
- The quantization strategy determines whether it will run at all;
- Whether the model supports tool calling determines how usable it is.
Combine that with clear task instructions, well-defined permission boundaries, and a backup/rollback mechanism, and you get an offline, privacy-controlled development environment with predictable responses. Start by installing Node.js 22 and Ollama, then connect a local model through Continue/Cline, and finally verify everything with ollama list and curl.
