Kilo Code With Local LLMs in 2026: Ollama Setup, Zero Data Leaving Your Device
TL;DR: Kilo Code is an MIT-licensed VS Code coding agent (a fork of Roo Code, which forked Cline) with a native Ollama provider, so you can run the whole agent loop against a local model at zero per-token cost. The two things that break local setups are picking a model without tool-calling support and leaving the context window at Ollama’s default. One thing the marketing glosses over: Auto Model routing works on Kilo’s hosted gateway tiers, not your local endpoint.
What you’ll have running after this guide:
- Kilo Code in VS Code driving a local
qwen3-codermodel through Ollama, with no API key and no per-request cost - A context window actually large enough for agent work (the
num_ctxfix) - A per-mode setup that keeps code edits fully local and optionally sends only planning tasks to a cloud model
Honest take: If you’re already on Cline or Continue.dev with Ollama and happy, there’s no urgent reason to switch. If you’re starting fresh, Kilo is the most feature-complete of the three for local agent work — take the free hosted credits out of the equation and it’s still a solid MIT-licensed agent.
What Kilo Code is (and what it isn’t)
Kilo Code is an open-source AI coding agent that lives in VS Code and JetBrains, with a newer CLI. It started as a fork of Roo Code — itself a fork of Cline — and merged features from both lineages: specialized agent modes (Code, Plan/Architect, Ask, Debug, Review), MCP server support with a marketplace, terminal command execution, browser control, and inline autocomplete.
Two facts worth pinning down, because the coverage out there is inconsistent:
- License: the
Kilo-Org/kilocoderepository ships an MIT license on the current main branch. Some earlier writeups (and older versions of this site’s own topic notes) say Apache 2.0 — that matches the Roo Code/Cline lineage it forked from, but the LICENSE file in the repo today is MIT. Either way you get commercial use, modification, and redistribution rights; MIT just drops Apache’s explicit patent grant. - The company vs the extension: Kilo (kilo.ai) monetizes a hosted gateway with 500+ models and team features. The extension itself is free and works fine with your own keys or a local endpoint. You do not need a Kilo account to use it with Ollama.
The repo sits at roughly 26–27K GitHub stars as of August 2026, with the extension distributed through the VS Code Marketplace and Open VSX.
Prerequisites
- Ollama installed and running. If you haven’t done this, our Ollama + Open WebUI Linux guide covers it; the short version is
curl -fsSL https://ollama.com/install.sh | sh, and verify withollama --version. - A tool-calling model. This is non-negotiable. Kilo’s agent loop works by issuing tool calls (read file, write file, run command). A model that can’t emit structured tool calls will chat pleasantly and edit nothing. Good local picks in 2026:
qwen3-coder(30B-class MoE) — the default recommendation, strong tool-calling, runs on a 24GB card. See our Qwen3-Coder-Next setup guide.- Devstral Small 2 (24B, Apache 2.0) — agent-tuned, fits 16GB at Q4. Our review.
- Codestral 2 (22B, Apache 2.0) — solid on 16GB. Our review.
- Enough VRAM. A 30B-class model at Q4 wants a 24GB card — an RTX 3090 used or an RTX 4090 if the budget allows. 16GB cards handle the 22–24B options. For hardware sizing beyond that, runaihome.com’s local AI GPU guides go deeper: https://runaihome.com. No GPU at all? Rent one by the hour on RunPod (https://runpod.io?ref=cjrwwd27) and point Kilo at the pod’s Ollama endpoint instead — same config, different base URL.
Pull the model before configuring anything:
ollama pull qwen3-coder:30b
ollama ps # confirm it loads and shows GPU as the processor
Watch for one Ollama-era gotcha we’ve covered before: :cloud-tagged models route to Ollama’s hosted servers, not your GPU. Pull an explicit local tag. Details in our Ollama cloud models breakdown.
Step-by-step: wiring Kilo Code to Ollama
- Install Kilo Code from the VS Code Marketplace (publisher: Kilo Code) and open the Kilo panel from the activity bar.
- Skip the hosted sign-in. Open Kilo’s Settings (gear icon in the Kilo panel) → Providers.
- Set the API Provider to Ollama. No API key is needed — the provider talks to your local daemon.
- Base URL: leave the default
http://localhost:11434(change it only if Ollama runs on another machine or a RunPod pod — then use that host’s address). - Model: select your pulled model. Kilo addresses local models in the
ollama/<model_name>format, e.g.ollama/qwen3-coder:30b. - Context Window Size (num_ctx): set this now — see the next section, it’s the single most common local-setup failure.
- Save, open a project folder, and give it a real task in Code mode: “add input validation to the register endpoint and update its tests.” You should see tool calls streaming — file reads, diffs, terminal commands — not just prose.
If the model responds but never touches a file, you’re on a non-tool-calling model. Swap it; no amount of prompting fixes this.
The num_ctx trap
Ollama’s default context window is small (4,096 tokens for most models unless the Modelfile overrides it). An agent like Kilo stuffs the system prompt, tool schemas, file contents, and conversation history into every request — a default-sized window overflows almost immediately, and the failure is silent: Ollama truncates the oldest tokens, the model loses the system prompt and its instructions, and the agent starts hallucinating tools or looping.
Kilo exposes the fix directly: in the Ollama provider settings, set Context Window Size (num_ctx) to at least 32768. If you configure the model outside Kilo too, set it at the Ollama layer as well:
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
The cost is VRAM — KV cache grows with the window. On a 24GB card with a 30B Q4 model, 32K is comfortable; 64K+ may force partial CPU offload and a big speed hit. If generation suddenly crawls, check ollama ps for a CPU/GPU split.
Auto Model routing: what it actually does with local models
Kilo’s Auto Model feature picks a model per request across tiers (Free, Balanced, Efficient, Frontier). Here’s the part that matters for this guide: Auto Model routes across Kilo’s hosted gateway catalog — it does not route to your local Ollama endpoint. Claims floating around that you can “configure auto-routing to prefer local models” overstate it; routing happens on Kilo’s side, among hosted models.
What you can do — and it delivers the same cost-saving idea honestly — is use Kilo’s per-mode provider profiles:
- Create one API configuration profile for Ollama (local, $0) and assign it to Code and Debug modes, where volume is high and a 30B local model is competent.
- Optionally create a second profile pointing at a cloud model (via your own API key or Kilo’s gateway) and assign it to Architect/Plan mode only, where frontier-level reasoning earns its cost.
That gives you local-by-default execution with cloud assistance only on the handful of planning requests — typically a >90% reduction in paid calls compared to running everything on a cloud model. Or skip the cloud profile entirely and run 100% local.
Verifying nothing leaves your device
“Local” deserves verification, not trust. With only the Ollama profile configured and hosted features unused:
- Open a terminal and watch traffic while Kilo works, e.g.
sudo tcpdump -i any 'not (dst 127.0.0.1 or src 127.0.0.1)' and port 443— or use VS Code’s built-in proxy logging. - Run a few agent tasks. Inference traffic should be exclusively
localhost:11434. - Expect some benign non-inference traffic: VS Code extension update checks and, depending on settings, Kilo telemetry — turn that off in Kilo’s settings (Allow anonymous error and usage reporting → off) if the goal is zero outbound chatter.
Your prompts and code go to localhost and nowhere else. That’s the whole privacy case, and it holds up.
Kilo vs Cline vs Continue.dev with Ollama
All three cost $0 with a local model. The differences are workflow, not price:
| Kilo Code + Ollama | Cline + Ollama | Continue.dev + Ollama | |
|---|---|---|---|
| Agent modes | Code / Plan / Ask / Debug / Review | Plan / Act | Chat, edit, autocomplete |
| Inline autocomplete | Yes | No (agent-only) | Yes (its core strength) |
| MCP support | Yes + marketplace | Yes | Yes |
| Per-mode model profiles | Yes | Limited | Yes (per feature) |
| The catch | Hosted-gateway upsell in the UI | Heavier token usage per task | Weakest as an autonomous agent |
Rule of thumb: Continue.dev if you mainly want completions and chat (our setup guide), Cline if you want the most battle-tested VS Code agent (our setup guide), Kilo if you want modes, autocomplete, and agent in one extension. For cloud-side comparisons of Kilo against Cursor-class tools, see aicoderscope.com: https://aicoderscope.com.
When not to use this setup
- Complex multi-file refactors on large codebases. Local 7B–30B models still lag frontier cloud models here — expect more babysitting, smaller task chunks, and occasional dead ends. Local is a cost and privacy play, not a capability play.
- 8GB VRAM or less. Sub-14B tool-calling models exist but fumble agent loops often enough to frustrate. Use Continue.dev for completions instead, or rent GPU time.
- You want Auto Model’s hands-off routing. That’s a hosted-gateway feature; going local means picking your model yourself.
FAQ
Does Kilo Code work fully offline? Yes, once the extension and model are installed. The Ollama provider needs no account, no API key, and no internet at inference time. Extension updates and the MCP marketplace need connectivity, but the agent loop itself is local.
Which local model should I start with?
qwen3-coder:30b on a 24GB card is the safest first pick — reliable tool calling and strong code quality. On 16GB, Devstral Small 2 or Codestral 2 at Q4. Set num_ctx to 32768 regardless of model.
Is Kilo Code really free if the company sells a gateway? The extension is MIT-licensed and free with your own endpoints, including Ollama. Kilo monetizes the optional hosted gateway and team plans. You’ll see prompts to use hosted features; local BYOK works without them.
Sources
- Kilo Code repository and LICENSE (MIT, current main): https://github.com/Kilo-Org/kilocode
- Kilo docs — using Ollama with Kilo Code: https://kilo.ai/docs/ai-providers/ollama
- Kilo docs — local models: https://kilo.ai/docs/advanced-usage/local-models
- Kilo — Auto Model routing tiers: https://kilo.ai/auto-model
- Ollama GitHub (context length, local tags): https://github.com/ollama/ollama
Recommended Gear
- RTX 3090 — the used-market 24GB workhorse for 30B-class local coding models
- RTX 4090 — same 24GB with much faster prompt processing for agent workloads
Was this article helpful?
Thanks for the feedback — it helps improve future articles.
Need hands-on help?
I offer 1-on-1 technical consulting for local AI setup, GPU selection, and AI coding tool configuration — same topics covered on this site.
Book a session — $49 / hour →