Skip to main content

Open Source · Deep dive

OpenCode: The Model-Agnostic Terminal Agent That Just Hit 160K Stars

OpenCode connects to 75+ AI providers from a single CLI, reads code through Language Server Protocol, and costs $2–8 per day instead of $20–40/month. Here's why 7.5M developers made the switch — and how to set it up.

160KGitHub stars — the most-starred open-source coding agent
By Skills-Hub Team · AI coding tools coverage8 min read
OpenCodeModel-AgnosticTerminal Agent

Most AI coding agents solve the interface problem and ignore the infrastructure problem. They give you a polished chat panel, then lock you into one model, one pricing tier, and one vendor's uptime. OpenCode, built by the team behind SST (now Anomaly), solves the infrastructure problem instead. It crossed 160,000 GitHub stars in June 2026 not because of clever marketing, but because it does two things nobody else does at the same time: connects to 75+ AI providers from a single terminal interface, and understands your code through Language Server Protocol rather than raw file reads.

Today also happens to be June 18, 2026 — the day Google shut down Gemini CLI's free tier. A lot of developers are looking for alternatives right now. Here is the full picture on OpenCode: what makes it technically different, what the cost math actually looks like, and where it falls short.

160K

GitHub stars

most starred open-source coding agent

75+

AI providers

Claude, GPT, Gemini, Qwen, Ollama, more

7.5M

monthly active developers

as of June 2026

The LSP insight that changes everything

Every other terminal agent reads your code as text. OpenCode reads it as code.

The distinction matters. When Claude Code or Codex CLI opens a TypeScript file, they see a string. When OpenCode opens the same file, it sees what your language server sees: live type errors, unresolved imports, function signatures, inferred return types. The model gets this diagnostic context as part of every prompt, which means it can verify its own changes compile before reporting back.

Builder.io ran a controlled test in May 2026: the same feature implemented by Claude Code and OpenCode (both using Claude Opus 4.7). Claude Code finished in 9 minutes 9 seconds. OpenCode took 16 minutes 20 seconds. OpenCode wrote 94 tests; Claude Code wrote 73. The slower wall-clock time was the LSP feedback loop at work — the agent was catching and fixing type errors mid-task rather than leaving them for you.

LSP diagnostics feed back into the model between tool calls. When the agent edits a file and the TypeScript compiler surfaces an error, OpenCode injects that error into the next prompt automatically. No human needs to copy-paste the compiler output.

Install and configure in 5 minutes

OpenCode ships as a single binary and a Node.js CLI. The Node path is fastest to get started:

Terminal
# Install globally
npm install -g opencode-ai

# First run — walks you through provider setup
opencode

# Or set your API key directly
export ANTHROPIC_API_KEY=sk-ant-...
opencode

The config file at ~/.config/opencode/config.json is where model routing lives:

~/.config/opencode/config.json
{
  "model": "anthropic/claude-opus-4-7",
  "providers": {
    "anthropic": { "apiKey": "$ANTHROPIC_API_KEY" },
    "openai":    { "apiKey": "$OPENAI_API_KEY" },
    "ollama":    { "baseUrl": "http://localhost:11434" }
  },
  "lsp": {
    "typescript": { "command": "typescript-language-server", "args": ["--stdio"] },
    "rust":       { "command": "rust-analyzer" },
    "python":     { "command": "pyright-langserver", "args": ["--stdio"] }
  },
  "models": {
    "hard": "anthropic/claude-opus-4-7",
    "fast": "qwen/qwen-3-7-max",
    "local": "ollama/llama3.1:8b"
  }
}

Model routing: the real cost lever

Model agnosticism is only valuable if you route intelligently. Using Claude Opus 4.7 for every task (including renaming a variable) costs the same as using a scalpel to open a letter. The OpenCode community has converged on a three-tier routing strategy in 2026:

