Your Coding Agent Bill Is a Reading Bill

A model in OpenCode is a setting on each agent, not one choice for the whole tool, and real opencode stats output shows that reading context, not writing code, is what you pay for, so the fix for a surprise bill is the right model per agent, not a cheaper model everywhere.

Rick Hightower

Cover image for “Your Coding Agent Bill Is a Reading Bill” by Rick Hightower

OpenCode lets every agent read on a different model. Real opencode stats output shows where the money goes, which agents you never talk to are spending it, and how to give each one the cheapest model that does its job well.

You set your strongest model once, worked a normal week on a tiny service, and the invoice came back several times what you expected, with no way to tell which part of the work spent it.

In this article: Day 9 of a 17-day guide. Start here moves two jobs nobody reads closely, session titles and explore searches, to Gemini 3.5 Flash-Lite in Ticket Triage's opencode.jsonc, then proves with opencode debug agents and opencode stats that the search ran on the cheaper model. Going deeper reads a real OpenCode 2.3.0 cost report line by line, maps the six places a model gets chosen and the hidden agents that inherit your most expensive model, prices the same tokens on four models, and covers caching, local models, and a full per-agent model block.

Part 8 ran one question on two Gemini models and handed a live session from one to the other with --continue and -m. Today you make that choice once, in configuration, for the jobs that do not need your best model.

Start here

By the end of today, the two jobs nobody reads closely in Ticket Triage, session titles and explore searches, run on a cheaper model, and opencode stats shows you which model did the work.

Starting fresh or fell behind? Run git switch -C main opencode/day-08. This replaces your main with the end of Day 8; to keep your own work, run git branch my-backup first.

Every agent reads on some model

An agent is a role with its own instructions and rules. You have met two: build, the default agent from Part 1, and plan, the agent from Part 3 that plans without editing. OpenCode ships others that you never type to, and two of them do simple work.

  • title writes the short name of each session, the name you see in a list of sessions. It uses no tools.
  • explore is a helper that build can hand a search to. It works in a separate session of its own, reads and searches files but does not edit them, and sends its findings back to build, which reads them before it acts.

No built-in agent sets a model. Each one uses the model of the session it works for, so the model you picked for real work also writes every title and runs every search. A title is one line that nobody grades, and build checks a search result before it uses it, so both jobs fit a cheaper model. In Part 8, Gemini 3.5 Flash-Lite answered a simple question about Ticket Triage correctly. Today you give it these two jobs for good, and you keep Gemini 4 Hydrogen for the work you watch (tested on OpenCode 2.3.0 on November 16, 2026).

See what the agents use today

opencode debug agents prints every agent with its settings, as JSON, a structured text format. The output is long, so filter it for the word "model" and the three lines after each match.

cd ~/code/ticket-triage
opencode debug agents | grep -A3 '"model"'

The command prints nothing. No agent has a model of its own yet, which is the starting point this section changes.

Give two agents the cheaper model

Ticket Triage's settings live in opencode.jsonc, the file you committed in Part 4. Open it and add two things above the permissions list: a model line and an agents block. Every rule in the list stays exactly as it is. The file below leaves out the three comment lines from Part 4 to stay short, and comments do not change any rule.

{
  "$schema": "https://opencode.ai/config.json",

  // The default model for build and for any agent without its own model.
  "model": "google/gemini-4-hydrogen",

  "agents": {
    // Searches that build hands off: the parent checks the result.
    "explore": { "model": "google/gemini-3.5-flash-lite" },
    // Session titles: one short line, no tools.
    "title": { "model": "google/gemini-3.5-flash-lite" },
  },

  "permissions": [
    { "action": "external_directory", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "git status *", "effect": "allow" },
    { "action": "shell", "resource": "git diff *", "effect": "allow" },
    { "action": "shell", "resource": "npm test *", "effect": "allow" },
    { "action": "shell", "resource": "git push *", "effect": "deny" },
    { "action": "*", "resource": "*.env*", "effect": "deny" },
    { "action": "*", "resource": "*.env.example", "effect": "allow" },
  ],
}

Three settings are new, and each has one job.

  • model. The default model for build, and for any agent that has no model of its own. With it set, an everyday opencode run needs no -m.
  • agents.explore.model. The model the explore helper uses for every search.
  • agents.title.model. The model that writes session titles.

