Coding CLI

OpenCode (Open Code): the open source AI coding agent

How OpenCode works in your terminal, how to install it with your own API keys or local Ollama models for $0, and how OpenCode Go compares to Claude Code.

Short answer

Free, MIT, any model.

OpenCode (opencode.ai, github.com/anomalyco/opencode) is an open-source terminal coding agent that reads repositories, edits files, runs tests and connects to almost any LLM provider. The CLI and TUI client are completely free under the MIT license: bring your own API key (Claude, GPT, Gemini, DeepSeek, OpenRouter), run local models via Ollama or LM Studio for $0, or subscribe to OpenCode Go ($10/month) or Zen pay-as-you-go.

OpenCode CLI client

$0MIT open source

Any model / BYOK
Tool

Set up OpenCode with your preferred backend

Checked December 1, 2026

Pick how you want to pay for (or avoid paying for) model calls. Each path shows the install flow, provider setup and cost trade-off.

Model backendAll use the same free CLI
  1. 01Install OpenCode via Homebrew, curl script, npm or Go binary from opencode.ai.
  2. 02Run opencode inside your project folder and run /connect to pick Anthropic, OpenAI, Google, DeepSeek, xAI or OpenRouter.
  3. 03Paste your provider API key (or set ANTHROPIC_API_KEY / OPENAI_API_KEY in your shell) and pay only standard per-token rates with zero OpenCode markup.
  1. 01Start Ollama, LM Studio or vLLM on your Mac, Linux or Windows machine with an open-weight coding model loaded.
  2. 02Launch opencode inside your repo. OpenCode automatically detects local OpenAI-compatible endpoints without sending source code to the cloud.
  3. 03Need hardware guidance? Check our best local LLM by RAM guide to pick a model that fits 16 to 64 GB.
  1. 01Want one bill without managing five API keys? OpenCode offers OpenCode Go at $10/month (flat allowance across curated open-weight and fast models) and Go Plus at $40/month.
  2. 02Prefer pure pay-as-you-go across frontier and open models? Fund OpenCode Zen with prepaid credits and automatic fallback when Go caps run out.
  3. 03Authenticate directly inside the TUI with /connect so billing stays centralized in one dashboard.
  1. 01Already pay for GitHub Copilot or a ChatGPT Plus/Pro plan? OpenCode supports account-based provider plugins where allowed by your subscription terms.
  2. 02Run /connect inside OpenCode to inspect active auth connectors for your current version.
  3. 03Keep a low-cost API key (such as DeepSeek or Haiku 5.5) configured as a backup if subscription rate limits kick in mid-sprint.

How OpenCode works as an open source AI coding agent

Minimalist matte midnight navy mechanical keycap module resting beside layered translucent cobalt blue, frosted glass and warm amber command bars on a pale slate desk
OpenCode brings a fast terminal UI, multi-file agent edits, MCP tools and provider-agnostic model switching into one MIT-licensed CLI.

OpenCode (often searched as “open code” and maintained at github.com/anomalyco/opencode and opencode.ai) is an open source AI coding agent built in the open for developers who like the speed of Claude Code or Codex CLI without lock-in to a single model vendor. Running straight in your terminal on macOS, Linux or Windows (and also available as a native Desktop app), this open source coding agent edits files, runs shell tests, reads compiler errors, follows project AGENTS.md rules and loops until the build passes.

Three practical choices explain why OpenCode surged past 165,000 US monthly searches in late 2026:

  • True model freedom and parallel work: Switch mid-session from Claude Opus 5.5 for hard architecture to Claude Haiku 5.5, DeepSeek or Gemini Flash for test generation, run multiple agents in parallel across sessions, or drop to local Ollama on a flight with no Wi-Fi.
  • Built-in LSP, MCP and Desktop app options: OpenCode hooks into Language Server Protocols for real type errors, supports Model Context Protocol (MCP) servers for databases and docs, and offers a clean Desktop app alongside the terminal TUI.
  • MIT license and clear data handling: Because the code is built in the open on GitHub, you can audit data handling yourself, bring your own API keys for $0 to OpenCode, or choose optional flat-rate OpenCode Go ($10) or Zen credit plans.
