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:

    1. Runtime environment: Node.js LTS 22, plus a VS Code/JetBrains extension host or a local CLI runtime.
    2. Coding assistant: Tools that support connecting to a local model, such as Continue or Cline.
    3. Local inference service: Ollama, which listens on 127.0.0.1:11434 by default and exposes an OpenAI-compatible API.
    4. Local model file: Quantized model weights, for example 7B or 14B GGUF models.

    The whole pipeline looks like this:

    1. 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:

    1. Running out of VRAM immediately triggers Out of Memory.
    2. 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 .msi installer;
    • Keep the default Add to PATH option checked during installation;
    • Reopen the terminal after installing.

    Linux/macOS can use nvm:

    1. nvm install --lts
    2. nvm alias default lts/*

    Verify the installation:

    1. node -v
    2. npm -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:

    1. 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:

    1. Open VS Code;
    2. Go to the extensions marketplace;
    3. Search for Continue or Cline;
    4. Install it and restart the editor.

    If you use a CLI-style coding assistant, always pin the version, for example:

    1. npm install -g <package-name>@<version>

    Verify after installing:

    1. <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:

    1. npm config set prefix ~/.npm-global

    Then add ~/.npm-global/bin to PATH.

    On Windows, verify the current npm prefix with PowerShell:

    1. npm config get prefix

    After modifying PATH, reopen the terminal and run:

    1. node -v
    2. npm -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:

    1. 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:

    1. setx OLLAMA_MODELS "D:\ollama\models"

    After running this, you need to:

    1. Close the current terminal;
    2. Open a new terminal;
    3. Restart the Ollama tray program.

    Linux/macOS:

    1. 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:

    1. 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:

    1. Environment="OLLAMA_MODELS=/data/ollama/models"

    Save it and run:

    1. systemctl daemon-reload
    2. systemctl restart ollama

    4.3 Create the Directory and Pull a Model

    1. mkdir -p /data/ollama/models
    2. ollama 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:

    1. ollama list

    Expected output looks like:

    1. NAME ID SIZE MODIFIED
    2. qwen2.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:

    1. address already in use

    On Linux, stop the auto-started service first:

    1. systemctl stop ollama
    2. ollama serve

    Or simply restart the service:

    1. 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:

    1. ollama serve

    4.5 Verify the Environment

    Run these in order:

    1. ollama list
    2. curl http://127.0.0.1:11434/api/tags
    3. curl 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:

    1. Check whether the network can reach the official Ollama library;
    2. Check that there is enough disk space (df -h);
    3. Check that the model name is spelled correctly;
    4. Download models only from the official library or trusted sources;
    5. 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:

    1. ollama show qwen2.5-coder:7b

    Look for Capabilities in the output; it should include tools.

    Try the following in order:

    1. First use qwen2.5-coder:7b or a comparable 7B/9B model to validate the pipeline;
    2. Then try qwen2.5-coder:14b, provided you have enough VRAM or system memory;
    3. 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:

    1. models:
    2. - name: Local Qwen Coder 7B
    3. provider: openai
    4. model: qwen2.5-coder:7b
    5. apiBase: http://127.0.0.1:11434/v1
    6. apiKey: ollama
    7. roles: [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:

    1. Set API Provider to OpenAI Compatible;
    2. Set Base URL to:
    1. http://127.0.0.1:11434/v1
    1. Enter any non-empty string for API Key;
    2. The Model ID must match the output of ollama list exactly.

    For example:

    1. qwen2.5-coder:7b

    Do not omit the tag. A missing tag may produce:

    1. model not found

    6.3 Troubleshooting Tool-Calling Failures

    Work through three layers:

    1. Model capability
      Use ollama show to check whether tools is listed. If it is not, switch to another model.

    2. Model naming
      The model name in the assistant must match ollama list exactly, including the tag.

    3. 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:

    1. cp ~/.continue/config.yaml ~/.continue/config.yaml.bak

    Windows:

    1. copy %USERPROFILE%\.continue\config.yaml %USERPROFILE%\.continue\config.yaml.bak

    Export Ollama-related environment variables:

    Linux/macOS:

    1. env | grep OLLAMA > ~/ollama-env-backup.txt

    PowerShell:

    1. Get-ChildItem Env: | Where-Object Name -like "OLLAMA*" > ollama-env-backup.txt

    If you modified the systemd service, back it up in advance:

    1. 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 | bash style install scripts;
    • Ollama’s OpenAI-compatible endpoint has no authentication by default—keep it bound to 127.0.0.1;
    • Do not set OLLAMA_HOST to 0.0.0.0 just 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:

    1. Hardware sets the ceiling on model size;
    2. The quantization strategy determines whether it will run at all;
    3. 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.