The model names are the same provider/model references that Part 8 used. If your list from opencode models showed different Gemini names, copy yours. Now check that OpenCode read the change.

opencode debug agents | grep -A3 '"model"'

This time the command prints two blocks, one for explore and one for title, in that order, because the agents are listed by name.

    "model": {
      "id": "gemini-3.5-flash-lite",
      "providerID": "google"
    },
--
    "model": {
      "id": "gemini-3.5-flash-lite",
      "providerID": "google"
    },

The model block is now part of how the repository works, so commit it.

git add opencode.jsonc
git commit -m "Pick a cheaper model for explore and titles"

Watch a search run on the cheaper model

opencode stats reports what your sessions used: tokens, steps, and cost. A token is a short piece of text, a word or part of one, and providers count and bill by tokens. A step is one request to the model. --models adds a row per model, and --project . limits the report to the project in the current folder. Take a baseline first.

opencode stats --models --project .

Find the MODELS block and note the steps number on the google/gemini-3.5-flash-lite row. Part 8's run put one there; if you skipped it, the row is missing, and that is fine. Now ask build for a search that invites a hand-off. Leave out -m, because the new model line picks Hydrogen.

opencode run "Use the explore subagent to find every place a category string is returned in src/ and test/, then tell me whether any test covers the \"broken link\" false positive. Do not edit any file."

The output starts with > build · gemini-4-hydrogen. A line ending in Explore Agent appears when build hands off the search, then waiting for 1 background job while the helper works, then the answer. The prompt says "subagent," OpenCode's word for a helper agent that another agent starts, and the background job is the helper's search, which build waits for. In the test, a single run, build listed the four lines in src/classify.js that return a category and said that no test mentions "broken." Check the part of that claim that matters: whether any test uses the false-positive ticket.

grep -c "link in your email" test/classify.test.js

The command prints 0: no test uses that ticket. Do not count the word "broken" instead, because the damage tests your model wrote in Part 3 may well use it. Now run the report again.

opencode stats --models --project .

In the test, the block looked like this after the run. A long model name is cut off with ….

MODELS
model                                 tokens       steps        cost
google/gemini-4-hydrogen               77.3k           4       $0.05
google/gemini-3.5-flash-lite#defa…     67.5k           7       $0.02
google/gemini-4-hydrogen#default       36.8k           2       $0.03

Your numbers will differ. The check is the steps number on the Flash-Lite row: it is higher than in your baseline, although you never typed that model's name. The explore helper ran on it. In the test, the two Hydrogen rows were the same model chosen two ways: the row with no suffix is the run that took its model from the model line, and the #default row is the earlier runs where -m named it.

Last, confirm that the search changed nothing.

git status --short

The command prints nothing.

What you set up

Today's win is three checks: opencode debug agents shows Flash-Lite on explore and title, the Flash-Lite row in opencode stats grew after a run that never named it, and git status --short prints nothing.

The work you watch, build and plan, still runs on Hydrogen. Only the two jobs whose output something else checks moved to the cheaper model. Leave every other agent alone for now. Going deeper explains which other agents read on your model, why one of them should stay on a capable model, and how to read the cost in the report.

You can stop here. Going deeper explains why this works and where it breaks.

Going deeper

This section is for readers who want the real cost report behind the advice, the six places a model gets chosen, the agents you never talk to, prices, caching, local models, and a full model block for every agent. It assumes you finished Start here in this part and in Parts 1 to 8.

A week on the most expensive model

In Part 8's Going deeper you connected three providers, asked each the same question, and the strongest Anthropic model gave the cleanest answer. You added one line to your global ~/.config/opencode/opencode.jsonc, "model": "anthropic/claude-opus-5-5", and spent a week on a small support-ticket service. You chased a false positive, wrote two tests, let a long session compact, and let the agent send its search subagent through the repository a dozen times.

Then the invoice arrived, several times what you expected for three source files. This is a scenario, not a recorded week, but the mechanism is documented. No built-in OpenCode agent sets a model. Every search inherited your session's model, your session's model wrote every compaction summary, and the session titles probably went the same way. opencode stats --models showed one row, because one model did everything: the decisive planning, the routine edits, and the work nobody reads.