YOUR MACHINE Repo + Shell Git diffs, tests, LSP MCP servers & skills LOCAL FILESYSTEM OPENCODE CLI / TUI Agent Loop Plan / Build modes Tool approval rules MIT LICENSE ($0) ANY MODEL BACKEND 75+ Providers Claude, GPT, Gemini DeepSeek, Ollama, Zen BYOK OR GO ($10/MO)
OpenCode separates the terminal coding loop from model billing: keep one familiar TUI workflow while swapping between cloud APIs, OpenCode Go, or offline local models.

OpenCode Go, Zen, BYOK and Desktop app pricing

Because the CLI and Desktop app are free to download, you only pay for inference. To install OpenCode on macOS via Homebrew, run brew install anomalyco/tap/opencode; on Node.js systems you can also run npm install -g opencode-ai or use the official installer script below. Checked December 1, 2026 against OpenCode’s docs and plan pages:

OpenCode pricing options, checked December 1, 2026
OptionPriceBest for
BYOK / Local$0 to OpenCode (provider API rates)Developers who already have Claude, OpenAI, DeepSeek or Ollama set up
OpenCode ZenPay-as-you-go prepaid creditsUsing frontier and open-weight models under one balance with auto-reload
OpenCode Go$10/monthSolo builders wanting a low flat monthly cap on curated open-weight models
OpenCode Go Plus$40/monthDaily coders needing higher flat caps across curated model families
EnterpriseCustom per seatTeams needing central billing, zero-data policies and org controls

OpenCode vs Claude Code and Codex CLI

If you are deciding between OpenCode, Anthropic’s Claude Code and OpenAI’s Codex, the split comes down to subscription economics versus vendor flexibility:

  • Pick OpenCode if you mix models (for example Opus 5.5 for design and DeepSeek or local Qwen for tests), want open-source auditable code, or need $10/month Go pricing.
  • Pick Claude Code if you live inside Claude Opus 5.5 all day and want Anthropic’s flat $20 Pro / $100 Max subscription pool instead of paying per-token API rates.
  • Pick Cursor if you prefer a full GUI IDE with inline Tab autocomplete rather than working primarily in a terminal.
Quick start commands
curl -fsSL https://opencode.ai/install | bash && cd your-repo && opencode
RelatedClaude Code guide: setup, pricing and limitsCLICompare Anthropic’s native terminal agent against OpenCode’s multi-model loop.

FAQ

Is OpenCode free?

Yes. The OpenCode CLI and TUI client are free and open source under the MIT license. You pay nothing to OpenCode if you connect your own API keys or run local models through Ollama or LM Studio.

How much does OpenCode Go cost?

OpenCode Go costs $10/month and Go Plus costs $40/month for flat-rate caps across curated models, with OpenCode Zen available for pay-as-you-go credits across frontier models.

Does OpenCode work with Claude Opus 5.5 and GPT-6?

Yes. OpenCode supports Anthropic, OpenAI, Google Gemini, DeepSeek, xAI, OpenRouter and local OpenAI-compatible servers, so you can route to Opus 5.5, Fable 5.2, GPT-6 or open-weight models in the same workspace.

Is OpenCode better than Claude Code?

OpenCode wins on openness, local offline coding and mixing cheap + frontier models. Claude Code often costs less if you run Opus 5.5 heavily every day inside a flat $20 Pro or $100 Max Claude subscription.

Sources

  1. OpenCode official website (opencode.ai) and GitHub repository (github.com/anomalyco/opencode), MIT license, install and provider docs, checked December 1, 2026
  2. OpenCode Go, Go Plus and Zen pricing documentation and ecosystem trackers, checked December 1, 2026
  3. Anthropic Claude Code and OpenAI Codex pricing pages for comparison, checked November and December 1, 2026

Spotted a mistake? Write to support@gptx.io and we will check it.

Keep reading