Skip to content

How-ToGPU

How to Use Zed With Ollama for Local AI Coding

Zed is a fast code editor with built-in AI: an Agent Panel, Inline Assistant, edit predictions and Git commit messages. We show how to connect it to Ollama, LM Studio or llama.cpp, raise Zed's 4,096-token default context window, use tool permissions and set up local edit predictions with a base coding model.

By , Systems & Technical Editor

5 min read

How to Use Zed With Ollama for Local AI Coding

This guide is based on Zed's official AI documentation and Ollama's Zed integration page, read on 25 November 2026.

Zed is a code editor built for speed, with a Free plan. Unlike VS Code, where AI help comes from extensions, Zed has AI built into the editor itself: an Agent Panel where an AI agent can read, write and run code in your project, an Inline Assistant that rewrites a selection in place, edit predictions that suggest code as you type, and AI-written Git commit messages.

You don't have to send any of that to a cloud service. Zed's documentation lists Ollama, LM Studio, llama.cpp and other OpenAI-compatible servers as local model options for its AI features. Zed is available for Windows, macOS and Linux, and Zed says all of its AI features, including edit predictions and agents, are fully supported on Windows.

If you use VS Code and want something similar, see our guides to Continue with Ollama and Cline with Ollama.

What you need

  • Zed, downloaded from zed.dev.

  • Ollama (or LM Studio or llama.cpp) installed. Our guide to running AI models locally with Ollama and LM Studio covers the basics.

  • A model that fits in your graphics card's memory. For agent work, choose one that supports tool calling: Zed's agent edits files and runs commands by calling tools, and Zed shows a "No tools" label next to models that can't. Our VRAM guide explains what fits on 8GB, 12GB, 16GB and 24GB cards.

Step 1: Pull a model and start Ollama

Download a model from the Ollama library. Zed's documentation uses Mistral as its example:

ollama pull mistral

Make sure the Ollama server is running. On Windows the Ollama app runs in the background after installation; on Linux or from a terminal, run ollama serve. By default it listens on http://localhost:11434.

Step 2: Connect Zed to Ollama

Ollama's Zed instructions are short:

  1. In Zed, click the star (AI) icon in the bottom-right corner, then Configure.

  2. Under LLM Providers, choose Ollama.

  3. Confirm the host URL is http://localhost:11434 and click Connect.

  4. Select a model under Ollama in the model dropdown.

Zed automatically discovers the models you've pulled, so a new model appears after ollama pull without any extra configuration.

Using LM Studio or llama.cpp instead

  • LM Studio: download a model, start the API server (Zed's docs give lms server start from the LM Studio command-line tool), then pick an LM Studio model from Zed's model dropdown.

  • llama.cpp: Zed's docs describe starting the built-in server in router mode with llama serve, which loads models from llama.cpp's cache on demand. Zed discovers the served models along with their context length and tool and image support. Our guide to running llama.cpp on Windows covers installing it.

Step 3: Raise the context window

This is the setting most likely to cause problems. Zed sends the context length to Ollama with every request, and by default Zed uses 4,096 tokens. That's enough for a quick question, but an agent reading several files will soon run out, and the model will start to forget what it has seen.

To change it, open Zed's settings.json file (Zed's documentation explains how to edit it) and add:

{
  "language_models": {
    "ollama": {
      "context_window": 32768
    }
  }
}

That sets the context for every Ollama model. You can also set it per model by turning off autodiscovery and listing models yourself with available_models, where each entry has a max_tokens value and flags such as supports_tools, supports_thinking and supports_images.

A bigger context window uses more VRAM. If responses suddenly slow to a crawl after you raise it, the model has probably spilled into system RAM: run ollama ps to check, then try a smaller model or a lower value. Our explainer on context length and VRAM shows why.

For llama.cpp, Zed uses the context length the server reports, and you can override it with the same context_window setting under llama.cpp.

Step 4: Use the Agent Panel and Inline Assistant

Open the Agent Panel and start a new thread with Ctrl+N. Choose your Ollama model from the model selector, then describe the task. Responses stream in with labels showing which tools the model is using.

When the agent edits files, Zed lists them above the message box. Click Review Changes (Ctrl+Shift+R) to see every change in a single review tab before you keep or reject them.

Agent Profiles choose which built-in and MCP tools a thread can use, and Tool Permissions let you allow, deny or require confirmation for tool calls such as terminal commands. With a local model, it's sensible to keep confirmation switched on for anything that runs commands. Zed can also add tools from MCP servers, the same standard covered in our guide to MCP servers in LM Studio.