The fix is not a cheaper model everywhere. The fix is the right OpenCode model per agent: a capable default for the work you watch, a higher reasoning variant when you plan, and a cheap model where a weaker answer costs nothing. This section prices real usage, maps where models get chosen, covers caching and local models, and ends with a config you can measure.

One global Opus line feeds the session model; build and plan use it directly, while explore, compaction, and likely title inherit it, so every agent lands on one bill with a single model row

Scene: a frustrated developer at a desk scratching their head at a cloud invoice far larger than expected for a tiny service, with a one-row usage report on the second monitor

The scene is the opening moment: one model line in a global file, a week of ordinary work, and a bill that cannot say which agent spent it.

Where the money actually went

Before you change a model, look at what the money paid for. The evidence here is real: the author's eleven headless test sessions on OpenCode 2.3.0 against Ticket Triage, a small Node.js service that classifies support tickets. Every run used google/gemini-3.5-flash. Afterward, opencode stats (commands page) summarized "11 sessions · 1 subagent", "11 prompts · 69 steps · 1.2m tokens", and "58.7% tool success". The TOOL RELIABILITY rows below give 26 errors in 62 calls, or 58.1 percent success, so opencode stats counts its summary figure differently from the table. The --full flag, which equals --cost --models --tools, added three blocks.

opencode stats --full

The output from that test install follows, unedited.

COST & TOKENS
  cost                $0.86
  input               409.3k
  output              2.2k
  reasoning           11.4k
  cache read          788k
  cache write         0
  cached input        65.8%
MODELS
model                                 tokens       steps        cost
google/gemini-3.5-flash#default         1.2m          69       $0.86
TOOL RELIABILITY
tool                                   calls       error         p50
read                                      24       45.8%         8ms
shell                                     21       42.9%        19ms
glob                                       9       66.7%         9ms
execute                                    5       0.00%        10ms
grep                                       3       0.00%        18ms

Read the first block from the bottom. cache read is 788k and input is 409.3k, and 788k is 65.8 percent of their sum, so input counts only tokens the provider did not serve from its prompt cache. The model read about 1.2 million tokens and wrote 2.2 thousand, plus 11.4 thousand of reasoning. For every token it wrote, it read more than eighty.

The MODELS block has one row, printed with its variant, #default, so it cannot tell you which agent spent what. The high error rates in TOOL RELIABILITY are not flaky tools; they are permission denials from deliberate escalation tests, which stats counts as errors. The "1 subagent" in the summary is one explore launch, because subagent sessions count too.

Now put prices on it. The Console price table in the OpenCode docs, dated here to November 15, 2026, lists Gemini 3.5 Flash at $1.50 input, $0.15 cached read, and $9.00 output per million tokens. Uncached input costs about $0.61, cached reads about $0.12, and output plus reasoning about $0.12. The sum, $0.85, lands within a cent of the $0.86 that stats printed. Reading context paid for roughly 85 percent of the bill.

Infographic: reading context pays the bill. Eleven real sessions cost $0.86; 788k cached and 409.3k uncached tokens were read against 13.6k written, and uncached input alone cost $0.61

The model read 788,000 cached tokens and 409,300 uncached ones while writing about 13,600, and uncached input alone cost $0.61 of the $0.86.

Why did so much input miss the cache? The first request in a near-empty Ticket Triage project measured 18,247 input tokens, before anything was cached. The run and these sessions shared one setup, with the author's 56 personal skills in view, which Part 6 shows add about 12,000 tokens to every first request. If every session's first request missed the same way, eleven of them account for about 200,000 tokens, roughly half the uncached input. Short sessions pay the uncached floor again and again. Cached or not, the price that matters most is the input price of every model that reads context, which in a coding agent is every model, on every step.

Read a model reference before you write one

Every place where you choose a model takes the same string, per the models page: provider/model, with an optional #variant.

anthropic/claude-sonnet-5-5
anthropic/claude-sonnet-5-5#high
openrouter/anthropic/claude-sonnet-5.5#high
ollama/qwen3:8b

The provider ends at the first /, and the model may contain more slashes. The variant follows #; variants are named options such as low, high, and max that come from catalog metadata and differ by model, and an unknown one is a resolution error. IDs are case-sensitive catalog IDs, so copy what opencode models prints: the direct Anthropic route spells Sonnet claude-sonnet-5-5, while OpenRouter spells it anthropic/claude-sonnet-5.5.

