Key takeaways
- OpenCode routes work to the providers you configure, so there is often no single OpenCode line item on any bill.
- UsageAtlas, a free and open-source desktop app, estimates OpenCode cost from local token counts and model pricing and labels it as an estimate.
- Estimates and invoices can differ because of cache pricing, provider differences and late billing.
OpenCode cost tracking is harder than it sounds, because OpenCode is one app sitting in front of several model bills. The practical answer is to count tokens locally and price them by model, which is what UsageAtlas, a free and open-source desktop tracker, does with the data OpenCode already stores, while each provider's invoice stays the final word.
The problem: one terminal, many invoices
Most AI coding tools come with one subscription and one usage page. OpenCode works differently. You bring your own providers, and a single afternoon can touch an Anthropic model, an OpenAI model and something else entirely. Each of those providers sends its own invoice, on its own schedule, with its own idea of what a request cost.
That leaves a gap. Your Anthropic console knows what you spent on Anthropic, but not how much of it came from OpenCode rather than another app using the same key. OpenCode knows which sessions it ran, but it is not the company billing you. Nobody hands you a neat line item that says "OpenCode, Tuesday".
Three ways people try to close the gap
| Approach | What you get | Where it falls short |
|---|---|---|
| Add up provider invoices | Exact money | Mixes OpenCode with every other app on the same key; arrives late |
Run opencode stats |
Token and cost stats from OpenCode itself | A point-in-time printout; OpenCode only |
| Use a local tracker such as UsageAtlas | Daily estimates by model, kept as history | An estimate, not a bill |
OpenCode's CLI reference describes opencode stats as showing token usage and cost statistics, with --days for a time range and --models for a per-model breakdown. That is a solid starting point, and for many people it is all they need.
Why an estimate is the right tool
An estimate sounds like a compromise, but for day-to-day decisions it is the useful number. You want to know which model is eating the budget this week, not the exact cents. Token counts are exact on your machine; prices per model are public. Multiply them and you get a figure that moves when your habits move.
UsageAtlas works that way. It reads tokens and models from the local OpenCode database, applies model pricing, and labels the result as an estimate. When OpenCode reports a cost, UsageAtlas uses that reported figure instead. You can filter to OpenCode alone or turn the filter off to see a combined estimate with Claude Code, Codex or Cursor if you used those in the same week.
Why your estimate and your bill will disagree
Expect some drift, and do not panic about it. The usual causes:
- Cache pricing. Cached input is often billed differently from fresh input, and those discounts are easy to miss in an estimate.
- Different providers. The same model name can cost different amounts through different routes.
- Timing. Invoices can land days after the work.
None of this makes the estimate wrong for its purpose. It makes it a trend line, and the invoice the settlement.
What this means in practice
Use a local tracker to steer, and the provider console to pay. In a normal week that looks like checking the UsageAtlas History view on a Friday, noticing that one model took most of the spend, and deciding whether that was worth it. At month end, open each provider's billing page and confirm the real amount.
UsageAtlas runs on Windows, macOS and Linux, needs no account for local tracking, and does not read prompts or responses. If you only want an occasional total and never leave the terminal, opencode stats is the lighter choice. If you want the running picture across days and tools, the tracker is the better fit.
Frequently asked questions
Does OpenCode show cost?
opencode stats shows token usage and cost statistics for your sessions. For a running daily picture, UsageAtlas shows an estimated cost by model.
Why does my OpenCode cost estimate not match my invoice?
Cached input pricing, different provider routes and delayed invoices all cause drift. Use the provider bill when the figure must be exact.
Sources
- OpenCode cost trackingUsageAtlas
- OpenCode usage trackerUsageAtlas
- UsageAtlas detailed informationUsageAtlas
- OpenCode CLIOpenCode
