OpenCode: the open-source coding agent that makes model choice a decision again

OpenCode is the open-source coding agent that lives in the terminal and lets you bring your own model. Custom agents pair a model, a temperature and permissions into a specialist per task, and models.dev makes hundreds of providers available, from free and local models to frontier ones. It is a serious alternative to Claude Code.

Open source has stopped being the underdog in coding tools

OpenCode is an open-source coding agent that lives in the terminal — one of the fastest-growing developer tools on GitHub, with more than 180,000 stars. The number matters less than what it signals: developers are actively looking for an alternative to the closed, subscription-based coding tools, and they have found one.

The wish behind that momentum is threefold. No vendor binding — do not be locked to a platform or a model ecosystem. Free model choice — pick the best model for the task, not the one the platform allows. And cost control — do not pay for subscriptions when cheaper models do the job.

The question this article answers is what the tool actually is, what it does differently, and whether the open-source version really holds up where it matters: in production.

The same tool palette that made coding agents productive, free

OpenCode gives you the complete toolkit that made the paid coding agents famous — in a terminal, open source, with no subscription attached. The model does not just chat; it reads your files, runs commands, and searches the web.

  • bash and edit — the agent runs shell commands and edits files directly, so it can implement and test rather than only suggest.
  • grep — instant search across the codebase, so the agent works on the whole project, not just the open file.
  • web fetch and web search — up-to-date information instead of a frozen training cutoff.
  • A terminal UI you can start with `opencode`, with the agent's changes reviewable and undoable.

Bring-your-own-model is the strength the paid tools cannot copy

The defining feature of OpenCode is that you choose the model. Through the models.dev directory, hundreds of models are officially supported: free models, local models served on your own hardware, open-weight models like GLM and DeepSeek, and the frontier models from Google, Anthropic and OpenAI.

A model switch is one command — `opencode run --model provider/model` — so you are never bound to a platform's model catalogue. In our practice test, a cheap open-weight model held up on day-to-day implementation tasks against a frontier model costing many times more per token, and in web design it actually scored better on the design leaderboard than the frontier model we compared it against.

That is the whole point of bring-your-own-model: the choice of model becomes a routing decision your team makes, not a platform constraint you live with.

Executable artefact

A custom agent is a markdown file — the team-of-specialists idea, inspectable

OpenCode ships with two primary agents — build for implementation, plan for planning large features without touching files — and lets you define your own. Each custom agent gets its own model, temperature, permissions and instructions. Drop a file in .opencode/agents/ and call it with an @-tag.

# .opencode/agents/ui-engineer.md — a specialist defined in one file
---
model: glm-5.2                # cheap, strong at web design
temperature: 0.7              # higher for creative UI work
permissions:
  - edit                      # always allowed to edit
  - bash                      # and to run commands
description: UI components, styling, frontend work
---

You are the UI engineer on this team.
Follow the design system in AGENTS.md.
Build components with the existing style, never invent a new
pattern where a documented one exists. Write the test alongside
the component. Keep the diff small and reviewable.

The same shape applies to a review agent — model on a frontier model, temperature near zero for deterministic output, permissions read-only.

The honest economics

OpenCode vs Claude Code: where the cost argument actually flips

DimensionOpenCode (open source)Claude Code (paid harness)
LicenceMIT open source; you run itClosed source; subscription or API
Model choiceHundreds via models.dev — free, local, open-weight, frontierBound to the Anthropic model family
Tool palettebash, edit, grep, web fetch, web searchThe same core tools, in a polished agent
On API billingWins — access to far more, far cheaper modelsPer-token on Anthropic's models only
On an Anthropic subscriptionBlocked — third-party harnesses are not permitted on subscription plansWins — the subscription bundles heavy discounts on Claude Code
OrchestrationYou build it — custom agents and routingTighter out of the box; less model freedom

Qualitative, and deliberately so: which side wins is a function of your billing model, not of the tool. If you pay per token, OpenCode's model access usually wins on cost. If you are on an Anthropic subscription, the maths only works inside Claude Code — and that is a real constraint, not a marketing point.

