Installation & Setup
Requirements
- Terminal: modern terminal (WezTerm, Alacritty, Ghostty, Kitty recommended)
- Node.js (optional): for
npm install -g opencode-ai - API key: at least one LLM provider, or OpenCode Zen
- Windows: WSL2 recommended; native support via Chocolatey / Scoop / npm
Install
Official script (recommended)
npm / Bun / pnpm / Yarn
Homebrew (macOS / Linux)
The official tap updates faster;
brew install opencodeis community-maintained and may lag.
Windows
Docker
Verify
Config Directories
Merge rule: configs from multiple sources are merged, not blindly replaced; on conflict, later sources win. See Architecture for full order.
Connect a Provider
In the TUI:
Follow prompts, for example:
OpenCode Zen (good for beginners)
- Choose
opencode - Open opencode.ai/auth in the browser
- Sign in and paste the API key into the terminal
Other providers
Anthropic, OpenAI, Google, local Ollama, etc. (see /connect list). You can also configure manually in opencode.json:
Model IDs use provider/model-id. Run opencode models to list available models.
Global Config Example
~/.config/opencode/opencode.json:
Common Environment Variables
Troubleshooting
Issues on Windows?
Install Node and OpenCode inside WSL2 and work on the Linux filesystem.
No models listed?
Run opencode models; ensure Provider is connected via /connect and API key is valid.
Config ignored?
Check project opencode.json overrides; validate JSON against the schema.
Next Steps
- Quick Start: enter TUI and run
/init - Config & CLI Reference: full options