Three-tier model routing
HARD tasks     → Claude Opus 4.7
  Multi-file refactors, architectural changes, security audits,
  migration planning. Anything where wrong is expensive.

FAST tasks     → Qwen 3.7 Max  (debuted #4 on coding leaderboards)
  Single-file edits, docstrings, test generation against existing
  fixtures, boilerplate. High volume, low stakes.

LOCAL tasks    → Llama 3.1 8B via Ollama
  Offline sessions, sensitive codebases, CI pipelines that can't
  exfiltrate source code, EU air-gap requirements.

Switch tiers mid-session with a slash command:

Terminal
/model fast    # switch current session to Qwen 3.7 Max
/model hard    # back to Opus 4.7 for the next task
/model local   # drop to Llama offline
We run about 80% of our OpenCode sessions on Qwen 3.7 Max and only promote to Opus when we hit a multi-file problem. Monthly API spend dropped from $340 to $85 without any change to output quality on routine work.
, Builder.io engineering team

Cost comparison vs subscription tools

OpenCode charges nothing. You pay only for the API calls it makes. That means cost scales with usage, which is a feature for teams that don't code every day and a risk for teams that do.

$2–8

typical daily cost with Opus 4.7 routing

vs $20–40/month flat for Cursor or $10–19/month for GitHub Copilot. Heavy users hit $20–25/day; light users pay cents.

The break-even against Cursor ($32/seat/month standard, $96/month premium) is roughly 4–12 hours of active coding per month. If you code full-time, you will likely pay more via OpenCode on the expensive tier. If you code 2–3 hours a week on a mix of hard and fast tasks, you will pay less. The math only works if you route correctly.

Air-gapped deployment and EU compliance

The EU AI Act's operational transparency requirements take full effect August 2, 2026. For teams processing personal data or operating in regulated verticals, routing prompts through a US-hosted cloud model creates compliance exposure. OpenCode's local model path via Ollama eliminates that exposure entirely.

Air-gapped setup (no network calls)
# Pull models locally first (on a network-connected machine)
ollama pull llama3.1:70b
ollama pull codestral:22b

# Lock OpenCode to local-only in your regulated project
cat > ./opencode.json << 'EOF'
{
  "model": "ollama/codestral:22b",
  "providers": {
    "ollama": { "baseUrl": "http://localhost:11434" }
  },
  "allowExternalProviders": false
}
EOF

opencode  # no internet calls made

Air-gapped mode is already in use by several EU fintech teams who shared configurations in the OpenCode GitHub Discussions. TheallowExternalProviders: false flag hard-errors if a session tries to call any non-local provider, which is the audit trail regulators want.

What it still can't do

OpenCode is a terminal agent. It has no IDE integration, no visual diff viewer, no inline ghost text. If you work primarily in VS Code or JetBrains and want completions while you type, OpenCode is not your tool — Cursor or Copilot still owns that surface.

The multi-agent story is also thinner than Claude Code's. Claude Code ships subagents as a first-class primitive, with isolated context windows and a typed handoff protocol. OpenCode can spawn background tasks, but coordination between them is manual. For teams building agent pipelines rather than one-off coding sessions, Claude Code is still the better base.

The honest summary: OpenCode is the right tool if you want to own your model choice and your infrastructure, run offline, and pay per invocation. It is not the right tool if you want a polished IDE experience or first-class multi-agent orchestration. Both needs are real — they just belong to different tools.

Terminal
# Install OpenCode and add your first skill
npm install -g opencode-ai
npx @skills-hub-ai/cli install code-review --platform opencode

# Start a session
opencode

Browse all OpenCode-compatible skills at /opencode-skills, or compare the full 2026 agent landscape if you're still deciding.

Written by

Skills-Hub Team

AI coding tools coverage

Skills-Hub is the open registry for AI coding skills, 4,400+ SKILL.md files synced daily from Anthropic, Google, Microsoft, and 90+ official sources. Free + MIT.

Continue reading