Use Local Ollama Models in VS Code Chat: The Official Extension, No Sign-In, and the 64k Context Setting
Note: Some future links on this site may be affiliate links. We never claim hands-on testing; guides are researched from the public sources listed in each article.
How we wrote this: A summary of Ollama's VS Code integration and context length docs, Microsoft's "AI language models in VS Code" documentation and the Ollama extension's Marketplace listing (all linked below), checked October 29, 2026. Model names are the docs' examples. Version numbers and menu names change often; follow the current docs if yours differ.
Visual Studio Code's Chat view doesn't have to send your code to a cloud model. With Ollama running on your machine and the official Ollama extension installed, models from your local Ollama server show up in VS Code's model picker next to everything else.
What you need
From Ollama's docs and the extension's listing:
- Visual Studio Code 1.127 or newer. Earlier versions don't reliably cancel requests from language model providers.
- Ollama installed and running (Mac, Windows, Linux).
- At least one model in Ollama. Ollama 0.17.6 or newer is recommended for cloud sign-in and richer model metadata; older versions may still work for local models.
No GitHub sign-in needed for local models
Microsoft's documentation says that in Local harness sessions, models you add yourself ("bring your own key," or BYOK) work without signing in to a GitHub account and without a Copilot plan, including offline use with local models such as Ollama. Ollama's docs agree: local models don't require sign-in.
One caveat from Microsoft: if you use Copilot Business or Enterprise, an administrator can turn off bring-your-own models by policy.
Use the extension, not the old built-in provider
Microsoft's docs flag that the built-in Ollama provider in VS Code is deprecated. For local Ollama models, install the official extension from the Ollama publisher on the Visual Studio Marketplace instead. Microsoft says the extension is maintained by the Ollama team and can support new models and capabilities faster. If you previously set up the built-in provider, install the extension and remove the old provider configuration so your Ollama models keep working.
Setup, step by step
Pull a local model in a terminal, for example:
ollama pull qwen3.6Install the Ollama extension (publisher: Ollama) from the VS Code Marketplace.
Open Chat in VS Code.
Open the model picker at the bottom of the chat input.
Choose a model from the Ollama section.
The extension finds models at http://127.0.0.1:11434, Ollama's default local address. You can also open VS Code's Language Models editor (the gear icon in the model picker, or Chat: Manage Language Models from the Command Palette) to see every available model, including each one's context size, and choose which ones appear in the picker.
Fix the context length first
This is the setting most likely to make a local model look worse than it is in a coding chat.
- Ollama's docs warn that VS Code may show a model's maximum context length even when Ollama is allocating a smaller one at runtime.
- Ollama's context length page lists its defaults: 4k tokens on machines with under 24 GiB of VRAM, 32k with 24 to 48 GiB, and 256k with 48 GiB or more. It says agents and coding tools should be set to at least 64,000 tokens.
- The fix from the VS Code integration page: open Ollama's Settings, set context length to at least 64k, reload the VS Code window, and resend your prompt. (If you run the server yourself, the context length page shows
OLLAMA_CONTEXT_LENGTH=64000 ollama serve.)
A bigger context needs more memory. Afterward, run ollama ps and check the PROCESSOR column: Ollama recommends avoiding offloading to the CPU, so if the model no longer shows 100% GPU, choose a smaller model. Our AI model memory calculator gives a rough idea of what fits, and context length explained goes deeper.
If the models don't appear
From Ollama's troubleshooting list:
- Make sure Ollama is running.
- Run
ollama listto confirm you have models. - Run Ollama: Refresh Models from the Command Palette.
- Run Ollama: Diagnose Models and read the Ollama output channel.
For server-side problems, see Ollama troubleshooting and logs.
Local versus cloud models
The extension also lists Ollama's cloud models (names ending in :cloud), which need ollama signin. Ollama's cloud docs describe these as models that run in Ollama's cloud, not on your computer. If the point is keeping your code on your machine, pick models without the :cloud tag. Also check a model's license before using it for client work: open model licenses explained.