Six places a model gets chosen

OpenCode decides which model answers a request from up to six places. A model configured in the wrong place simply never gets used.

Table: Place, Key or control, Scope, Keeps the variant. Rows: Root default; Session selection; One headless run; An agent; A command; Hidden agents.

Each of the six places where OpenCode selects a model reaches a different set of requests. The "Place" column names the source, "Key or control" names what you set or press, "Scope" names which requests it reaches, and "Keeps the variant" says whether a #high suffix survives there.

  • Root default is model in opencode.jsonc, for new work with no other selection, and it silently drops any variant. If its provider is unavailable, OpenCode falls back to "the newest available supported model."
  • Session selection comes from /models, <leader>m, F2, or Ctrl+T, covers the current session, and keeps the variant. It beats the configured default and never rewrites the config file.
  • One headless run uses opencode run --model (or -m) for that run only and keeps the variant.
  • An agent uses agents.<id>.model or frontmatter, reaches subagent sessions and commands that select the agent, and keeps the variant. The agents page says: "A subagent uses its configured model, or inherits the parent session's model when none is configured." This row fixes the opening's bill.
  • A command uses its own model, per the commands page, for one invocation and keeps the variant. A command model overrides every other; otherwise the command's agent's model wins; otherwise the session model stays.
  • Hidden agents use agents.title.model and agents.compaction.model for titles and summaries and keep the variant. V1's small_model maps to agents.title.model, per the migration guide, and the compaction page documents agents.compaction.model.

A variant survives everywhere except the root default.

Decision flow for which model answers a request: a command's own model wins, then the selected agent's model, then a subagent inherits its parent, then the session selection, then the root model with its variant dropped, and finally the newest available supported model

Gotcha: an agent's model applies when something selects that agent for a request, and the TUI's agent switch may not count. In the author's 2.3.0 tests, a single opencode run --agent plan ran on the model in agents.plan.model. Pressing Shift+Tab into plan is different: the agents page says "Selecting a primary agent by ID does not change that model." Until your release shows otherwise, change the reader yourself after you switch agents in the TUI.

If you learned V1: a separate variant field became a #variant suffix. A per-agent temperature from old tutorials is preserved but, per the agents page, "not yet" sent with model requests; put sampling settings on a model variant instead.

The agents you never talk to

The opening's bill came from agents you never typed a word to. opencode debug agents on a real 2.3.0 install shows seven built-ins and no model on any of them.

  • build. The default primary agent. It reads the session model, and most of your token volume runs here.
  • plan. A primary agent that cannot edit project files. Its output is a short, decisive plan, so a higher reasoning variant earns its price here more than anywhere.
  • explore. A read-and-search subagent that inherits the parent's model. The parent checks a search result anyway, which makes it the classic seat for a cheap model.
  • general. A subagent that can edit. Leave it on the session model; a cheap model that edits is a cheap model that edits badly.
  • title. A hidden agent that writes the session title and denies every action.
  • compaction. A hidden agent that writes the summary when a long session nears its window, by default on the session's model.
  • summary. A hidden maintenance agent with no documented model setting, so leave it alone.

Titles are where your guess may have been wrong. The Console models page notes that low-cost models show up in usage history because "OpenCode uses these models to generate session titles," but no V2 docs page says which one it picks. Pinning agents.title.model replaces a guess with a decision you can read.

Overriding a built-in uses the documented rule, "Override a built-in by using the same ID," and the author's tests confirm it: with agents.explore.model set, the explore child ran on that model, not the parent's. In 2.3.0, subagents "always run in the background," so several can run at once, each billed. A child starts with fresh context but still pays the fixed floor: in a single run, one general child request sent 16,653 input tokens to answer a one-line question.

During the day, you switch by hand. /models or <leader>m (the leader is Ctrl+X) opens the picker, /variants picks a variant by name, F2 cycles recent models, and Ctrl+T cycles the current model's variants, per the keybinds page. Since v2.2.5, a switch no longer flattens the earlier model's reasoning into text. Switch into plan with Shift+Tab, press Ctrl+T until the variant you want shows, and you have the stronger planner.

