# OpenCode

OpenCode runs in its own tab in each [pane](/docs/panes-and-worktrees), on that pane's branch.

## Install

```bash
npm install -g @opencode/cli
```

For other installation methods, see the [OpenCode documentation](https://opencode.ai/docs/#install).

## Authenticate

```bash
opencode auth login
```

See [opencode.ai/docs/cli/providers](https://opencode.ai/docs/cli/providers/) for all supported providers.

## Launch

1. Press <KeyCombo keys={["⌘", "⌥", "6"]} /> (<KeyCombo keys={["Ctrl", "Alt", "6"]} /> on Windows and Linux) or press <KeyCombo keys={["⌘", "⇧", "P"]} /> (Open Search) and choose **Add OpenCode**. The preset runs `opencode --auto`.
2. Enter your task. Pane waits for OpenCode to be ready and sends your initial input once.

<TerminalPreview lines={[
  { type: "command", text: "opencode --auto" },
  { type: "output",  text: "" },
  { type: "command", text: "Add input validation to the signup form" },
  { type: "success", text: "Updated src/components/SignupForm.tsx" },
  { type: "success", text: "Updated src/lib/validation.ts" }
]} />

Review the changes in **Changes** (<KeyCombo keys={["⌘", "⌥", "B"]} />), then commit with <KeyCombo keys={["⌘", "⇧", "K"]} />.

> **Warning:** `--auto` approves every action your OpenCode config doesn't deny, with no sandbox, so OpenCode can run any command on your machine. To have it ask first, add OpenCode as a [custom command](/docs/custom-agents) with your own flags.

Pane resumes conversations from OpenCode 2.0.19 on. It saves the session ID OpenCode prints when you exit it (`opencode -s <id>`). After a restart, **Resume Previous Panes** resumes that conversation with `--session`. A conversation you never exited starts fresh.

When Pane launches OpenCode, don't use `--continue` / `-c` or OpenCode's own `--prompt`. Use Pane's initial input or the [`runpane` CLI](/docs/runpane-cli)'s `--prompt` instead.

Pane doesn't register its [MCP server](/docs/mcp) or skills with OpenCode, and [Loops](/docs/loops) don't offer it.

<Toggle title="Choosing a model">

Pass `--model <provider/model>` in a [custom command](/docs/custom-agents). List your models with `opencode models`.

Full reference: [OpenCode CLI docs](https://opencode.ai/docs/cli/)

</Toggle>
