> ## Documentation Index
> Fetch the complete documentation index at: https://docs.remoteagent.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# opencode

> Use OpenCode as the default AI runner — open-source terminal AI coding agent by the SST team, supports 75+ providers with no API key required.

[OpenCode](https://opencode.ai) is an open-source terminal-based AI coding agent built by the SST team. The `opencode` runner invokes `opencode run` as a subprocess and supports over 75 AI providers — including GitHub Copilot and local models via Ollama — with no API key required to get started.

## Requirements

* OpenCode CLI installed (`npm install -g opencode-ai`)

Install OpenCode:

```bash theme={null}
npm install -g opencode-ai
```

Verify the installation:

```bash theme={null}
opencode --version
```

## No API key required

OpenCode works out of the box with:

* **GitHub Copilot** — if you have an active Copilot subscription, opencode will use it automatically
* **Local models via Ollama** — run models entirely offline with no external API
* **OpenCode Zen** — opencode's own hosted model access: pay-as-you-go, 37+ models, no provider key needed. Get your key at [opencode.ai/auth](https://opencode.ai/auth)

If you want to use a specific cloud provider (Anthropic, OpenAI, etc.), you can optionally supply an API key. But it is not required to start.

## Setup

```bash theme={null}
remoteagent init --runner opencode
```

Or choose `opencode` when prompted by the interactive wizard.

During `remoteagent init`, the wizard will ask:

* **API key** — optional; choose from:
  * *Skip* — not needed if you are using GitHub Copilot, a local model, or another pre-configured provider
  * *OpenCode Zen* — pay-as-you-go access to 37+ models, no separate provider key needed. Get your key at [opencode.ai/auth](https://opencode.ai/auth)
  * *Anthropic / OpenAI / Google* — paste your provider API key
* **Default model** (e.g. `anthropic/claude-sonnet-4-5`) — optional; leave blank to use opencode's own default
* **Small model for lightweight tasks** — optional
* **Multiagent mode** — yes/no

## How it works

RemoteAgent.CHAT injects configuration at runtime using the `OPENCODE_CONFIG_CONTENT` environment variable — opencode's native config injection mechanism. RemoteAgent.CHAT does not write any config files to disk.

The runner executes:

```bash theme={null}
OPENCODE_CONFIG_CONTENT='{"model":"...","providers":{...}}' opencode run "<prompt>"
```

If you chose **OpenCode Zen** during `remoteagent init`, the provider block is injected automatically and the default model is set to `opencode/claude-sonnet-4-6`:

```json theme={null}
{
  "model": "opencode/claude-sonnet-4-6",
  "provider": {
    "opencode-zen": {
      "options": { "apiKey": "<your-zen-key>" }
    }
  }
}
```

Only the settings collected during the wizard are injected. Any additional opencode configuration you set in your own `opencode.json` file will be picked up by opencode automatically — RemoteAgent.CHAT does not interfere with it.

Output from stdout is forwarded to Telegram as it arrives.

## OpenCode's own configuration

opencode has a rich native configuration system (`opencode.json`). Any settings not exposed in the RemoteAgent.CHAT wizard — custom keybindings, themes, provider-specific options, agent behaviors — can be configured directly in that file. opencode reads it automatically on every run.

See [OpenCode's documentation](https://opencode.ai/docs) for the full list of supported configuration options and providers.

## Pros and cons

| Pros                                                     | Cons                                                           |
| -------------------------------------------------------- | -------------------------------------------------------------- |
| No API key required — recommended default                | Beta output parsing in some edge cases                         |
| 75+ supported providers                                  | Requires OpenCode CLI installed (`npm install -g opencode-ai`) |
| Works with GitHub Copilot and local models               | —                                                              |
| OpenCode Zen: 37+ models, pay-as-you-go, no provider key | —                                                              |
| Open-source and auditable                                | —                                                              |
| No vendor lock-in                                        | —                                                              |
| Active development by SST team                           | —                                                              |
| Config injected via env var — no file conflicts          | —                                                              |

## Updating OpenCode

```bash theme={null}
npm install -g opencode-ai@latest
opencode --version
```

Restart the agent after updating:

```bash theme={null}
remoteagent start
```