What a token costs on each row

These are the three Claude 5.5 models from the Console price table, per million tokens, as of November 15, 2026.

Table: Model, Input, Output, Cached read, Cached write. Rows: Claude Opus 5.5; Claude Sonnet 5.5; Claude Haiku 5.5 (up to 100K tokens); Claude Haiku 5.5 (over 100K tokens).

The Console prices for the three Claude 5.5 models answer one question: which model should read the context an agent resends on every step? The "Model" column names the row, and the other four columns give the dollar price per million tokens for input, output, cached reads, and cached writes. Input and cached reads are where the bill lives.

  • Claude Opus 5.5 costs $4.00 input and $20.00 output, with a $0.20 cached read (one-twentieth of input) and a $5.00 cached write (1.25 times input, the five-minute cache price on Anthropic's pricing page).
  • Claude Sonnet 5.5 costs $2.00 input, $10.00 output, $0.10 cached read, and $2.50 cached write, exactly half of Opus on every column.
  • Claude Haiku 5.5 (up to 100K tokens) costs $0.10 input, $0.50 output, $0.01 cached read, and $0.125 cached write, forty times cheaper than Opus on input.
  • Claude Haiku 5.5 (over 100K tokens) costs $0.50 input, $2.50 output, $0.05 cached read, and $0.625 cached write, five times its lower tier.

A cheap model is cheap only while its context stays small, which suits explore's fresh child sessions and title's single short request.

Same tokens, four price tags

Apply those rows to the real usage from the start: 409.3k uncached input, 788k cached reads, and 13.6k tokens of output and reasoning. This is arithmetic, not runs; a different model would take different steps, so treat each total as an order of magnitude.

Table: Model row, Uncached input, Cached read, Output and reasoning, Total. Rows: Gemini 3.5 Flash; Claude Opus 5.5; Claude Sonnet 5.5; Claude Haiku 5.5 (up to 100K).

One real usage profile, priced on four Console rows, shows how much the reader's model changes the bill. The "Model row" column names the price row, the next three columns give dollars for uncached input, cached reads, and output plus reasoning, and "Total" sums them.

  • Gemini 3.5 Flash totals $0.85 ($0.61, $0.12, $0.12), which is what actually happened, within a cent of the reported $0.86.
  • Claude Opus 5.5 totals $2.07 ($1.64, $0.16, $0.27), about 2.4 times Flash, nearly all of it in uncached input.
  • Claude Sonnet 5.5 totals $1.03 ($0.82, $0.08, $0.14), about half of Opus, so Sonnet versus Opus is mostly an input-price decision.
  • Claude Haiku 5.5 (up to 100K) totals $0.06 ($0.04, $0.01, $0.01), about one thirty-fifth of Opus: the price of "good enough" for a search the parent checks.

Infographic: same tokens, four price tags. The same usage totals $2.07 on Opus, $1.03 on Sonnet, $0.85 on Gemini Flash, and $0.06 on Haiku, driven by input prices of $4.00, $2.00, and $0.10 per million

Input prices drive all four totals. The opening's week is the Opus row applied to every agent; the rest of this article moves each agent to the cheapest row that does its job well.

Keep the cache warm, or do not

Cached reads cost one-tenth to one-twentieth of input, so a warm cache is your biggest discount. On routes known to need them, such as Anthropic, OpenCode places prompt-cache breakpoints automatically, and Gemini caches without markers, which is how the test runs reached 65.8 percent cached input with no configuration.

The one route that loses caching silently is Claude behind an OpenAI-compatible proxy such as LiteLLM, because OpenCode cannot tell the model needs Anthropic-style markers. The models page shows the fix.

{
  "providers": {
    "litellm": {
      "package": "@opencode/ai/providers/openai-compatible",  // ①
      "settings": { "baseURL": "https://litellm.example.com/v1" },
      "models": {
        "claude-sonnet-5-5": {  // ②
          "compatibility": { "cacheFormat": "anthropic" },  // ③
        },
      },
    },
  },
}

① The proxy speaks the OpenAI request format, which is why OpenCode cannot tell on its own that a Claude model sits behind it.

② The fix goes on the proxied model, not on the whole provider, so other models behind the same gateway are unaffected.

③ The cacheFormat setting tells OpenCode to place Anthropic-style cache markers on requests to this model.

Note: The full extracted listing at code/opencode/part-9-right-model/listings/02-litellm-cache-format.jsonc is the complete file, ready to copy.

Anthropic's default cache lifetime is five minutes. Step away for coffee and the next request reads the whole conversation at full input price. You have two documented ways to stretch it. The first is a longer lifetime, settings.cache.ttl, on a provider or a model.

{
  "providers": {
    "anthropic": {
      "settings": { "cache": { "ttl": "1h" } },
    },
  },
}

A longer lifetime costs more to write: "Anthropic charges 2× the input price for a one-hour cache write and 1.25× for a five-minute one." It pays off when your pauses run past five minutes and you return to the same session.

The second is warming, off by default. With "warming": true, OpenCode sends a keep-alive at 90 percent of cache.ttl, or every four minutes when none is set, until 30 minutes have passed since your latest real request. Each keep-alive asks for OK with no tools and discards the answer. A "5m" cache is warmed every 4.5 minutes.

Sequence of a coffee break: without warming, the next prompt after five minutes pays full input price; with warming, OpenCode sends billed keep-alives at 90 percent of the cache lifetime until 30 minutes after the last real request, and the next prompt reads from cache

Gotcha: warming and a one-hour cache do not combine by default, because a "1h" lifetime outlives the 30-minute default duration. Every keep-alive is billed, and without a cache.ttl the four-minute default allows seven in one half hour, by the author's arithmetic. Pick one strategy per provider.

Local models, and where they fail

A local model has no per-token bill, which makes it tempting for every cheap job. It fails in three ways a hosted model does not: the window it serves, whether discovery found it, and whether its tool calls work.

Context size. OpenCode reads the model's trained context length from Ollama (ollama.ts, lines 86 and 87, at v2.3.0), but the server decides what it actually loads. In one of the author's tests, Ollama 0.31.1 loaded the 3B llama3.2:latest at its full 131,072 tokens and used 17 GB of memory. Run ollama ps and read the CONTEXT column. Ollama's documentation ties the default to memory, 4K under 24 GiB of VRAM and 256K at 48 GiB or more, and Ollama caps it at the model's trained length, so a machine in a high memory tier loads llama3.2 at its trained 131,072 tokens, as the test did. The same page says coding tools need at least 64,000 tokens; set it on the server, and declare the same number as the model's limit.context so compaction plans against the real window.

OLLAMA_CONTEXT_LENGTH=64000 ollama serve

Discovery. OpenCode finds Ollama models in the background, and a short-lived server can exit first. In the tests, opencode run --standalone -m ollama/llama3.2:latest failed with "Model unavailable: ollama/llama3.2:latest". With a long-running opencode serve, the model appeared within seconds.

Tool calling. For an OpenAI-compatible server not in its catalog, OpenCode assumes tool support, a 200,000-token context, and 32,000 output tokens, which the models page calls "fallback assumptions, not detected capabilities." Discovered vLLM models start with tools disabled, because vLLM's tool flags live on the server. Declare the real values on the model.

{
  "providers": {
    "local": {
      "name": "Local server",
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "http://127.0.0.1:1234/v1" },  // ①
      "models": {
        "coder": {
          "modelID": "model-name-on-server",  // ②
          "capabilities": { "tools": true, "input": ["text"], "output": ["text"] },  // ③
          "limit": { "context": 32768, "output": 8192 },  // ④
        },
      },
    },
  },
}

