OpenCode: The Complete Guide to the Open Source Coding Agent
Imagine a world where your AI coding assistant isn't locked to a single provider, isn't hidden behind a subscription wall, and works anywhere — terminal, desktop, or IDE. That world exists today: OpenCode is the open-source coding agent that has taken the developer community by storm with 117,000+ GitHub stars, 793 contributors, and 2.5 million monthly developers. Built by the team behind terminal.shop and SST, OpenCode delivers Claude Code-level capabilities without vendor lock-in, supporting 75+ LLM providers from Claude and GPT to Gemini and local models.
What Makes OpenCode Different
The AI coding agent space is crowded. Claude Code, Codex CLI, Gemini CLI, Cursor — they all promise to help you code faster. So what makes OpenCode worth 117K stars?
1. 100% Open Source, Zero Lock-In
Unlike Claude Code (tied to Anthropic) or Codex CLI (tied to OpenAI), OpenCode is completely open source under the MIT license. You own your tools. You control your data. No vendor lock-in, ever.
2. Provider Agnostic
OpenCode supports 75+ LLM providers out of the box:
- Claude (Anthropic) — Sonnet, Opus, Haiku
- GPT (OpenAI) — GPT-4o, o1, o3
- Gemini (Google) — Pro, Flash, Ultra
- Local models — Ollama, LM Studio, llama.cpp
- OpenCode Zen — The team's own optimized offering
As models evolve and pricing drops, you switch providers with a config change — not a tool change.
3. TUI-First Design
Built by Neovim users and the creators of terminal.shop, OpenCode pushes the limits of what's possible in the terminal. The TUI (Terminal User Interface) is a first-class citizen, not an afterthought.
4. Built-In LSP Support
OpenCode ships with Language Server Protocol integration out of the box. Automatic language server configuration means code intelligence works from day one — no manual setup.
5. Client/Server Architecture
OpenCode runs as a server on your machine. The TUI is just one client. This architecture opens the door to:
- Remote control from a mobile app
- Multiple clients connected to one session
- Background processing while you're away
Installation
OpenCode is available through virtually every package manager:
# Quick install
curl -fsSL https://opencode.ai/install | bash
# npm/bun/pnpm/yarn
npm i -g opencode-ai@latest
# macOS/Linux (Homebrew — recommended)
brew install anomalyco/tap/opencode
# Windows
scoop install opencode
choco install opencode
# Arch Linux
sudo pacman -S opencode
# Nix
nix run nixpkgs#opencode
# mise
mise use -g opencode
Desktop App (Beta)
OpenCode is also available as a desktop application for macOS (Intel + Apple Silicon), Windows, and Linux (.deb/.rpm):
- Download from opencode.ai/download
- Or via Homebrew:
brew install --cask opencode-desktop - Or Scoop:
scoop install extras/opencode-desktop
Built-In Agents
OpenCode ships with two agents you can switch between instantly with the Tab key:
Build Agent (Default)
The full-access development agent. It can:
- Read and write files
- Execute shell commands
- Run builds, tests, and linters
- Manage Git operations
- Generate and refactor code
Plan Agent
A read-only agent designed for analysis and exploration:
- Denies file edits by default
- Asks permission before running commands
- Ideal for exploring unfamiliar codebases
- Perfect for planning changes before executing them
General Subagent
A built-in subagent for complex, multi-step tasks. Invoke it with @general in your messages. It handles:
- Complex codebase searches
- Multi-file analysis
- Refactoring planning across modules
Key Features
Multi-Session Support
Run multiple coding sessions simultaneously. Switch between projects without losing context.
Session Sharing
Share your coding sessions with teammates. Collaborative AI-assisted development in real time.
Privacy-First
OpenCode stores no code or context data. Everything stays on your machine. The open-source codebase means you can audit every line.
Authentication Flexibility
Works with existing accounts:
- GitHub Copilot credentials
- ChatGPT Plus subscription
- Direct API keys
- OpenCode Zen subscription
OpenCode vs Alternatives
Category: This repo is an open-source CLI coding agent. Alternatives must also be open-source coding agents that run in the terminal or IDE.
| Feature | OpenCode | Gemini CLI | Codex CLI | Cline | Aider |
|---|---|---|---|---|---|
| Focus | Provider-agnostic coding agent | Google's terminal AI agent | OpenAI's lightweight CLI agent | IDE-native autonomous agent | Git-native pair programmer |
| Stars | 117K ⭐ | 96.7K ⭐ | 63.5K ⭐ | 58.7K ⭐ | 41.6K ⭐ |
| Open Source | ✅ MIT | ✅ Apache-2.0 | ✅ Apache-2.0 | ✅ Apache-2.0 | ✅ Apache-2.0 |
| LLM Providers | ✅ 75+ providers | Gemini only | OpenAI only | ✅ Multi-provider | ✅ Multi-provider |
| Interface | TUI + Desktop + IDE | Terminal | Terminal | VS Code extension | Terminal |
| LSP Support | ✅ Built-in | ❌ | ❌ | Via VS Code | ❌ |
| Built-in Agents | ✅ Build + Plan + General | Single agent | Single agent | Single agent | Single agent |
| Desktop App | ✅ Beta (macOS/Win/Linux) | ❌ | ❌ | ❌ (VS Code) | ❌ |
| Client/Server | ✅ Remote capable | ❌ | ❌ | ❌ | ❌ |
| Git Integration | ✅ | ✅ | ✅ | ✅ | ✅ Git-native (auto commits) |
| Google Search | ❌ | ✅ Built-in grounding | ❌ | ❌ | ❌ |
| Performance | TypeScript | TypeScript | ✅ Rust (fastest) | TypeScript | Python |
| Session Sharing | ✅ | ❌ | ❌ | ❌ | ❌ |
| Contributors | 793 | 100+ | 100+ | 100+ | 100+ |
When to choose OpenCode: You want the most flexible, provider-agnostic coding agent with a polished TUI, desktop app, LSP support, and client/server architecture. The biggest open-source community (117K ⭐, 793 contributors) means fast iteration and broad ecosystem support.
When to choose Gemini CLI: You're in the Google ecosystem and want built-in Google Search grounding, free Gemini API access, and tight integration with Google Cloud. Massive context windows (1M+ tokens) are a major advantage.
When to choose Codex CLI: You want the fastest possible terminal agent. Written in Rust, Codex CLI offers blazing-fast token processing and is optimized for OpenAI's latest Codex models. Cloud task support for long-running operations.
When to choose Cline: You prefer working inside VS Code and want an AI agent that lives in your editor sidebar. Plan/Act modes, browser automation, and diff-based approvals make it the best IDE-native option.
When to choose Aider: You live in Git and want an AI pair programmer that automatically commits with sensible messages, maps your entire codebase, and works with any LLM. The most mature Git-native workflow.
FAQ
How is OpenCode different from Claude Code?
Very similar in capability, but OpenCode is:
- 100% open source (MIT)
- Not locked to any provider (75+ supported)
- Has built-in LSP support
- Has a polished TUI built by Neovim users
- Uses client/server architecture (remote control possible)
Can I use it with local models?
Yes. OpenCode works with Ollama, LM Studio, and any OpenAI-compatible local model server.
Is it free?
Completely free and open source. You only pay for the LLM API calls (if using cloud providers). OpenCode Zen is an optional paid tier with optimized model access.
What about privacy?
OpenCode stores no code or context data. Everything stays local. The codebase is fully auditable.
Getting Started
# Install
curl -fsSL https://opencode.ai/install | bash
# Run in any project
cd your-project
opencode
# Switch between agents
# Press Tab to toggle between Build and Plan agents
That's it. You're coding with AI in under 30 seconds.
Conclusion
OpenCode has earned its 117,000 stars by solving the fundamental problem with AI coding tools: vendor lock-in. By being 100% open source, supporting 75+ providers, and offering a polished terminal experience with LSP support, built-in agents, and a client/server architecture, OpenCode gives developers maximum power with maximum freedom. Whether you use Claude, GPT, Gemini, or a local model, OpenCode adapts to you — not the other way around.
