Skip to content

OpenCode: A Complete Guide to the Open-Source AI Terminal Coding Agent

Mar 31, 2026 1 min
TL;DR OpenCode is an open-source AI coding agent built in Go (95K+ GitHub stars) with a built-in TUI, support for 75+ LLMs, LSP integration, Vim-style editing, and SQLite session management. Free, no subscription required — works with local or cloud models.

🌏 中文版

OpenCode is an open-source AI coding agent built in Go by the SST/AnomalyCo team, running entirely in your terminal. No subscription required, supports 75+ LLM providers, and amassed 95K+ GitHub stars shortly after its Q4 2025 launch.

Installation

# One-liner install via curl
curl -fsSL https://opencode.ai/install | bash

# npm
npm install -g opencode

# Homebrew
brew install opencode

# Other options
# Scoop / Chocolatey (Windows), pacman (Arch), Nix

Core Features

FeatureDescription
TUI InterfaceInteractive terminal UI built with Bubble Tea — feels close to an IDE
75+ LLMsOpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter, local models (Ollama, LM Studio)
LSP IntegrationLanguage Server Protocol support for intelligent completions and semantic analysis
Vim-style EditorEdit files directly in the terminal using Vim keybindings
SQLite SessionsPersistent conversation history with cross-session context retention
GitHub IntegrationTrigger tasks from PR comments using /opencode or /oc

Dual Agent Modes

OpenCode ships with two built-in agents, switchable with Tab:

AgentPermissionsPurpose
Build (default)Full read/writeDevelopment work: writing code, fixing bugs, refactoring
PlanRead-onlyAnalysis and exploration: understanding codebases, planning architecture, code review

This design lets you quickly switch between “doing” and “thinking.” Plan mode never accidentally modifies any files.

Supported Model Providers

One of OpenCode’s biggest selling points is model freedom:

Cloud:

  • OpenAI (GPT-4o, GPT-5, o3, etc.)
  • Anthropic (Claude Sonnet, Opus, etc.)
  • Google (Gemini Pro, Ultra)
  • AWS Bedrock, Azure OpenAI
  • Groq, OpenRouter, DeepSeek

Local:

  • Ollama
  • LM Studio
  • Any OpenAI-compatible API

No vendor lock-in — swap providers whenever you want.

GitHub Actions Integration

Add /opencode or /oc to a GitHub PR or Issue comment, and OpenCode will execute the task inside a GitHub Actions runner:

/opencode fix the lint errors and run the tests

Great for automating code review responses and simple fixes.

OpenCode vs. Aider

OpenCodeAider
GitHub Stars95K+39K+
LanguageGoPython
InterfaceTUI (IDE-like)CLI
Key FeaturesLSP integration, parallel sessions, shareable linksGit-first workflow with auto-commits after every AI edit
Best ForInteractive dev sessions, exploratory workSystematic refactoring, repo-wide changes

Many developers use both: Aider for systematic refactoring, OpenCode for interactive development.

Typical Use Cases

  1. Interactive development: Conversational coding in the TUI with real-time feedback
  2. Code exploration: Use Plan mode to read-only analyze an unfamiliar codebase
  3. Multi-model comparison: Switch between providers within the same session to compare results
  4. Local model development: Connect Ollama for fully offline operation
  5. GitHub automation: Trigger AI tasks directly from PRs

How OpenCode Compares to Other Tools

OpenCode’s core strengths: completely free and open-source, no vendor lock-in across 75+ model providers, an IDE-like TUI experience, and semantic-level understanding via LSP integration. Ideal for developers who want maximum model flexibility and refuse to be tied to any single provider.

Resources

References