Skip to content
AgentAtlas

Zed with Ollama, LM Studio and llama.cpp: Local Model Setup and Context Length

How do I use a local Ollama model in Zed?

Install Ollama, pull a model, make sure the server is running, then pick the Ollama model in Zed's model dropdown. To list models yourself or raise the context length, edit language_models.ollama in your settings.

Set up Ollama

Shell

ollama pull mistral
ollama serve
  • Install Ollama from ollama.com/download.
  • On macOS you can open Ollama.app instead of running ollama serve.
  • In Zed, choose an Ollama model from the model dropdown.

List models yourself

Zed settings

{
  "language_models": {
    "ollama": {
      "api_url": "http://localhost:11434",
      "auto_discover": false,
      "available_models": [
        {
          "name": "qwen2.5-coder",
          "display_name": "qwen 2.5 coder",
          "max_tokens": 32768,
          "supports_tools": true,
          "supports_thinking": true,
          "supports_images": true
        }
      ]
    }
  }
}

Fix short context with context_window

Zed sends the context length to Ollama as num_ctx. The default is 4096 tokens. Raise it for all Ollama models, or per model with max_tokens.

Zed settings

{
  "language_models": {
    "ollama": {
      "context_window": 8192
    }
  }
}

Remote Ollama or API keys

If your Ollama server needs a key, enter it in the provider UI or set OLLAMA_API_KEY. For a remote service, set api_url to the remote endpoint and add the key.

llama.cpp and LM Studio

llama.cpp server

llama serve

LM Studio CLI

lms get qwen2.5-coder-7b
lms server start
  • llama.cpp settings go under language_models with the key llama.cpp. The docs example uses api_url http://localhost:8080, and a key can come from LLAMACPP_API_KEY.
  • LM Studio keys can come from LMSTUDIO_API_KEY or the provider UI.
  • Local models work with Zed Agent and the Inline Assistant. External Agents and Terminal Threads need their own config.

Sources

More Zed guides

Reviewed Oct 23, 2026. Settings change often; the linked vendor docs are the source of truth.

Built an MCP server? Get it listed everywhere →

Shipping an Android app? Google Play needs 12 testers for 14 days first. Get them with Tester Exchange →