inline-assistant.md

  1---
  2title: Inline AI Code Editing - Zed
  3description: Transform code inline with AI in Zed. Send selections to any LLM for refactoring, generation, or editing with multi-cursor support.
  4---
  5
  6# Inline Assistant
  7
  8## Usage Overview
  9
 10Use {#kb assistant::InlineAssist} to open the Inline Assistant in editors, text threads, the rules library, channel notes, and the terminal panel.
 11
 12The Inline Assistant sends your current selection (or line) to a language model and replaces it with the response.
 13
 14## Getting Started
 15
 16If you're using the Inline Assistant for the first time, you need to have at least one LLM provider or external agent configured.
 17You can do that by:
 18
 191. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
 202. [using your own API keys](./llm-providers.md#use-your-own-keys), either from model providers like Anthropic or model gateways like OpenRouter.
 21
 22If you have already set up an LLM provider to interact with [the Agent Panel](./agent-panel.md#getting-started), then that will also work for the Inline Assistant.
 23
 24> Unlike the Agent Panel, though, the only exception at the moment is [external agents](./external-agents.md).
 25> They currently can't be used for generating changes with the Inline Assistant.
 26
 27## Adding Context
 28
 29You can add context in the Inline Assistant the same way you can in [the Agent Panel](./agent-panel.md#adding-context):
 30
 31- @-mention files, directories, past threads, rules, and symbols
 32- paste images that are copied on your clipboard
 33
 34You can also create a thread in the Agent Panel, then reference it with `@thread` in the Inline Assistant. This lets you refine a specific change from a larger thread without re-explaining context.
 35
 36## Parallel Generations
 37
 38The Inline Assistant can generate multiple changes at once:
 39
 40### Multiple Cursors
 41
 42With multiple cursors, pressing {#kb assistant::InlineAssist} sends the same prompt to each cursor position, generating changes at all locations simultaneously.
 43
 44This works well with excerpts in [multibuffers](../multibuffers.md).
 45
 46### Multiple Models
 47
 48You can use the Inline Assistant to send the same prompt to multiple models at once.
 49
 50Here's how you can customize your settings file ([how to edit](../configuring-zed.md#settings-files)) to add this functionality:
 51
 52```json [settings]
 53{
 54  "agent": {
 55    "default_model": {
 56      "provider": "zed.dev",
 57      "model": "claude-sonnet-4-5"
 58    },
 59    "inline_alternatives": [
 60      {
 61        "provider": "zed.dev",
 62        "model": "gpt-4-mini"
 63      }
 64    ]
 65  }
 66}
 67```
 68
 69When multiple models are configured, you'll see in the Inline Assistant UI buttons that allow you to cycle between outputs generated by each model.
 70
 71The models you specify here are always used in _addition_ to your [default model](#default-model).
 72
 73For example, the following configuration will generate three outputs for every assist.
 74One with Claude Sonnet 4.5 (the default model), another with GPT-5-mini, and another one with Gemini 3 Flash.
 75
 76```json [settings]
 77{
 78  "agent": {
 79    "default_model": {
 80      "provider": "zed.dev",
 81      "model": "claude-sonnet-4-5"
 82    },
 83    "inline_alternatives": [
 84      {
 85        "provider": "zed.dev",
 86        "model": "gpt-4-mini"
 87      },
 88      {
 89        "provider": "zed.dev",
 90        "model": "gemini-3-flash"
 91      }
 92    ]
 93  }
 94}
 95```
 96
 97## Inline Assistant vs. Edit Prediction
 98
 99Both features generate inline code, but they work differently:
100
101- **Inline Assistant**: You write a prompt and select what to transform. You control the context.
102- **[Edit Prediction](./edit-prediction.md)**: Zed automatically suggests edits based on your recent changes, visited files, and cursor position. No prompting required.
103
104The key difference: Inline Assistant is explicit and prompt-driven; Edit Prediction is automatic and context-inferred.
105
106## Prefilling Prompts
107
108To create a custom keybinding that prefills a prompt, you can add the following format in your keymap:
109
110```json [keymap]
111[
112  {
113    "context": "Editor && mode == full",
114    "bindings": {
115      "ctrl-shift-enter": [
116        "assistant::InlineAssist",
117        { "prompt": "Build a snake game" }
118      ]
119    }
120  }
121]
122```