# OpenCode

> An open-source coding agent with a terminal interface, a desktop app and IDE extensions, which works with models from many providers. Run it in EnvHaven from any browser, signed in once with your own account, and keep it working 24/7; or install it on your own machine.

_Updated November 23, 2026 · Checked against OpenCode 1.18.32 in EnvHaven v1.9.0_

| At a glance |  |
| --- | --- |
| Made by | Anomaly |
| Command | `opencode` |
| Version checked | 1.18.32, in EnvHaven v1.9.0 |
| License | MIT, [source](https://github.com/anomalyco/opencode) |
| Documentation | [opencode.ai/v1/docs/](https://opencode.ai/v1/docs/) |

## Use OpenCode in EnvHaven

1. Open your workspace in any browser, on a laptop, a tablet or a phone.
2. Tap **Launch**, choose OpenCode and tap **Sign in**: it runs `opencode providers login` for you in the terminal. For an API key, choose **Set key** instead and paste `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` or `GOOGLE_API_KEY`; the workspace keeps it write-only.
3. Start it with one tap: signed in, OpenCode gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (1.18.32), so there is nothing to install or update.
4. Give it a task. The image sets `OPENCODE_PERMISSION={"*":"allow"}`, so OpenCode never asks.
5. Close the tab whenever you like. The workspace is an always-on Linux machine, so OpenCode keeps working, and every device you open it from shows the same session.

Every agent signs in with your own account: EnvHaven never resells tokens or adds a markup.

## Install OpenCode on another machine

macOS, Linux (OpenCode 1):

```bash
curl -fsSL https://opencode.ai/install | bash
```

npm (OpenCode 1):

```bash
npm install -g opencode-ai
```

## Sign in from the terminal

In a workspace the Launch menu does this for you. On any other machine, or when you would rather type it:

- In the app, `/connect` picks a provider; from the shell, `opencode providers login` (alias `opencode auth login`) stores its credentials.
- Provider keys are also read from the environment, such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` and `XAI_API_KEY`. With no provider at all, OpenCode 1.18 answers with its free default model.
- ChatGPT Plus or Pro, GitHub Copilot, GitLab Duo and SuperGrok sign in from `/connect`, and OpenCode Go is OpenCode's own plan. Claude Pro and Max are not supported: OpenCode's docs say Anthropic explicitly prohibits it.

## Run OpenCode without permission prompts

For one session:

```bash
opencode --auto
```

For every session, as an environment variable:

```bash
export OPENCODE_PERMISSION='{"*":"allow"}'
```

Or in opencode.json:

```json
{
  "permission": "allow"
}
```

`--auto` auto-approves every permission that is not explicitly denied; its help marks it "dangerous!". Deny rules still apply, and in 1.18 the default rules deny reading `.env` files.

**In EnvHaven:** The image sets `OPENCODE_PERMISSION={"*":"allow"}`, so OpenCode never asks. The details, and when full access is safe, are on the [OpenCode full-access page](https://envhaven.com/yolo/opencode).

## Instructions file

OpenCode reads `AGENTS.md`, `~/.config/opencode/AGENTS.md`. CLAUDE.md is read as a fallback when a project has no AGENTS.md, and `instructions` in opencode.json adds more files.

## Add MCP servers

```bash
opencode mcp add <name>
```

Or in opencode.json (the project, or ~/.config/opencode/opencode.json):

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "filesystem": {
      "type": "local",
      "command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/config/workspace"]
    }
  }
}
```

`opencode mcp add` walks through a local or remote server interactively.

The [MCP config converter](https://envhaven.com/mcp-config) writes the same server for every agent at once.

## Run it from scripts

```bash
opencode run "<prompt>"
```

Headless runs cannot stop to ask, so they need the full-access setting above.

## OpenCode away from your desk

OpenCode keeps working only while the machine it runs on is awake. In EnvHaven that machine is the workspace, which never sleeps: start a task, close the laptop and check on it from a phone.

- [OpenCode in the browser](https://envhaven.com/agents/opencode/browser)
- [OpenCode on iPhone](https://envhaven.com/agents/opencode/iphone)
- [OpenCode on iPad](https://envhaven.com/agents/opencode/ipad)
- [OpenCode on Android](https://envhaven.com/agents/opencode/android)
- [OpenCode on a Chromebook](https://envhaven.com/agents/opencode/chromebook)
- [OpenCode on Windows](https://envhaven.com/agents/opencode/windows)
- [OpenCode on a VPS](https://envhaven.com/agents/opencode/vps)
- [OpenCode in Docker](https://envhaven.com/agents/opencode/docker)
- [OpenCode on a Raspberry Pi](https://envhaven.com/agents/opencode/raspberry-pi)
- [OpenCode 24/7](https://envhaven.com/agents/opencode/24-7)

Anomaly's own options:

- `opencode web` serves a browser interface from the machine it runs on, and `opencode serve` with `opencode attach <url>` connects a terminal to it from elsewhere.
- An OpenCode mobile app (iPhone through TestFlight, Android on Google Play) starts and steers sessions.

## Compare OpenCode

- [OpenCode vs Claude Code](https://envhaven.com/compare/claude-code-vs-opencode)
- [OpenCode vs Codex](https://envhaven.com/compare/codex-vs-opencode)
- [OpenCode vs Pi](https://envhaven.com/compare/opencode-vs-pi)
- [OpenCode vs Hermes Agent](https://envhaven.com/compare/opencode-vs-hermes-agent)
- [OpenCode vs OpenClaw](https://envhaven.com/compare/opencode-vs-openclaw)
- [OpenCode vs Goose](https://envhaven.com/compare/goose-vs-opencode)
- [OpenCode vs Factory Droid](https://envhaven.com/compare/factory-droid-vs-opencode)

## When OpenCode misbehaves

- [OpenCode: ProviderModelNotFoundError: Model not found](https://envhaven.com/errors/opencode/provider-model-not-found)
- [OpenCode: The user has specified a rule which prevents you from using this specific tool call.](https://envhaven.com/errors/opencode/permission-rule-denied)
- [OpenCode: ProviderInitError](https://envhaven.com/errors/opencode/provider-init-error)
- [Is OpenCode down?](https://envhaven.com/status/opencode) Live status of the providers it depends on.

## Keep reading

- [OpenCode full-access mode](https://envhaven.com/yolo/opencode)
- [OpenCode in the browser](https://envhaven.com/agents/opencode/browser)
- [OpenCode on iPhone](https://envhaven.com/agents/opencode/iphone)
- [OpenCode on iPad](https://envhaven.com/agents/opencode/ipad)
- [OpenCode vs Claude Code](https://envhaven.com/compare/claude-code-vs-opencode)
- [OpenCode vs Codex](https://envhaven.com/compare/codex-vs-opencode)

Source: https://envhaven.com/agents/opencode
