OpenCode guide: install, providers, Zen and Go plans, agents and features
OpenCode is the most widely used provider-neutral coding agent in the terminal. It comes from the team behind SST, the open-source framework for deploying apps on AWS. In January 2026 the company renamed itself Anomaly and moved the repository from sst/opencode to anomalyco/opencode. OpenCode's site reports more than 215,000 GitHub stars, about 950 contributors and 16 million developers a month. Those are the vendor's own figures.
Its main selling point is choice. You can use almost any model, switch between them in a session, and reuse subscriptions you already have.
How it works
Run opencode in a project and it opens a terminal interface. You describe a task, and the agent searches the code, reads files, makes edits and runs commands. OpenCode starts a language server (LSP) for your project's languages automatically, so the model gets real diagnostics, such as type errors, after each edit instead of finding out later when tests fail.
Sessions are saved and can run in parallel. You can share a session as a link, which is useful for showing a teammate how a change was made or for asking for help with a stuck task.
OpenCode is built with a client and server split. The terminal interface is one client. A desktop app, in beta, and IDE integrations are others, and they can connect to the same running sessions.
Installing OpenCode
| Method | Command |
|---|---|
| Install script | curl -fsSL https://opencode.ai/install | bash |
| npm | npm i -g opencode-ai |
| Homebrew | brew install anomalyco/tap/opencode |
| Windows | choco install opencode or scoop install opencode |
OpenCode recommends WSL on Windows. After installing, run opencode in a project, then type /connect to add a provider.
A first session
A typical first run looks like this:
cdinto a git repository and runopencode.- Type
/connect, pick a provider and paste an API key, or sign in with Copilot or ChatGPT. - Type
/modelsto choose a model. - Run
/initso OpenCode reads the project and writes anAGENTS.mdfile with build commands and conventions. Review it and commit it. - Press Tab to switch to the Plan agent and ask for a plan for your first change. When the plan looks right, switch back to Build and tell it to go ahead.
Starting in Plan mode on an unfamiliar repository costs less and shows you how the model understands the code before it touches anything.
Providers and plans
OpenCode reads its model list from Models.dev, an open database of model capabilities and prices, and supports more than 75 providers. That includes Anthropic, OpenAI, Google, xAI, DeepSeek, Mistral, Groq, Amazon Bedrock, Azure, OpenRouter, and local servers such as Ollama and LM Studio.
You can pay for models in several ways:
| Option | How you pay | Notes |
|---|---|---|
| Free models | Nothing | A rotating set of models OpenCode offers at no cost |
| Your own API keys | Provider's per-token rates | Any of the 75+ providers |
| GitHub Copilot login | Your Copilot plan | Uses Copilot's model allowance |
| ChatGPT Plus or Pro login | Your ChatGPT plan | Uses OpenAI models within plan limits |
| OpenCode Zen | Pay as you go | Gateway to models the OpenCode team has tested for coding |
| OpenCode Go | Low-cost monthly subscription | Bundled access to selected models |
| Local models | Your hardware | Ollama, LM Studio or any OpenAI-compatible server |
Zen exists because the same model can behave differently across providers, depending on how each host configures it. The OpenCode team benchmarks providers and routes Zen requests to configurations it has tested.
Anthropic does not allow consumer Claude subscriptions to power third-party agents. To use Claude models, bring an API key or go through a cloud provider or gateway.
Agents and permissions
OpenCode has two built-in primary agents, switched with Tab:
- Build: full tool access. Edits files and runs commands.
- Plan: read-only by default. Reviews code and proposes changes, asking before it edits or runs anything.
It also has subagents for tasks such as searching a large codebase, which the main agent can call on. You can define your own agents in opencode.json or as markdown files, each with its own model, system prompt, tools and permissions. Permissions can allow, ask or deny per tool and per command pattern, for example allowing git status and npm test while asking about everything else.
Other features
AGENTS.md. OpenCode reads project instructions from AGENTS.md, and /init generates one. It can also read Claude Code's CLAUDE.md files.
Custom commands. Store reusable prompts as markdown files and call them as slash commands.
MCP. Add local or remote Model Context Protocol servers in config.
Themes and keybinds. The interface is configurable, including vim-style navigation.
Headless and API use. opencode run "task" runs a prompt without the interface, and the server exposes an HTTP API with an SDK for building your own tools on top.
Undo. /undo and /redo step back through changes in the session.
Where OpenCode works well
- Developers who want to try different models on the same task, or switch providers when prices or quality change.
- Teams with existing Copilot or ChatGPT subscriptions who want a terminal agent without another bill.
- Local and private setups, using Ollama or a self-hosted model server.
- People who want an agent whose code they can read and modify, under a permissive license.
Limits and risks
Quality depends on the model. OpenCode's agent is only as good as the model behind it. Free and small local models will struggle with large refactors.
Name confusion. Older tutorials may refer to the archived Go project of the same name, now Charm's Crush. Install from opencode.ai or the anomalyco repository.
Stored credentials. Keys you add with /connect live in ~/.local/share/opencode/auth.json. Protect that file.
Commands run with your permissions. As with every agent, keep approvals on for destructive commands and work on a branch.
Fast release pace. OpenCode releases often. Config keys and defaults change, so read the changelog when upgrading.
OpenCode compared with other terminal agents
| Tool | Models | License | Can reuse a subscription |
|---|---|---|---|
| OpenCode | 75+ providers, local | MIT | Copilot, ChatGPT Plus or Pro |
| Claude Code | Claude | Proprietary | Claude Pro, Max, Team |
| Codex CLI | OpenAI | Apache 2.0 | Any ChatGPT plan |
| Aider | Most providers, local | Apache 2.0 | No, API keys |
| Pi | Many providers | MIT | Several, via /login |
Choose OpenCode if you want one agent that works with any model and plays well with subscriptions you already have. Choose Claude Code or Codex CLI if you are committed to one lab's models and want the deepest integration with them. For local models, pair OpenCode with Ollama. More options are in the terminal tools guide.
Frequently asked questions
Is OpenCode free?
The software is free and open source under the MIT license. You can use it with free models that OpenCode offers, with your own API keys from any supported provider, or with a GitHub Copilot or ChatGPT Plus or Pro subscription you already pay for. OpenCode also sells Zen, a pay-as-you-go gateway to tested models, and Go, a low-cost monthly subscription. You only pay if you choose a paid model or plan.
How do I install OpenCode?
The quickest way is curl -fsSL https://opencode.ai/install | bash. You can also use npm i -g opencode-ai, brew install anomalyco/tap/opencode, or Chocolatey and Scoop on Windows. OpenCode recommends WSL for the best experience on Windows. Then run opencode inside a project and use /connect to add a provider.
Is OpenCode the same as Crush or opencode-ai/opencode?
No. An earlier Go project at opencode-ai/opencode shared the name. Its repository is archived, and its main developer continued the work at Charm under the name Crush. The OpenCode on this page is the project from Anomaly, formerly SST, now at github.com/anomalyco/opencode. Check the repository owner when you follow tutorials.
Can I use my Claude or ChatGPT subscription with OpenCode?
OpenCode supports signing in with GitHub Copilot and with ChatGPT Plus or Pro, so those plans can power it. Anthropic does not permit consumer Claude subscriptions to be used in third-party agents, so for Claude models in OpenCode use an Anthropic API key, Amazon Bedrock, Google Vertex AI or a gateway such as OpenRouter or OpenCode Zen.
What are the build and plan agents?
OpenCode ships with two main agents you switch between with the Tab key. Build has full access to edit files and run commands. Plan is restricted: it can read and analyze code and suggest changes but asks before editing or running commands, which suits exploring unfamiliar code. You can define your own agents with their own models, prompts and permissions in config.
Where does OpenCode store my API keys?
Credentials you add with /connect are stored in a local file at ~/.local/share/opencode/auth.json. Treat that file like any other secret: keep it out of backups that sync to shared locations and out of dotfile repositories. You can also supply keys through environment variables instead.