Explainer

What Is OpenCode?

OpenCode is a free, open-source AI coding agent that runs in your terminal. Unlike single-vendor tools, it is model-agnostic: you bring your own API keys and point it at any of 75+ providers — Anthropic, OpenAI, Google, GitHub Copilot, and more — while your keys stay on your machine.

By DK, Editor  ·  Last verified: 2026-06-20  ·  How we test  ·  Facts only — no hands-on score

01 / Definition

OpenCode is an open-source, terminal-first AI coding agent. It gives you an agentic coding assistant — one that can read your files, run commands, and make multi-file edits — without locking you to a single model provider or charging a software license. You install it once, plug in the model provider(s) you already pay for, and work from a full terminal UI (TUI).

It is distributed on npm as the package opencode-ai (latest 1.17.8, verified 2026-06-20) and is maintained by SST, per its official Homebrew tap sst/tap/opencode. Because it is open source, you can read, fork, and self-audit the client — a meaningful difference from proprietary agents whose code you cannot inspect.

02 / What it does

  • 75+ model providers, BYO keys

    Configure Anthropic, OpenAI, Google, GitHub Copilot (OAuth), ChatGPT (OAuth) and dozens more. Your API keys are stored locally, so you control cost and never route through a middleman — pay your provider directly at their rates.

  • Native MCP support

    OpenCode speaks the Model Context Protocol, so you can connect external tools — GitHub, Figma, search, browser automation — as MCP servers and let the agent call them. It has a dedicated mcp add / list / auth surface for wiring servers up.

  • Full terminal UI (and headless)

    Run the interactive TUI for day-to-day work, opencode run "..." for a single headless task in scripts or CI, or opencode serve to run it as a server. The same agent core backs all three.

  • Free and open source

    There is no seat cost or subscription for the software itself. Your only spend is the model API usage you incur with your own keys — which you can shop across providers or cover with existing Copilot/ChatGPT subscriptions via OAuth.

03 / How it works

OpenCode separates the agent core from the surface you interact with: the same engine powers the interactive TUI, the headless opencode run command, and the opencode serve server mode. Model access is provider-pluggable rather than baked in, which is why one install can target 75+ providers; you authenticate providers with opencode auth login, and the agent extends to external tools through MCP servers you register yourself.

[screenshot: OpenCode TUI in a terminal — left panel showing a file tree / session, right panel showing an agent editing a multi-file change. Capture at 2x on a dark theme.]

OpenCode vs Claude Code in one line

OpenCode is free, open-source, and works with 75+ providers using your own keys; Claude Code is Anthropic’s proprietary terminal agent locked to Claude models. See the full comparison.

04 / Who it's for

  • Developers who want to avoid vendor lock-in and switch model providers per task (e.g. one model for refactors, another for tests).
  • Cost-conscious users who want to BYO keys, shop provider pricing, or reuse an existing Copilot/ChatGPT subscription via OAuth.
  • Teams that need an open-source, self-auditable client rather than a closed binary.
  • Terminal-first developers who prefer a TUI and headless automation over an IDE-bound assistant.

05 / Getting started

Getting started takes two commands: install OpenCode, then authenticate a provider with opencode auth login. From there you can launch the TUI or wire up MCP servers. The step-by-step install and MCP guides below cover every OS and the most common setup errors.

FAQ

Is OpenCode free?
Yes. OpenCode the software is free and open-source — there is no seat or subscription cost. You pay only for the model API calls you make with your own provider keys. If you connect GitHub Copilot or ChatGPT via OAuth, that usage can roll into your existing subscription. Confirm current provider pricing on each provider’s site.
Can OpenCode use Claude models?
Yes. Anthropic is one of OpenCode’s 75+ supported providers. You supply your own Anthropic API key and OpenCode calls Claude like any other model — so you can use Claude’s models inside OpenCode without using Claude Code itself.
How is OpenCode different from Claude Code?
Both are terminal-first agents with native MCP, but they sit at opposite ends of the control spectrum. OpenCode is free, open-source, and model-agnostic (75+ providers, BYO keys stored locally). Claude Code is Anthropic’s proprietary agent locked to Claude models, with a deeper subagent and orchestration layer. See our full OpenCode vs Claude Code comparison.
How do I install OpenCode?
You can install it with the official curl script, with npm (npm i -g opencode-ai), or with Homebrew (brew install sst/tap/opencode). The npm method works across macOS, Linux, and Windows. Our install guide walks through each OS plus authentication and common PATH errors.
Does OpenCode support MCP servers?
Yes — MCP support is native. OpenCode has a dedicated mcp add / list / auth / debug command surface for connecting servers like GitHub, Figma, or web search. Our OpenCode MCP guide covers the exact commands, verified against v1.17.8.