inline-assistant.md

  1# Inline Assistant
  2
  3## Usage Overview
  4
  5Use {#kb assistant::InlineAssist} to open the Inline Assistant nearly anywhere you can enter text: editors, text threads, the rules library, channel notes, and even within the terminal panel.
  6
  7The Inline Assistant allows you to send the current selection (or the current line) to a language model and modify the selection with the language model's response.
  8
  9## Getting Started
 10
 11If you're using the Inline Assistant for the first time, you need to have at least one LLM provider or external agent configured.
 12You can do that by:
 13
 141. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
 152. [using your own API keys](./llm-providers.md#use-your-own-keys), either from model providers like Anthropic or model gateways like OpenRouter.
 16
 17If 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.
 18
 19> Unlike the Agent Panel, though, the only exception at the moment is [external agents](./external-agents.md).
 20> They currently can't be used for generating changes with the Inline Assistant.
 21
 22## Adding Context
 23
 24You can add context in the Inline Assistant the same way you can in [the Agent Panel](./agent-panel.md#adding-context):
 25
 26- @-mention files, directories, past threads, rules, and symbols
 27- paste images that are copied on your clipboard
 28
 29Additionally, a useful pattern is to create a thread in the Agent Panel, and then mention it with `@thread` in the Inline Assistant to include it as context.
 30That often serves as a way to more quickly iterate over a specific part of a change that happened in the context of a larger thread.
 31
 32## Parallel Generations
 33
 34There are two ways in which you can generate multiple changes at once with the Inline Assistant:
 35
 36### Multiple Cursors
 37
 38If you have a multiple cursor selection and hit {#kb assistant::InlineAssist}, you can shoot the same prompt for all cursor positions and get a change in all of them.
 39
 40This is particularly useful when working on excerpts in [a multibuffer context](../multibuffers.md).
 41
 42### Multiple Models
 43
 44You can use the Inline Assistant to send the same prompt to multiple models at once.
 45
 46Here's how you can customize your `settings.json` to add this functionality:
 47
 48```json [settings]
 49{
 50  "agent": {
 51    "default_model": {
 52      "provider": "zed.dev",
 53      "model": "claude-sonnet-4"
 54    },
 55    "inline_alternatives": [
 56      {
 57        "provider": "zed.dev",
 58        "model": "gpt-4-mini"
 59      }
 60    ]
 61  }
 62}
 63```
 64
 65When multiple models are configured, you'll see in the Inline Assistant UI buttons that allow you to cycle between outputs generated by each model.
 66
 67The models you specify here are always used in _addition_ to your [default model](#default-model).
 68
 69For example, the following configuration will generate three outputs for every assist.
 70One with Claude Sonnet 4 (the default model), another with GPT-5-mini, and another one with Gemini 2.5 Flash.
 71
 72```json [settings]
 73{
 74  "agent": {
 75    "default_model": {
 76      "provider": "zed.dev",
 77      "model": "claude-sonnet-4"
 78    },
 79    "inline_alternatives": [
 80      {
 81        "provider": "zed.dev",
 82        "model": "gpt-4-mini"
 83      },
 84      {
 85        "provider": "zed.dev",
 86        "model": "gemini-2.5-flash"
 87      }
 88    ]
 89  }
 90}
 91```
 92
 93## Inline Assistant vs. Edit Prediction
 94
 95Users often ask what's the difference between these two AI-powered features in Zed, particularly because both of them involve getting inline LLM code completions.
 96
 97Here's how they are different:
 98
 99- The Inline Assistant is more similar to the Agent Panel as in you're still writing a prompt yourself and crafting context. It works from within the buffer and is mostly centered around your selections.
100- [Edit Predictions](./edit-prediction.md) is an AI-powered completion mechanism that intelligently suggests what you likely want to add next, based on context automatically gathered from your previous edits, recently visited files, and more.
101
102In summary, the key difference is that in the Inline Assistant, you're still manually prompting, whereas Edit Prediction will _automatically suggest_ edits to you.
103
104## Prefilling Prompts
105
106To create a custom keybinding that prefills a prompt, you can add the following format in your keymap:
107
108```json [keymap]
109[
110  {
111    "context": "Editor && mode == full",
112    "bindings": {
113      "ctrl-shift-enter": [
114        "assistant::InlineAssist",
115        { "prompt": "Build a snake game" }
116      ]
117    }
118  }
119]
120```