OpenCode

OpenCode model usage: tokens and cost per model

Break OpenCode usage down by provider and model. See which model carries the volume, which costs the most per task, and how to compare them fairly.

Quick answer

OpenCode stores a provider and model ID on every message, so usage can be grouped by both. Total tokens show volume; tokens per completed task show efficiency. A model with a low per-token price can still be the most expensive line if it needs more turns.

Group by provider before model

Model names repeat across providers. Grouping by provider first prevents two different models from collapsing into one line, and makes rate differences visible.

GroupingQuestion it answersPitfall
ProviderWhere the spend goesHides model mix
ModelWhich model is efficientCollides across providers
Provider + modelBoth at onceMore rows to scan
SessionWhich task was expensiveNo cross-task view

Measure efficiency, not just volume

  1. Count completed tasks per model for a week.
  2. Total tokens per model.
  3. Divide tokens by completed tasks.
  4. Apply each provider's rate to that token mix.
  5. Compare the cost per completed task, not the cost per token.

Act on the result

  • Move mechanical edits to the cheapest model that finishes them.
  • Keep the strong model for planning and debugging.
  • Watch cache read share; a model with poor caching costs more on long sessions.
  • Recheck after a provider changes pricing.

UsageAtlas shows the provider and model split for the same date range as the daily totals.

Read the model split before changing it

OpenCode lets you switch models per session, which is useful and hard on budgets. The split tells you whether the expensive model is doing most of the work or only the hard parts.

SplitLikely habitNext change
One model everywhereDefault never changedTry a cheap model for searches
Cheap model onlyCost-firstCheck whether retries erase the saving
Mixed by sessionDeliberateCompare per task
Mixed within sessionsSwitching mid-taskStart separate sessions instead

The tokens per request guide explains why a model switch mid-session can cost more than starting fresh.

Questions, answered

Does OpenCode report cost per model?

It records the model on each message and a cost value where the provider supplies one. Totals by model are a group-by over those records.

Why is one model missing from the breakdown?

Older messages may not include a model field, or the provider returned an unrecognised ID. Unknown rows are usually grouped together.

Can I compare OpenCode models with Codex models?

Yes, but use tokens per completed task and current rates. Raw token totals are not comparable across different workflows.

Browse by topic