# OpenCode Open-source, provider-agnostic AI coding agent built by the SST team (creators of the SST framework). Runs as a TUI, desktop app, or IDE extension. MIT licensed, written in TypeScript, built with Bun. Explicitly positioned as an open-source alternative to [[Claude Code]], without provider lock-in. Supports 75+ LLM providers via the Vercel AI SDK. ## Key features - **Two primary agents** (switch with `Tab`): - `build` — default, full tool access, makes changes freely - `plan` — read-only analysis, requires approval for edits/bash — good for exploring unfamiliar codebases - **Subagents**: `general` (multi-step research, invoked via `@general`), `explore` (read-only codebase exploration) - **LSP integration** out of the box (language-aware code understanding, unlike Claude Code) - **[[Model Context Protocol (MCP)]] support** - **Client/server architecture**: TUI is just one frontend; server can be driven remotely - **`/init` command** that analyzes the project and generates an `AGENTS.md` - **Custom agents** defined in `opencode.json` or markdown files in `.opencode/agents/` or `~/.config/opencode/agents/` - Undo/redo, conversation sharing with teams - Desktop app (beta) for macOS, Windows, Linux ## Architecture - Core: Bun/TypeScript monorepo - LLM calls: Vercel AI SDK (`@ai-sdk/*` provider adapters) — what enables 75+ provider support - Concurrency: Effect (functional TypeScript library) - TUI: @opentui/core + solid-js (reactive terminal UI) - DB: Drizzle ORM + SQLite for local session persistence - HTTP server: Hono - Parsing: Tree-sitter ## Supported providers (sample) Anthropic, OpenAI, Google (Gemini), Amazon Bedrock, Azure, Groq, Mistral, Cohere, Perplexity, Together AI, xAI (Grok), [[OpenRouter]], Ollama/LM Studio, any OpenAI-compatible API. Also offers **OpenCode Zen** (curated model subscription) and **OpenCode Go** (low-cost open model subscription). ## Install ```sh # curl curl -fsSL https://opencode.ai/install | bash # npm npm i -g opencode-ai@latest # macOS brew install anomalyco/tap/opencode # Windows scoop install opencode ``` ## vs Claude Code | | OpenCode | Claude Code | |---|---|---| | Open source | Yes (MIT) | No | | Provider | Any (75+) | Anthropic only | | LSP support | Yes | No | | Architecture | Client/server (remotely drivable) | Local only | | Desktop app | Yes (beta) | No | | Custom agents | Markdown/JSON config | Via CLAUDE.md conventions | | MCP support | Yes | Yes | ## References - Official website: https://opencode.ai - Documentation: https://opencode.ai/docs - Source code: https://github.com/sst/opencode ## Related - [[AI Agent Harness]] - [[Agent Client Protocol (ACP)]] - [[Claude Code]] - [[OpenClaude]] - [[Gemini CLI]] - [[OpenAI Codex]] - [[Kimi Code]] - [[Pi Mono]] - [[Cline]] - [[Goose]] - [[Superset]] — desktop IDE that drives OpenCode (and other harnesses) in parallel via [[Git Worktree]] - [[abtop]] — monitors running OpenCode sessions - [[AgentsView]] — analyzes OpenCode session history and cost - [[AI Agents]] - [[AI Agent Skills]] - [[Model Context Protocol (MCP)]]