GitHub Copilot + Ollama in 2026: Local Models in VS Code Chat, What Works Without a Plan, and What Stays Cloud-Only

github-copilotollamavscodelocal-llmsetup-guidebyokai

TL;DR: VS Code’s Copilot chat can now run against a model on your own GPU, and the wiring is the easiest of any editor we’ve covered: install the official Ollama extension, start Ollama, pick the model. Microsoft’s docs are explicit that local models work “without a GitHub account, without a Copilot plan, and without an internet connection.” The hard boundary: tab completions, semantic search, and anything embeddings-based stay on GitHub’s cloud models, plan required.

  • What you’ll be able to do after this guide: run Copilot Chat — including agent mode, with file edits and terminal commands — against a local Ollama model in VS Code, at $0 per token, with no code leaving your machine.
  • What you’ll need: Ollama v0.32.5 (current stable, July 27, 2026), VS Code 1.120 or newer, the Ollama.ollama extension, and a tool-calling model — realistically a 16–24 GB GPU for agent work.
  • What you’ll avoid: the three failure modes that fill the GitHub Discussions threads — the silent 4K context truncation, models vanishing from the agent-mode picker, and the Business/Enterprise policy gate nobody tells you about.

Honest take: This is now the best zero-subscription path to local AI chat in VS Code — easier to wire than Cursor’s Ollama setup and less config than Continue.dev. But be clear about what you’re getting: chat and agent mode only. If tab completion is the half of Copilot you actually use, a local model does nothing for you — that path still runs on GitHub’s own models and still needs at least the free plan’s 2,000 completions a month. Local-model completions in VS Code remain Continue.dev’s turf.

What changed in 2026

Bring-your-own-key support in VS Code spent 2025 as a preview feature for individual plans. This year it went mainstream in two steps: GitHub switched it on for Copilot Business and Enterprise on April 22, 2026, and VS Code’s June 18 release rebuilt the whole flow around a Manage Language Models editor that discovers every model your local Ollama daemon has pulled, groups them by provider, and shows context size and capabilities before you add them to the picker.

The change that matters most for this guide is quieter: VS Code deprecated its built-in Ollama provider. The docs now say to “install the official Ollama extension from the Ollama publisher on the Visual Studio Marketplace instead” — that’s Ollama.ollama, maintained by the Ollama team itself out of ollama/ollama-vscode. The practical difference is who ships support for new models first. When the built-in provider lagged a new release’s metadata, you got wrong context limits and missing capability flags; now that plumbing belongs to the people who ship the models.

What runs locally vs. what stays cloud-only

The docs draw the line at embeddings and completions, and it’s worth internalizing before you uninstall anything:

VS Code featureLocal Ollama model?Copilot plan needed?
Chat (ask mode)✅ YesNo — works signed out
Agent mode (edits, terminal)✅ Yes, tool-calling models onlyNo — see the experimental-setting note below
Utility tasks (commit messages, chat titles)✅ Yes, via chat.utilityModelNo
Tab completions / Next Edit Suggestions❌ Cloud onlyYes — Free plan: 2,000/month
Semantic codebase search❌ Cloud onlyYes
Anything embeddings-based❌ Cloud onlyYes

Two consequences follow. First, the $0 setup is real: chat requests go to 127.0.0.1:11434 and never touch GitHub’s servers, so they can’t consume AI Credits under the June 2026 billing model — there’s nothing to meter. Second, most developers will land on a hybrid: Copilot Free or Pro ($10/month) for completions, local Ollama for the chat-heavy work where token volume is what kills you.

Setup: three commands and one extension

Install or update Ollama first. The version floor for this workflow is low — the extension’s README recommends “Ollama 0.17.6 or newer” for richer model metadata — but current stable is v0.32.5 (July 27, 2026) and there’s no reason to run anything older:

$ curl -fsSL https://ollama.com/install.sh | sh
$ ollama --version
ollama version is 0.32.5

Pull a tool-calling model (more on the choice in the next section):

$ ollama pull qwen3-coder:30b

Confirm the daemon is answering where the extension will look for it:

$ curl http://127.0.0.1:11434
Ollama is running

If that curl fails, fix it before touching VS Code — our Ollama connection-refused guide covers every variant of that failure.

Then, in VS Code: install the Ollama extension (publisher: Ollama), open Chat, and click the model picker at the bottom of the chat input. Your pulled models appear under an Ollama section. Select one and you’re done — no API key, no base URL, no JSON. Local models require no sign-in of any kind; only Ollama’s cloud models (the hosted GLM-5/Kimi-class ones) ask you to run ollama signin first.

If a model you pulled doesn’t show up, the extension ships two commands that save you from guessing: Ollama: Refresh Models reloads the list, and Ollama: Diagnose Models prints exactly what was discovered and why anything was skipped.

Pick a model that survives agent mode

Ask-mode chat runs fine on almost anything. Agent mode is a different animal, and VS Code enforces the requirement bluntly — from the official docs: “For a model to be available when using agents in chat, it must support tool calling. If the model doesn’t support tool calling, it won’t be shown in the model picker.” That single sentence explains most “my model disappeared in agent mode” threads.

The two local models we keep coming back to across every agent guide this year:

