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 byAnomaly
Commandopencode
Version checked1.18.32, in EnvHaven v1.9.0
LicenseMIT, source
Documentationopencode.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):

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

npm (OpenCode 1):

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:

opencode --auto

For every session, as an environment variable:

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

Or in opencode.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.

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

opencode mcp add <name>

Or in opencode.json (the project, or ~/.config/opencode/opencode.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 writes the same server for every agent at once.

Run it from scripts

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.

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

When OpenCode misbehaves