---
title: Inline AI Code Editing - Zed
description: Transform code inline with AI in Zed. Send selections to any LLM for refactoring, generation, or editing with multi-cursor support.
---

# Inline Assistant

## Usage Overview

Use {#kb assistant::InlineAssist} to open the Inline Assistant in editors, the rules library, channel notes, and the terminal panel.

The Inline Assistant sends your current selection (or line) to a language model and replaces it with the response.

## Getting Started

If you're using the Inline Assistant for the first time, you need to have at least one LLM provider or external agent configured.
You can do that by:

1. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
2. [using your own API keys](./llm-providers.md#use-your-own-keys), either from model providers like Anthropic or model gateways like OpenRouter.

If 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.

> Unlike the Agent Panel, though, the only exception at the moment is [external agents](./external-agents.md).
> They currently can't be used for generating changes with the Inline Assistant.

## Adding Context

You can add context in the Inline Assistant the same way you can in [the Agent Panel](./agent-panel.md#adding-context):

- @-mention files, directories, past threads, rules, and symbols
- paste images that are copied on your clipboard

You 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.

## Parallel Generations

The Inline Assistant can generate multiple changes at once:

### Multiple Cursors

With multiple cursors, pressing {#kb assistant::InlineAssist} sends the same prompt to each cursor position, generating changes at all locations simultaneously.

This works well with excerpts in [multibuffers](../multibuffers.md).

### Multiple Models

You can use the Inline Assistant to send the same prompt to multiple models at once.

Here's how you can customize your settings file ([how to edit](../configuring-zed.md#settings-files)) to add this functionality:

```json [settings]
{
  "agent": {
    "default_model": {
      "provider": "zed.dev",
      "model": "claude-sonnet-4-5"
    },
    "inline_alternatives": [
      {
        "provider": "zed.dev",
        "model": "gpt-4-mini"
      }
    ]
  }
}
```

When multiple models are configured, you'll see in the Inline Assistant UI buttons that allow you to cycle between outputs generated by each model.

The models you specify here are always used in _addition_ to your [default model](#default-model).

For example, the following configuration will generate three outputs for every assist.
One with Claude Sonnet 4.5 (the default model), another with GPT-5-mini, and another one with Gemini 3 Flash.

```json [settings]
{
  "agent": {
    "default_model": {
      "provider": "zed.dev",
      "model": "claude-sonnet-4-5"
    },
    "inline_alternatives": [
      {
        "provider": "zed.dev",
        "model": "gpt-4-mini"
      },
      {
        "provider": "zed.dev",
        "model": "gemini-3-flash"
      }
    ]
  }
}
```

## Inline Assistant vs. Edit Prediction

Both features generate inline code, but they work differently:

- **Inline Assistant**: You write a prompt and select what to transform. You control the context.
- **[Edit Prediction](./edit-prediction.md)**: Zed automatically suggests edits based on your recent changes, visited files, and cursor position. No prompting required.

The key difference: Inline Assistant is explicit and prompt-driven; Edit Prediction is automatic and context-inferred.

## Prefilling Prompts

To create a custom keybinding that prefills a prompt, you can add the following format in your keymap:

```json [keymap]
[
  {
    "context": "Editor && mode == full",
    "bindings": {
      "ctrl-shift-enter": [
        "assistant::InlineAssist",
        { "prompt": "Build a snake game" }
      ]
    }
  }
]
```