The order a team actually builds orchestration in

  1. Define the custom agents before any rollout. A UI engineer on a cheap strong model, a review agent on a frontier model at low temperature, a research agent with read-only access. Each file is a specialist with a named model, temperature and permissions.
  2. Write the AGENTS.md once, benefit forever. OpenCode's inits command writes a checked-in AGENTS.md that teaches every agent the project conventions — the same idea as CLAUDE.md in Claude Code. Detailed instructions are the difference between a good agent and a hallucinating one.
  3. Route by task, not by tool. Use the @-tag to send each task to the right specialist. This is your model routing in miniature: cheap models for the mass of work, frontier models only where they matter.
  4. Review with low temperature and your own standard. A code review agent runs deterministic output at near-zero temperature against your team's rules. The gateway controls access and cost; the review controls quality.

A practice example, anonymised

A mid-size software team built a web application on a paid, closed coding agent with a subscription. Costs climbed, and the team was bound to the vendor's model selection. The tool was strong; the economics and the lock-in were the problem.

The team moved to OpenCode in the terminal, keeping the familiar tool palette — bash, edit, grep, web search. Two custom agents carried the workload: a ui-engineer on a cheap open-weight model strong at web design, and a review agent on a frontier model with a low temperature for deterministic code review. A checked-in AGENTS.md taught every agent the project conventions from day one.

The result, in the team's own words: costs dropped because the expensive frontier models were used only where they matter — review — while everyday code ran on the cheaper model. UI work that had previously been generic improved because a specialised design agent owned it. Detailed agent instructions plus the AGENTS.md cut both hallucinations and convention violations. And the team could adjust models and agents at any time, without changing platform.

Open source is production-ready, and the proof is the boring kind: a team that switched for cost and stayed for the control.

The Pexon view: open harnesses are a building block, not a religion

Our position is neutral in the way that is useful: we sell no tool. OpenCode is a serious option we include in every harness evaluation for customers, alongside the paid alternatives, because open source has earned its place in the platform architecture — model catalogue, gateway, and multi-harness orchestration all sit comfortably alongside it.

OpenCode fits the model-routing principle we build on: the right model for the right task — cheap models for volume, frontier models for quality, local models where data control wins. Custom agents are exactly that principle made executable, which is why we treat the orchestration, not the tool, as the deliverable.

The honest cost comparison is the part most vendors skip. On API billing, OpenCode usually wins because it can reach far more, far cheaper models. On an Anthropic subscription, the picture inverts: Anthropic blocks third-party harnesses, so the subscription's discounts only apply inside Claude Code. The decision therefore depends on your billing model and use case — and that is exactly what we help customers calculate, rather than assume.

The honest risks, because open source is not automatically easier. OpenCode has no auto-mode: it does not pick a model for you based on the task, so the orchestration over custom agents is something the team must build and maintain — that is where the training need lives. Provider subscriptions and tool strategy belong together, since a subscription can rule a harness out entirely. And the ecosystem moves fast: 180,000 stars and a growing models directory are momentum, not a reason to stop evaluating.

Sources: OpenCode — the open source AI coding agent · anomalyco/opencode on GitHub. Read 2026-08-28. Vendor documentation changes; verify against the current release.

Keep reading

Questions we get asked when a team is deciding between open and paid harnesses

Is OpenCode really an alternative to Claude Code?

Yes. It offers the same tool palette — bash, edit, grep, web fetch, web search — in a terminal UI many users rate as better, and adds free model choice and custom agents on top. Where it differs is orchestration: OpenCode does not pick a model for you automatically, so a team builds that routing itself with custom agents.

Is OpenCode cheaper than Claude Code?

On API billing, usually yes, because OpenCode can call hundreds of much cheaper models — free, local, or open-weight — that hold up on many tasks. On an Anthropic subscription it is different: Anthropic blocks third-party harnesses from its subscription plans, so the maths only works if you are paying per token anyway.

Which models can I use inside OpenCode?

Hundreds, through the models.dev directory: free models, local models served on your own hardware, open-weight models like GLM and DeepSeek, and the frontier models from Google, Anthropic and OpenAI. A model switch is one command; you are never bound to a platform's model catalogue.

What is a custom agent in OpenCode?

A custom agent is a configured specialist: its own model, temperature, permissions and detailed instructions, defined in a JSON file or a markdown file in .opencode/agents/. You call it with an @-tag for the right job — a design agent on a cheap strong model, a review agent on a frontier model with a low temperature. This is where the tool becomes a team of specialists instead of one assistant.

Next step

Get the harness decision costed before you build on one

Two weeks, fixed price. We run the same production tasks through OpenCode and the paid alternatives, map which of your models each agent should sit on, and hand over the routing design plus the cost comparison with real numbers. The design is yours whether or not we build it.