
TL;DR
OpenCode is the fastest-growing open-source AI coding agent - 160K GitHub stars, 7.5M monthly users, 75+ model providers. Here is how to set it up, configure models, and use it effectively in your workflow.
| Official Sources | |
|---|---|
| OpenCode Homepage | Official site with docs and downloads |
| OpenCode GitHub (SST) | Source code, 160K+ stars |
| OpenCode Changelog | Latest releases and features |
| Anomaly (SST) Organization | The team behind OpenCode |
| OpenCode Documentation | Setup guides and configuration |
Last updated: June 12, 2026
OpenCode crossed 160,000 GitHub stars in early 2026, making it the most popular open-source AI coding agent by a wide margin. Over 7.5 million developers use it monthly. The appeal is simple: model-agnostic, terminal-native, fully open source, and you own your data.
This guide covers what OpenCode is, how to install it, which models to use, and where it fits against commercial alternatives like Claude Code and Cursor.
OpenCode is a terminal-based AI coding agent built by the team behind SST (now Anomaly). It runs locally on your machine, connects to 75+ AI providers, and gives you full control over which models process your code.
The core architecture:
/undoUnlike Claude Code (Anthropic-only) or Cursor (subscription-based IDE), OpenCode is MIT-licensed and model-agnostic. You bring your own API keys and pay only for the tokens you use.
The fastest path:
curl -fsSL https://opencode.ai/install | bash
Or via package managers:
# Homebrew
brew install anomalyco/tap/opencode
# npm
npm i -g opencode-ai@latest
# Scoop
scoop install opencode
sudo pacman -S opencode
opencode --version
You should see version 1.17.x or later (the current release as of June 2026 is v1.17.4).
After installation, configure your preferred AI provider:
opencode auth login
This launches an interactive flow to connect your API keys. OpenCode supports multiple simultaneous providers - you can switch models mid-session.
For manual configuration, create .opencode.json in your home directory or project root:
{
"provider": "anthropic",
"model": "claude-sonnet-4-6",
"providers": {
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}"
},
"openai": {
"apiKey": "${OPENAI_API_KEY}"
}
}
}
Environment variables work for API keys: ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, etc.
OpenCode connects to 75+ AI providers. The practical choices for coding:
| Model | Best For | Cost |
|---|---|---|
| Claude Fable 5 | Long-running agentic tasks, complex refactors | $10/$50 per MTok |
| Claude Sonnet 4.6 | Day-to-day coding, balanced cost/quality | ~$3/$15 per MTok |
| Claude Opus 4.8 | Deep reasoning, architecture decisions | $5/$25 per MTok |
| Claude Haiku 4.5 | Fast autocomplete, simple tasks | $1/$5 per MTok |
| Model | Best For |
|---|---|
| GPT-5.5 | Long agentic work, coding benchmarks |
| GPT-4.1 | General purpose, broad knowledge |
| o3/o4-mini | Reasoning tasks, step-by-step analysis |
| Model | Best For |
|---|---|
| Gemini 2.5 Pro | Large context, document analysis |
| Gemini 2.5 Flash | Fast responses, cost-effective |
| Model | Best For |
|---|---|
| Qwen3 72B | Best local coding model |
| Llama 3.3 70B | General purpose |
| DeepSeek Coder V4 | Code-specific tasks |
For local privacy (HIPAA, PCI DSS, air-gapped environments), Ollama models keep everything on your machine. The tradeoff: 70B-class models are needed for reliable tool-calling. Smaller models hallucinate function arguments.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
From the archive
Jun 12, 2026 • 8 min read
Jun 11, 2026 • 10 min read
Jun 11, 2026 • 8 min read
Jun 11, 2026 • 9 min read
Build Mode (default) - Full read/write access to files, command execution, codebase search. This is where most work happens.
Plan Mode - Read-only analysis. Use /plan to switch. The model analyzes your codebase and suggests changes without modifying files. Good for understanding unfamiliar code or reviewing proposals before execution.
OpenCode spawns Language Server Protocol servers and feeds compiler diagnostics back to the model after every edit. When the model introduces a TypeScript type error, it sees the error and self-corrects.
This is unique to OpenCode in 2026 - commercial tools like Claude Code do not have LSP integration for real-time error feedback.
Supported languages: TypeScript, Python, Rust, Go, C/C++, Java, and 18+ others.
Every meaningful change creates a Git snapshot. No manual commits needed.
/undo # Roll back the last change
/redo # Reapply a reverted change
This is safer than trusting the model to "fix" a broken change - just revert and try a different approach.
Run parallel agent sessions on the same project:
# Terminal 1
opencode
# Terminal 2
opencode --session feature-auth
# Terminal 3
opencode --session refactor-api
Each session maintains its own conversation history and can work on different parts of the codebase simultaneously.
Connect to Model Context Protocol servers for extended capabilities:
{
"mcp": {
"servers": [
{
"name": "filesystem",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
}
]
}
}
Recent v1.17.x updates added cwd configuration for workspace-relative MCP server paths.
Create reusable prompt macros as Markdown files in .opencode/commands/:
<!-- .opencode/commands/review.md -->
Review the code in {{file}} for:
- Security vulnerabilities
- Performance issues
- Type safety
- Error handling gaps
Provide specific line references and suggested fixes.
Use with /review file=src/api.ts.
Run OpenCode in scripts and CI/CD pipelines:
# Single prompt, text output
opencode -p "Add error handling to src/api.ts"
# JSON output for parsing
opencode -p "List all TODO comments" -f json
# Quiet mode (no spinner)
opencode -q -p "Fix the TypeScript errors in src/"
This enables automation workflows: pre-commit hooks, nightly refactors, automated test generation.
OpenCode runs as a server that multiple frontends can connect to. Official extensions exist for:
The terminal TUI remains the primary interface - IDE extensions provide inline access without switching windows.
| Factor | OpenCode | Claude Code | Cursor |
|---|---|---|---|
| Open source | Yes (MIT) | No | No |
| Model flexibility | 75+ providers | Claude only | Broad BYOM |
| LSP integration | Yes | No | Partial |
| Multi-session | Yes | No | No |
| Price | Free + model costs | $20+/mo subscription | $20/mo subscription |
| Privacy (max) | 100% local with Ollama | Code sent to Anthropic | Code sent to Cursor |
| IDE integration | Extensions available | Terminal-first | Native IDE |
When to choose OpenCode:
When to choose Claude Code:
When to choose Cursor:
Builder.io testing showed Claude Code completed tasks in 9 minutes 9 seconds versus OpenCode at 16 minutes 20 seconds - OpenCode was 78% slower. However, OpenCode produced more thorough output (94 tests versus 73). The LSP integration adds overhead but catches more errors.
Beyond the free open-source tool, the OpenCode team offers two paid tiers:
OpenCode Go ($5 first month, $10/month) - Access to curated open-source models including Kimi K2, Qwen3, MiniMax, GLM-5, and MiMo. Good for developers who want capable models without managing API keys.
OpenCode Zen (pricing varies) - Premium tier with benchmarked model routing. The system automatically selects the best model for each task type.
These are optional - the core OpenCode tool remains free and works with any API key you provide.
In 2025, the original OpenCode repository was maintained by Charm. After a dispute over direction, the project split:
The SST/Anomaly version at github.com/sst/opencode is what most developers mean when they say "OpenCode" in 2026.
Install OpenCode:
curl -fsSL https://opencode.ai/install | bash
Configure your provider:
export ANTHROPIC_API_KEY="your-key"
opencode auth login
Navigate to a project:
cd your-project
opencode
Start with Plan Mode to understand the codebase:
/plan
Explain the architecture of this project
Switch to Build Mode for changes:
/build
Add input validation to the login form
Use /undo if something breaks:
/undo
OpenCode is an open-source, terminal-native AI coding agent that connects to 75+ AI providers. It runs locally, stores conversations in SQLite, and gives you full control over which models process your code. The MIT license means you can inspect, modify, and self-host the entire system.
Yes. The core software is free and open source. You pay only for the AI models you use - either through API keys (Anthropic, OpenAI, etc.) or by running local models via Ollama at zero marginal cost.
OpenCode supports 75+ model providers versus Claude Code's Anthropic-only approach. OpenCode has LSP integration for real-time compiler feedback. Claude Code has tighter Anthropic model optimization and managed subscriptions. OpenCode is open source; Claude Code is proprietary.
Yes. Connect Ollama with models like Qwen3 72B or Llama 3.3 70B. All processing stays on your machine. This is the path for HIPAA, PCI DSS, and air-gapped deployments. Smaller models (under 70B parameters) tend to hallucinate tool arguments.
Both descended from the same original project. OpenCode (maintained by SST/Anomaly) has 160K+ stars and is the active community standard. Crush (maintained by Charm) is a separate fork with different aesthetics. Most developers use the SST version.
Yes. Use non-interactive mode: opencode -p "prompt" -f json. This enables automated refactoring, test generation, and code review in continuous integration workflows.
For day-to-day coding: Claude Sonnet 4.6 or GPT-4.1. For complex multi-file refactors: Claude Fable 5 or GPT-5.5. For cost-sensitive work: Claude Haiku 4.5 or Gemini 2.5 Flash. For maximum privacy: Qwen3 72B via Ollama.
Use the /model command or configure model switching in your .opencode.json. The provider-agnostic architecture means you can start with a fast model for exploration and switch to a more capable model for execution.
Read next
Fable 5 landed on June 9, GitHub Copilot rewired its billing on June 1, and the tool-stack decisions you made in Q1 may need a rethink. Here is where every major coding tool stands right now.
9 min readFour agents, same tasks. Honest trade-offs from a developer shipping production apps with all of them.
10 min readFrom Claude Code to Gladia, the ten CLIs every AI-native developer should know. Install commands, trade-offs, and when to reach for each.
8 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Open-source AI coding agent for terminal, desktop, and IDE. Works with 75+ LLM providers including Claude, GPT, Gemini,...
View ToolOpen-source terminal agent runtime with approval modes, rollback snapshots, MCP servers, LSP diagnostics, and a headless...
View ToolOpen-source AI pair programming in your terminal. Works with any LLM - Claude, GPT, Gemini, local models. Git-aware ed...
View ToolOpenAI's open-source terminal coding agent built in Rust. Runs locally, reads your repo, edits files, and executes comma...
View ToolShare agent traces with a link. Keep history long enough to find the bug.
View AppCompare AI coding agents on reproducible tasks with scored, shareable runs.
View AppTrack open-source maintenance signals, release tasks, and repo follow-ups in one dashboard.
View AppStep-by-step guide to building an MCP server in TypeScript - from project setup to tool definitions, resource handling, testing, and deployment.
AI AgentsClickable PR link in the footer with review state color coding.
Claude CodeConnect external tools and data sources via the open MCP standard.
Claude Code
Nimbalyst Demo: A Visual Workspace for Codex + Claude Code with Kanban, Plans, and AI Commits Try it: https://nimbalyst.com/ Star Repo Here: https://github.com/Nimbalyst/nimbalyst This video demos N...

Composio: Connect AI Agents to 1,000+ Apps via CLI (Gmail, Google Docs/Sheets, Hacker News Workflows) Check out Composio here: http://dashboard.composio.dev/?utm_source=Youtube&utm_channel=0426&utm_...

Check out Replit: https://replit.com/refer/DevelopersDiges The video demos Replit’s Agent 4, explaining how Replit evolved from a cloud IDE into a platform where users can build, deploy, and scale ap...
Fable 5 landed on June 9, GitHub Copilot rewired its billing on June 1, and the tool-stack decisions you made in Q1 may...

Four agents, same tasks. Honest trade-offs from a developer shipping production apps with all of them.

From Claude Code to Gladia, the ten CLIs every AI-native developer should know. Install commands, trade-offs, and when t...

Updated 2026 comparison of Aider and Claude Code using official docs and current workflow patterns: architecture, contro...

The second half of our agent tooling release: distribution, validation, and ergonomics layered on top of the first six....

OpenClaw has 247K stars and zero MCPs. The best tools for AI agents aren't new protocols - they're the CLIs developers h...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.