① The provider points at a server on your own machine through the OpenAI-compatible package.

② The OpenCode ID stays coder, while modelID sends the name that the server expects upstream.

③ The declared capabilities replace the fallback assumptions, and tools decides whether OpenCode offers tools at all.

④ The declared limits replace the assumed 200,000-token context, so compaction plans around the window that the server actually serves.

Note: The full extracted listing at code/opencode/part-9-right-model/listings/03-local-server-model.jsonc is the complete file, ready to copy.

Model size. The V2 docs recommend no local models, and the author's tests, one run each, show where a small one breaks. As the build model, llama3.2 ran npm test and answered correctly for $0.00. As explore, under a parent on google/gemini-3.5-flash, it was asked to find which file defines the ticket priority rules.

  • It globbed **/src/main.ts, a file the project does not have, then **/src/**/, and matched nothing both times.
  • It wrote {"name": "git_ls_files", "parameters": {}} as plain text, a call to a tool that does not exist, and stopped.
  • Its session still recorded "outcome": "succeeded", and the parent redid the search with grep, glob, and read to answer src/classify.js.

Sequence of a failed local search: build on Gemini Flash delegates to explore on llama3.2, which globs twice with no matches, emits a fake tool call as text, and reports success; build then redoes the search with grep, glob, and read at hosted prices

