開源的 AI Coding Agent。
# 直接安裝 (YOLO)
curl -fsSL https://opencode.ai/install | bash
# 套件管理員
npm i -g opencode-ai@latest # 也可使用 bun/pnpm/yarn
scoop install opencode # Windows
choco install opencode # Windows
brew install anomalyco/tap/opencode # macOS 與 Linux(推薦,始終保持最新)
brew install opencode # macOS 與 Linux(官方 brew formula,更新頻率較低)
paru -S opencode-bin # Arch Linux
mise use -g github:anomalyco/opencode # 任何作業系統
nix run nixpkgs#opencode # 或使用 github:anomalyco/opencode 以取得最新開發分支
TIP
安裝前請先移除 0.1.x 以前的舊版本。
OpenCode 也提供桌面版應用程式。您可以直接從 發佈頁面 (releases page) 或 opencode.ai/download 下載。
| 平台 | 下載連結 |
|---|---|
| macOS (Apple Silicon) | opencode-desktop-darwin-aarch64.dmg |
| macOS (Intel) | opencode-desktop-darwin-x64.dmg |
| Windows | opencode-desktop-windows-x64.exe |
| Linux | .deb, .rpm, 或 AppImage |
# macOS (Homebrew Cask)
brew install --cask opencode-desktop
# Windows (Scoop)
scoop bucket add extras; scoop install extras/opencode-desktop
安裝腳本會依據以下優先順序決定安裝路徑:
$OPENCODE_INSTALL_DIR - 自定義安裝目錄$XDG_BIN_DIR - 符合 XDG 基礎目錄規範的路徑$HOME/bin - 標準使用者執行檔目錄 (若存在或可建立)$HOME/.opencode/bin - 預設備用路徑# 範例
OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash
XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash
OpenCode 內建了兩種 Agent,您可以使用 Tab 鍵快速切換。
此外,OpenCode 還包含一個 general 子 Agent,用於處理複雜搜尋與多步驟任務。此 Agent 供系統內部使用,亦可透過在訊息中輸入 @general 來呼叫。
了解更多關於 Agents 的資訊。
關於如何設定 OpenCode 的詳細資訊,請參閱我們的 官方文件。
如果您有興趣參與 OpenCode 的開發,請在提交 Pull Request 前先閱讀我們的 貢獻指南 (Contributing Docs)。
如果您正在開發與 OpenCode 相關的專案,並在名稱中使用了 "opencode"(例如 "opencode-dashboard" 或 "opencode-mobile"),請在您的 README 中加入聲明,說明該專案並非由 OpenCode 團隊開發,且與我們沒有任何隸屬關係。
在功能面上與 Claude Code 非常相似。以下是關鍵差異:
另一個名稱相近的儲存庫與本專案無關。您可以點此閱讀背後的故事。