Introduction to OpenCode

What is OpenCode?

OpenCode is an open-source AI coding agent maintained by Anomaly, available in the terminal (TUI), desktop app, and IDE extensions. Unlike single-vendor assistants, OpenCode supports 75+ LLM providers via Models.dev—including Claude, GPT, Gemini, local models, and OpenCode’s own Zen model gateway.

Core value:

  • Model-agnostic: one agent workflow; switch providers by changing config
  • Privacy-first: official stance is no storage of your code or context (local/self-hosted providers keep data paths under your control)
  • LSP integration: connect language servers and feed diagnostics back to the agent
  • Parallel sessions: run multiple agent sessions in the same project
  • Open source: actively maintained at anomalyco/opencode

Product Matrix

┌─────────────────────────────────────────────────────────┐
│              OpenCode (open-source agent core)           │
└─────────────────────────────────────────────────────────┘
     ┌──────────────┬──────────────┬──────────────┐
     │  Terminal    │   Desktop    │  IDE ext.    │
     │  TUI / CLI   │  macOS/Win   │  VS Code etc.│
     └──────────────┴──────────────┴──────────────┘
     opencode          Desktop beta      Plugin form
     opencode run      Same              Same
     opencode serve    —                 —
EntryCommand / methodUse case
TUIopencodeDaily interactive dev, Plan/Build switching
One-shotopencode run "..."Scripts, CI, automation
Headlessopencode serveRemote API, shared team instance
Web UIopencode webBrowser access to local server
DesktopDownload from siteDevelopers who prefer GUI

Built-in Agents Overview

OpenCode splits work between Primary Agents and Subagents:

AgentTypeRole
BuildPrimaryDefault dev mode, full tools
PlanPrimaryRead-only planning; edits/commands need approval
GeneralSubagentComplex multi-step tasks, can run in parallel
ExploreSubagentFast read-only codebase exploration
ScoutSubagentExternal docs and dependency source lookup

Press Tab to switch Primary agents; invoke Subagents manually with @explore and similar.


Comparison with Codex and Claude Code

DimensionOpenCodeCodexClaude Code
Open sourceCLI open sourceCLI open source
Model choice75+ providersOpenAI-focusedAnthropic-focused
Project instructionsAGENTS.md (via /init)AGENTS.mdCLAUDE.md etc.
Planning modePlan agent (write disabled)Read-only / approval modesPlan mode
LSP✅ Built-in multi-languageDepends on IDE/toolchainDepends on integration
Session sharing/share linkCloud/PRProduct-dependent
PricingFree OSS + pay APIChatGPT plan / APIAPI / subscription

When to choose:

  • Switch models often or run local LLMs → OpenCode
  • Deep OpenAI / ChatGPT stack → Codex
  • Deep Anthropic stack → Claude Code

All three support the AGENTS.md open standard; project conventions can be partially reused.


Good Fit / Caveats

Good fit:

  • Multi-model comparison and cost tuning (cheap model for Plan, strong model for Build)
  • Privacy-sensitive setups (self-hosted providers, local models)
  • LSP diagnostics to help the agent fix type/lint errors
  • Parallel sessions (e.g. one for frontend, one for API)

Watch out:

  • Without API keys and without OpenCode Zen, you must wire up models yourself
  • Native Windows support is still maturing; WSL is smoother
  • LSP is optional; enabling everything on huge repos may use a lot of memory

Billing and Providers

  • OpenCode software is free and open source
  • Model usage is billed by your chosen provider (OpenAI, Anthropic, etc.)
  • OpenCode Zen: curated model list, connect via /connect
  • Some providers may reuse GitHub Copilot, ChatGPT Plus, etc. (check current official support)

Next Steps