The free search was redone at hosted prices, and nothing marked the failure. Public reports in OpenCode's issue tracker describe the same kind of failure with small local models: tool calls returned as text with a false success (#21181) and calls to a tool that does not exist (#21354). explore lives on tool calls, so it is exactly where a small local model hurts. title never calls a tool, which makes it the safest seat for a local model once a running server has discovered it.

A model block for Ticket Triage

This section continues the week on Opus, so its model IDs are Anthropic's; Start here's Gemini block has the same shape. Now replace the one global line with a decision per agent. The pairing is editorial; OpenCode recommends no model for any job, so swap in your own providers and keep the shape. Delete the Opus line from your global file first, or your other projects keep reading every step on the most expensive row.

// ~/.config/opencode/opencode.jsonc: delete this line
"model": "anthropic/claude-opus-5-5",

Then replace the model line and the agents block from Start here in the project's opencode.jsonc with these, above the existing permissions list. Keep any compaction or references block you added in the Going deeper sections of Parts 5 and 7; the listing leaves them out.

{
  "$schema": "https://opencode.ai/config.json",

  // The default reader for build and for any agent without its own model.
  "model": "anthropic/claude-sonnet-5-5",  // ①

  "agents": {  // ②
    // Planning: same model, higher reasoning variant. Applies to `opencode run
    // --agent plan` and commands with agent: plan; in the TUI, press Ctrl+T.
    "plan": { "model": "anthropic/claude-sonnet-5-5#high" },  // ③

    // Read-and-search subagent: the parent checks its results, so cheap is fine.
    "explore": { "model": "anthropic/claude-haiku-5-5" },  // ④

    // Session titles: no tools, one short request. Pin it instead of guessing.
    "title": { "model": "anthropic/claude-haiku-5-5" },  // ⑤

    // Summaries carry decisions forward (Part 7). Keep a capable model here.
    "compaction": { "model": "anthropic/claude-sonnet-5-5" },  // ⑥
  },

  "permissions": [  // ⑦
    { "action": "external_directory", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "*", "effect": "ask" },
    { "action": "shell", "resource": "git status *", "effect": "allow" },
    { "action": "shell", "resource": "git diff *", "effect": "allow" },
    { "action": "shell", "resource": "npm test *", "effect": "allow" },
    { "action": "shell", "resource": "git push *", "effect": "deny" },
    { "action": "*", "resource": "*.env*", "effect": "deny" },
    { "action": "*", "resource": "*.env.example", "effect": "allow" },
  ],
}

① The root model is the default for build and for every agent that names no model of its own, and it carries no variant because the root default drops one.

② The agents block overrides the model per agent, keyed by the built-in agent name.

③ The plan agent keeps the same model and adds the #high reasoning variant for its short, decisive output.

④ The explore subagent moves to the cheapest model, because the parent checks its results.

⑤ The title agent uses no tools and writes one line, so it is pinned to the cheap model instead of inheriting the session model.

⑥ The compaction agent stays on the capable model, because its summaries carry decisions forward.

⑦ The permissions list from Part 4 follows unchanged below the new blocks.

Note: The full extracted listing at code/opencode/part-9-right-model/listings/04-ticket-triage-model-config.jsonc is the complete file, ready to copy.

Ticket Triage's split: build, general, and compaction read on Sonnet; plan reads on Sonnet at the high variant; explore and title read on Haiku

The compaction choice is deliberate. A summary is where the session decides what to remember: cheap is right where a weak answer costs nothing, and a weak summary costs a rule. OpenCode also mixes vendors per agent, so explore could just as well read on google/gemini-3.5-flash if that provider is connected.

Model IDs are not secrets, so the block can live in the committed file. A teammate without an Anthropic key gets the root fallback, "the newest available supported model"; if your team does not share a provider, keep the block in your global file. Confirm the file loads and the agents picked it up.