For smaller jobs, select some code and use the Inline Assistant to transform it in place, for example "add type hints" or "convert this loop to a list comprehension". These short tasks suit small local models far better than multi-file agent work.

Step 5: Set up local edit predictions (optional)

Edit predictions are the grey suggestions that appear as you type. Zed's own Zeta model is included with paid plans, but its documentation says Free plan users can use other providers, including a local model. Edit predictions have their own settings, separate from the Agent Panel. Zed's example for Ollama is:

{
  "edit_predictions": {
    "provider": "ollama",
    "ollama": {
      "api_url": "http://localhost:11434",
      "model": "qwen2.5-coder:7b-base",
      "prompt_format": "infer",
      "max_output_tokens": 512
    }
  }
}

The model needs to be a code-completion (fill-in-the-middle) model. A base coding model like the one in Zed's example suits this job; chat-tuned models are designed for conversation instead. With "prompt_format": "infer", Zed detects the right format from the model name, and its docs list formats for Qwen, CodeGemma, DeepSeek Coder, StarCoder, Codestral and others if you need to set one yourself. Zed also says the same setup works with vLLM, the llama.cpp server and LocalAI through an OpenAI-compatible completions endpoint.

Edit predictions fire constantly as you type, so a small, fast model on the GPU matters more here than raw quality.

Troubleshooting

  • No Ollama models in the dropdown: check that Ollama is running and the host URL is correct, then pull at least one model.

  • "No tools" next to your model: the model or provider doesn't support tool calling, so the agent can chat but can't edit files. Pick a model with tool support.

  • The agent forgets files or gives up partway: raise context_window from the 4,096 default.

  • Slow replies: the model or context doesn't fit in VRAM. Check ollama ps and use a smaller model.

Our verdict

Zed is one of the neatest ways to use a local model for coding because the AI features are part of the editor rather than an add-on. Pull a tool-capable model in Ollama, connect it from the AI icon's Configure menu, and raise Zed's 4,096-token default context window before you try agent tasks. Add a small base coding model for edit predictions if you want local autocomplete too. If you prefer to stay in VS Code, see our best local AI coding assistants round-up.

The bottom line

Zed is one of the neatest ways to use a local model for coding because the AI features are part of the editor rather than an add-on. Pull a tool-capable model in Ollama, connect it from the AI icon's Configure menu, and raise Zed's 4,096-token default context window before you try agent tasks. Add a small base coding model for edit predictions if you want local autocomplete too. If you prefer to stay in VS Code, see our best local AI coding assistants round-up.

Sources

  1. 01Zed Docs, Use a Local Model
  2. 02Zed Docs, Edit Prediction
  3. 03Zed Docs, Agent Panel
  4. 04Zed Docs, AI overview
  5. 05Zed, Zed for Windows
  6. 06Ollama Docs, Zed integration
  7. 07Ollama Docs, Context length

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

Best Free Photo Editors for Windows 11 in 2026

Best Picks

Best Free Photo Editors for Windows 11 in 2026

The best free photo editors for Windows 11 in 2026: GIMP as the best overall, Paint.NET for beginners and quick edits, Photopea in the browser and for PSD files, darktable for raw photos and Krita for painting and retouching, with versions, licences and Windows requirements.

Hannah Vance6 min

LibreOffice vs ONLYOFFICE: Which Free Office Suite Is Best for Your PC?

Versus

LibreOffice vs ONLYOFFICE: Which Free Office Suite Is Best for Your PC?

LibreOffice vs ONLYOFFICE Desktop Editors on a Windows 11 PC in 2026: apps included, Microsoft Office file compatibility, tabbed interface, PDF and form editing, optional AI tools and local models, cloud collaboration, licences and Windows system requirements, and which free office suite suits which user.

Callum Reid6 min

How to Change Default Apps in Windows 11

How-To

How to Change Default Apps in Windows 11

How to change default apps in Windows 11: using Open with > Choose another app with Always or Just once, the file Properties method, setting defaults by file type, link type or app in Settings > Apps > Default apps, changing your default browser, resetting all default apps and fixing common problems.

Marcus Thorne7 min

Windows ML Gets DX CGC: Microsoft's New Way to Run Local AI on Your GPU

News

Windows ML Gets DX CGC: Microsoft's New Way to Run Local AI on Your GPU

Microsoft's Windows ML 2.9.42 Experimental adds DX CGC, a DirectX-based compiler for running AI models on graphics cards, with NVIDIA acceleration first via the 621.24 driver, plus direct loading of GGUF and Hugging Face models. We explain what's new and what it means for local AI on Windows.

Eleanor Shaw5 min