ModelSize (Q4)Fits onWhy
qwen3-coder:30b~19 GB24 GB card (RTX 3090/4090)MoE with ~3B active params — fast token rate, strong tool-calling record
devstral:24b~15 GB16 GB cardDense model built for agentic coding, most reliable JSON tool calls in its class

For anything else, check the Berkeley Function-Calling Leaderboard before you commit a 20 GB download — raw coding benchmarks don’t predict whether a model can drive an editor’s tool loop. If your GPU tops out at 8–12 GB, run ask-mode chat locally and leave agent mode to a cloud model; a small model flailing through tool calls wastes more time than it saves. The full VRAM-to-model mapping lives in our sister site’s local models by VRAM guide.

No GPU at all? A rented one works — spin up a RunPod instance running Ollama and SSH-tunnel port 11434 to your laptop (ssh -L 11434:localhost:11434 ...), and the extension discovers it exactly as if it were local.

The three traps

The 4K context truncation

Ollama’s server defaults to a 4,096-token context window regardless of what the model supports, and Copilot chat requests — system prompt, tool definitions, attached files — blow past that immediately. The model doesn’t error; it silently forgets the top of the prompt, which in agent mode means it forgets its tools and instructions. Fix it daemon-wide before you judge any model’s quality:

$ export OLLAMA_CONTEXT_LENGTH=32768
$ ollama serve

(On macOS: launchctl setenv OLLAMA_CONTEXT_LENGTH 32768, then restart Ollama; on Linux, set it via systemctl edit ollama.service.) Symptoms, VRAM cost, and the per-model alternative are covered in our context-length fix guide. Budget for it: 32K of KV cache can add several GB on top of the model weights, which is why the 19 GB model on the 24 GB card is the sane pairing, not the maxed-out one.

Agent sessions need an experimental flag

Regular agent mode in the chat panel works with local models out of the box. The newer agent host sessions (background agents) are gated behind an experimental setting — chat.agentHost.byokModels.enabled — that requires an agent host process restart to take effect. If your local model shows up in normal chat but not for background agent sessions, that’s the switch, not your setup.

The Business/Enterprise policy gate

On individual plans (Free, Pro, Pro+), BYOK and local models work immediately. On Copilot Business or Enterprise, nothing appears until an org administrator enables the “Bring Your Own Language Model Key in VS Code” policy in Copilot settings on GitHub.com. If you’re on a work account and the Manage Language Models flow looks neutered, that’s an admin conversation, not a bug. (And yes, the irony is real: the fully-offline configuration is the one that needs cloud-side permission — the policy check happens through your signed-in work account.)

Remote and custom endpoints: chatLanguageModels.json

The Ollama extension only discovers http://127.0.0.1:11434. For a daemon on another box that you can’t tunnel to, use VS Code’s Custom Endpoint BYOK provider instead: run Chat: Manage Language Models, choose Add Models → Custom, and describe the model in chatLanguageModels.json:

{
  "name": "qwen3-coder on the lab box",
  "id": "qwen3-coder:30b",
  "url": "http://192.168.1.40:11434/v1/chat/completions",
  "toolCalling": true,
  "vision": false,
  "maxInputTokens": 32768,
  "maxOutputTokens": 8192
}

The toolCalling flag is what admits the model to agent mode — the fields here are declarations, not detections, so a wrong maxInputTokens reintroduces the truncation problem one layer up. This is also the escape hatch for llama.cpp, vLLM, or any other OpenAI-compatible server.

Where this leaves the competition

Six months ago, “local model in VS Code” meant installing Continue.dev or Cline alongside Copilot and living with two chat panels. The official-extension route removes that redundancy for chat — but only for chat. Continue.dev is still the answer if you want local completions, which Copilot will not give you at any price. Cline still offers a more battle-tested local agent loop with MCP support. And if you’re evaluating whether Copilot deserves to be the host editor at all, our Copilot review covers that question; the open-source side of this stack is aifoss.dev’s beat.

The verdict for this specific combo: use it if Copilot chat is already your home and your GPU has 16 GB or more. It’s the lowest-friction local setup any major editor ships today, and the signed-out mode makes it the only one that costs literally nothing. Skip it if completions are your main Copilot habit or your hardware caps at 8 GB — you’d be adding moving parts for a feature you won’t benefit from.

FAQ

Do I need a Copilot subscription to use Ollama models in VS Code? No. Microsoft’s docs state local models work without a GitHub account, without a Copilot plan, and without an internet connection. You only need a plan for GitHub-hosted features: completions, semantic search, and the built-in cloud models.

Do local-model chat requests consume my Copilot AI Credits? No. Requests go directly from VS Code to your local Ollama daemon on port 11434. GitHub’s metering never sees them.

Why doesn’t my model appear in agent mode? It doesn’t support tool calling — VS Code hides non-tool-calling models from the agent-mode picker by design. Pull a model with tool support (qwen3-coder:30b, devstral:24b) and run Ollama: Diagnose Models to confirm what the extension detected.

Can I still use the old built-in Ollama provider? It’s deprecated. It may keep working for a while, but the docs direct you to the official Ollama.ollama extension, and that’s where new-model metadata lands first.

Does this work in VS Code forks like Cursor or Windsurf? No — this is Copilot’s BYOK infrastructure, which the forks strip out. Cursor has its own Ollama path with different trade-offs.

Sources

Last updated August 4, 2026. Pricing and features change frequently; verify current state before purchasing.

Was this article helpful?