Skip to content

feat(usage): show official API list cost on Token Usage - #503

Open
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:feat/token-usage-api-list-cost
Open

feat(usage): show official API list cost on Token Usage#503
Adam-Dalloul wants to merge 1 commit into
xintaofei:mainfrom
Adam-Dalloul:feat/token-usage-api-list-cost

Conversation

@Adam-Dalloul

Copy link
Copy Markdown
Contributor

Token Usage already counts input, output, cache writes, and cache reads. It just never priced them.

This uses the models.dev catalog Codeg already fetches for OpenCode, including cache_read and cache_write, and turns the current range into an API list estimate.

  • Muted line under the hero token total: ≈ $12.40 API list. If some models have no published rate, it says how much of the tokens that covers.
  • On the By model list, the existing session hint can also show that row's list cost.
  • Missing cache rates leave those tokens unpriced instead of pretending they cost the same as fresh input. Subscription plans still bill differently. This is the public list, not remaining quota.

Hover the estimate for the short disclaimer.

Token Usage already records input, output, cache writes, and cache reads.
Price those buckets from the models.dev catalog Codeg already fetches, and
put a muted estimate under the hero total plus an optional per-model hint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant