What Is opencode?opencode 是什么?
opencode (anomalyco/opencode, formerly sst/opencode) is the open-source, MIT-licensed AI coding agent from the team behind SST — now called Anomaly. It runs natively in your terminal as a rich TUI (built with Bubble Tea), with a desktop app and IDE extensions (VS Code, Cursor, Zed, Windsurf, VSCodium) riding on top. Its one defining bet is provider-agnosticism: configure any of 75+ LLM providers with your own API keys (BYOK), run local models through Ollama or LM Studio, or log in with an existing GitHub Copilot or ChatGPT Plus/Pro account — no subscription required to start.opencode(anomalyco/opencode,原 sst/opencode)是 SST 团队(现更名为 Anomaly)出品的开源 AI 编程 Agent,MIT 协议。它以终端为本(基于 Bubble Tea 的富 TUI),另有桌面应用与 IDE 扩展(VS Code、Cursor、Zed、Windsurf、VSCodium)。它的核心押注是 provider-agnostic(供应商无关):75+ LLM 供应商任选,自带 API 密钥(BYOK),本地模型走 Ollama 或 LM Studio,也能用已有的 GitHub Copilot 或 ChatGPT Plus/Pro 账号登录——上手无需订阅。
In version 2.0 (released October 2026), one background service powers the terminal, desktop, and web apps; subagents can run in the background; and a new Code Mode chains MCP tools into a single script. The project is the most-starred open-source coding agent on GitHub: roughly 210K stars, 950+ contributors and 13,000+ commits as of October 2026, with about 16 million developers using it monthly according to the vendor.2.0 版(2026 年 10 月发布)起,一个后台服务同时驱动终端、桌面与网页应用;子 Agent 可在后台运行;新的 Code Mode 能把 MCP 工具串成一个脚本执行。它是 GitHub 上 Star 数最高的开源编程 Agent:截至 2026 年 10 月约 21 万 Star、950+ 贡献者、13,000+ 次提交,官方称月活开发者约 1600 万。
opencode acts as an MCP client for local and remote MCP servers (including OAuth), gets real compiler diagnostics via LSP servers after every edit, persists sessions locally in SQLite, and offers git-based undo/redo for every change. In CI, mentioning /opencode or /oc in a GitHub issue or pull request runs the task on a GitHub Actions runner. Pricing and feature details: confirm on the official site.opencode 是 MCP 客户端(支持本地与远程 MCP 服务器,含 OAuth);每次改完文件通过 LSP 拿回真实编译器诊断;会话存在本地 SQLite;改动支持 git 级别的撤销/重做。在 CI 里,GitHub issue 或 PR 中提到 /opencode 或 /oc 即可在 GitHub Actions 上跑任务。价格与功能细节以官网为准。
opencode won the open-source coding-agent race for one reason: it refuses to lock you in. Claude Code wants your Anthropic bill, Cursor wants your subscription — opencode just wants your API key, and it works just as well with a local model when you care about privacy. The plan/build dual-agent split (read-only plan agent for safe exploration, full-access build agent) is the best default safety design among terminal agents. The honest cost: configuration overhead. You trade a polished, single-vendor onboarding for choice, and on 2.0 old plugins don't run. If you already pay for Anthropic API credits, opencode + BYOK is the cheapest path to a Claude-powered terminal agent.
opencode 能赢下开源编程 Agent 之战,原因只有一个:它拒绝锁定你。Claude Code 要你买 Anthropic 的账单,Cursor 要你交订阅,opencode 只要你带上自己的 API 密钥——在乎隐私时它同样可以用本地模型。plan/build 双 Agent 设计(只读的 plan Agent 安全探索、全权限的 build Agent 干活)是终端 Agent 里默认最安全的方案。真实代价是配置成本:你用选择替代了开箱即用的单一厂商体验,且 2.0 不再兼容旧插件。如果你已经为 Anthropic API 付费,opencode + BYOK 是获得 Claude 驱动的终端 Agent 最便宜的路径。
— 中国吧 AI Tools Hub Editorial Team
Who Should Use opencode?谁适合使用opencode?
✓ Good Fit For适合以下场景
- Terminal-first developers who want to swap model providers without swapping tools终端党:想换模型但不想换工具
- Privacy-sensitive teams running local models (Ollama, LM Studio) or their own keys隐私敏感团队:本地模型或自带密钥
- Anyone standardizing on an MIT-licensed agent they can fork and self-host想基于 MIT 协议分叉/自托管的团队
✕ Not Ideal For不适合以下场景
- Developers wanting zero-config onboarding — BYOK requires setup想要开箱即用零配置——BYOK 需要自己配置
- Teams invested in Anthropic's skills/memory ecosystem (Claude Code's turf)已重仓 Anthropic 的 skills/记忆生态(那是 Claude Code 的主场)
Getting Started with opencodeopencode 快速开始
1. Install (macOS / Linux):安装(macOS / Linux): curl -fsSL https://opencode.ai/install | bash
2. In a project folder, run `opencode` and connect a provider with `/connect` (or use Ollama locally)进入项目目录,运行 `opencode`,用 `/connect` 接入模型供应商(本地可用 Ollama)
3. Press Tab to switch Plan (read-only) / Build agents, or call a subagent with @general按 Tab 切换 Plan(只读)/ Build 双 Agent,或用 @general 调用子 Agent
Key Features核心功能
-
Provider-Agnostic: 75+ LLM Providers供应商无关:75+ LLM 供应商 — Bring your own API keys across Anthropic, OpenAI, Google, OpenRouter, Bedrock, Groq, DeepSeek, and more — or local models via Ollama/LM Studio.自带 API 密钥接入 Anthropic、OpenAI、Google、OpenRouter、Bedrock、Groq、DeepSeek 等,或走 Ollama/LM Studio 本地模型。
-
Plan / Build Dual AgentsPlan / Build 双 Agent — Tab switches between a read-only plan agent (denies edits by default) for safe exploration and a full-access build agent for development.按 Tab 在只读的 plan Agent(默认拒绝改文件,用于安全探索)与全权限的 build Agent 间切换。
-
LSP + MCP NativeLSP + MCP 原生 — Language servers feed real compiler diagnostics back to the model after every edit; acts as an MCP client for local and remote servers.每次编辑后语言服务器把真实编译器诊断反馈给模型;作为 MCP 客户端接入本地与远程服务器。
-
Git-Based Undo/RedoGit 级撤销/重做 — Every change is snapshotted — roll back any AI-generated edit with /undo.每次改动自动快照,随时用 /undo 回滚 AI 的编辑。
-
CI + Parallel SubagentsCI + 并行子 Agent — Mention /opencode in a GitHub issue/PR to run the task on Actions; subagents run in parallel, and sessions can be shared via links.在 GitHub issue/PR 中 @/opencode 即可在 Actions 上跑任务;子 Agent 并行执行,会话可用链接分享。
Pros & Cons优缺点
✓ Good Fit For适合以下场景
- Fully MIT-licensed — the largest coding-agent community on GitHub (~210K stars)完全 MIT 开源,GitHub 编程 Agent 社区最大(约 21 万 Star)
- Zero model lock-in: BYOK, 75+ providers, local models, even existing Copilot/ChatGPT logins零模型锁定:BYOK、75+ 供应商、本地模型,甚至可复用 Copilot/ChatGPT 账号登录
- Plan mode gives the safest default for exploring unfamiliar codePlan 模式是探索陌生代码库最安全的默认选项
- Real LSP diagnostics and git-level undo make AI edits auditable真实 LSP 诊断 + git 级撤销,让 AI 改动可审计
✕ Not Ideal For不适合以下场景
- BYOK setup overhead — you configure providers yourselfBYOK 配置成本高,供应商都要自己接
- Desktop app still labeled beta; the terminal is the mature path桌面端仍标 beta,终端才是成熟形态
- Fast, bug-prone release cadence; v2.0 breaks old plugins发布节奏快、bug 多;2.0 不兼容旧插件
Use Cases应用场景
Popular ways people use opencode.人们使用opencode的常见场景:
🖥️ Terminal Coding Sprints终端编程冲刺
Plan, implement, test, and commit entirely inside the terminal with a provider you chose yourself.规划、实现、测试、提交全在终端完成,用的是自己选的模型供应商。
🏢 Multi-Model, Multi-Repo Shops多模型多仓库团队
Standardize on one agent across teams while each team picks its own provider and budget.全团队统一用一个 Agent,每个团队自选供应商和预算。
🔒 Privacy-Sensitive Codebases隐私敏感代码库
Keep everything local with Ollama/LM Studio models — nothing leaves the machine.用 Ollama/LM Studio 本地模型跑,一切不出本机。
⚙️ CI AutomationCI 自动化
Trigger agent runs from GitHub issues and PRs via /opencode on Actions runners.在 GitHub issue/PR 中触发 /opencode,在 Actions 上自动跑任务。
Similar AI Tools相似 AI 工具
If opencode doesn't fit your needs, here are other popular AI tools you might consider:如果opencode不符合你的需求,可以看看这些热门 AI 工具: