You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started using OpenCode today and I got an out-of-credit error very quickly, that surprised me because the token count in OpenCode said: ~85k tokens, but when I went to the billing page of my API provider (Fireworks AI) it said I had used close to 3.55m tokens, which is a crazy gap. And so I'm wondering where is that difference coming from
and u only used fireworks in opencode? that usage couldn’t be from elsewhere?
Yes, I actually created one Fireworks account specifically to use it with OpenCode, and I didn't use any subagents (I didn't even know how to invoke them until I checked now 😅 )
Not sure if it changes anything, but most of the messages in the convo (~10 of them) were using the planning mode, and only 2-3 used building mode
Rn it only shows the parent totals instead of including subagent costs and token usage
@rekram1-node Yikes. That caught me off guard as well. I set up a brand new key to use OpenCode with Claude Opus 4.5 via API. I sent a single prompt/request in plan mode and it used a bunch of subagents to gather context. The TUI reported this as $0.16 of usage. The Anthropic billing dashboard, however, reported as $2.14. That's 13× the reported price.
I ran into a similar bug, but it's a little more specific. I was in a thread and decided to fork it from a certain message, then I started using a different model in the new fork. As I kept using the fork thread, I noticed the total price actually started decreasing. It looks like the math is flipped—instead of adding the cost of the new messages to the total, the system is performing a minus operation, so the more I talk, the "cheaper" the thread gets. Definitely seems like there's a bug in how the cost is being calculated, not sure what the root cause of. this is.
@thdxr This issue is reported multiple times and isnt fixed and continuously gets auto-closed, tia
Update: Investigated the issue and found that the root cause lies in models.dev pricing and how the app handles missing pricing data. specifically, when cache pricing is absent, it defaults to zero. I've submitted a PR to models.dev to fix the missing cache price, and another PR is coming to opencode to fall back to the input/output price for read/write cache. I believe it's safer to overestimate the cost of a chat than to underestimate it.
Activity
github-actions commentedon Dec 22, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
abdurahmanshiine commentedon Dec 22, 2025
Taking a look at the stats I got this, which is really weird because I have only sent 12 messages (and not 75)
rekram1-node commentedon Dec 22, 2025
and u only used fireworks in opencode? that usage couldn’t be from elsewhere?
That big of a gap just doesnt make sense UNLESS the session that this happened in had a bunch of subagent calls?
Rn it only shows the parent totals instead of including subagent costs and token usage
abdurahmanshiine commentedon Dec 23, 2025
Yes, I actually created one Fireworks account specifically to use it with OpenCode, and I didn't use any subagents (I didn't even know how to invoke them until I checked now 😅 )
Not sure if it changes anything, but most of the messages in the convo (~10 of them) were using the planning mode, and only 2-3 used building mode
coreyward commentedon Jan 9, 2026
@rekram1-node Yikes. That caught me off guard as well. I set up a brand new key to use OpenCode with Claude Opus 4.5 via API. I sent a single prompt/request in plan mode and it used a bunch of subagents to gather context. The TUI reported this as $0.16 of usage. The Anthropic billing dashboard, however, reported as $2.14. That's 13× the reported price.
yassine-safraoui commentedon Jan 27, 2026
I ran into a similar bug, but it's a little more specific. I was in a thread and decided to fork it from a certain message, then I started using a different model in the new fork. As I kept using the fork thread, I noticed the total price actually started decreasing. It looks like the math is flipped—instead of adding the cost of the new messages to the total, the system is performing a minus operation, so the more I talk, the "cheaper" the thread gets. Definitely seems like there's a bug in how the cost is being calculated, not sure what the root cause of. this is.
github-actions commentedon Mar 29, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
coreyward commentedon Apr 2, 2026
^^^ Bummer that this is closed as "completed" when it never got any attention. I stopped using OpenCode because of it. Oh well.
Pxys-io commentedon Apr 3, 2026
@thdxr This issue is reported multiple times and isnt fixed and continuously gets auto-closed, tia
Update: Investigated the issue and found that the root cause lies in models.dev pricing and how the app handles missing pricing data. specifically, when cache pricing is absent, it defaults to zero. I've submitted a PR to models.dev to fix the missing cache price, and another PR is coming to opencode to fall back to the input/output price for read/write cache. I believe it's safer to overestimate the cost of a chat than to underestimate it.