opencode debug config
opencode debug agents

opencode debug config should list the project's opencode.jsonc among its sources, and each configured agent now prints its model, as in "model": {"id": "claude-haiku-5-5", "providerID": "anthropic"} for explore. Config files reload automatically, and opencode reload applies a change to an open TUI session at its next step.

Measure the split

A configuration stays a hypothesis until stats confirms it. Record a baseline before your next real task, scoped to the project.

opencode stats --cost --models --project .

Then do real work that delegates. In the TUI, in build, ask for a search.

Use the explore subagent to find every place a category string is returned in src/ and test/, then tell me whether any test covers the "broken link" false positive.

build launches explore in the background, the child searches on Haiku, and the parent answers on Sonnet. Run stats again, and MODELS should show one row per model that did work. The author's 2.3.0 tests used a different split, with google/gemini-3.5-flash as root, google/gemini-3.5-flash-lite for plan and title, and ollama/llama3.2:latest for explore.

MODELS
model                                 tokens       steps        cost
google/gemini-3.5-flash               154.4k           8       $0.08
google/gemini-3.5-flash-lite           74.2k           4       $0.01
ollama/llama3.2:latest#default         34.4k           5       $0.00

Three models, three prices, one project. In the same tests, in single runs, a plan run's first step on Flash Lite cost $0.0055 for 18,149 input tokens, against $0.0285 for a same-size request on Flash.

Infographic: one model per agent, then measure. Sonnet for build, general, and compaction, Sonnet high for plan, Haiku for explore and title; a real split cost $0.08, $0.01, and $0.00, and one plan step cost $0.0055 on Flash Lite against $0.0285 on Flash

Set the split, then measure it: each agent on a model that fits its job, three rows at $0.08, $0.01, and $0.00, and a planning step five times cheaper on the lighter model. If the Haiku row never appears, build may have answered without delegating; check the transcript for a subagent tool call before you blame the model block.

If you already use Claude Code: /model saves the pick as your default for new sessions, and pressing s on a row switches for the current session only (commands page). Its built-in Explore subagent uses the parent conversation's model since Claude Code 2.1.198, not Haiku, and the subagents page suggests a user-defined Explore with model: haiku for a cheaper search. OpenCode's explore sets no model either, so on day one it reads on your most expensive model until you add agents.explore.model. In exchange, each OpenCode agent can use a different vendor in one session.

Do this today

Everyone

  • Repeat the check. In Ticket Triage, with the model block committed, run opencode debug agents | grep -A3 '"model"' and confirm Flash-Lite on explore and title. Run opencode stats --models --project ., run the Start here search without -m, and run the report again: the Flash-Lite row gains steps although the command names no model. Then confirm git status --short prints nothing.
  • Start one habit: before you change a model, look at the report. Run opencode stats --models --project . once a week, and ask of each row whether that work needed that model.

If you read Going deeper

Together these take about twenty minutes in your own repository.

  • Read your current split. Run opencode stats --cost --models --project . and note the cost line and how many MODELS rows it shows.
  • Check what your agents read on. Run opencode debug agents and find which agents set a model.
  • Set a model for the planner and keep compaction capable. Give agents.plan.model a higher reasoning variant and agents.compaction.model a capable model, with IDs copied from opencode models, then run opencode reload and opencode debug config.
  • Run one real task that delegates. Ask build to use the explore subagent to find every caller of a function you are about to change.
  • Compare before and after. Run the same stats report, look for the new row, and commit opencode.jsonc once the split looks right.

The bill was always a reading bill

The surprise invoice felt like an expensive model being expensive. It was arithmetic: a coding agent reads eighty tokens for every one it writes, and one global model line put your priciest reader on every agent, including the ones you never talk to and never read.

OpenCode treats the model as a setting per agent, which turns that bill into a design decision. Keep a capable model where you watch the work and where summaries decide what survives. Give planning a higher reasoning variant. Move search and titles to the cheapest row that does the job, and let opencode stats tell you whether the split held.

Pick the reader before you pay for the reading.


This is Part 9 of "OpenCode, Day-to-Day," a 17-part guide to using OpenCode V2 as a daily, provider-neutral coding agent.