Skip to content

Show estimated per-model cost in ucode usage - #326

Merged
andy-xu-db merged 2 commits into
mainfrom
andy/ucode-usage-per-model-cost
Aug 13, 2026
Merged

Show estimated per-model cost in ucode usage#326
andy-xu-db merged 2 commits into
mainfrom
andy/ucode-usage-per-model-cost

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Adds an estimated USD cost per model to ucode usage, aggregated by model over the last 7 days.

  • Prices are fetched live at runtime from the AI Gateway ListExternalProviderModels API — not hardcoded in the package, so new models are priced automatically and there's no static table to maintain.
  • Estimates cost as tokens × price, pricing uncached input, cache reads, and output at their own rates.
  • Replaces the per-day tool table with a per-model weekly rollup: Model · Requests · Input (incl. cache) · Output · Cost (USD), plus per-tool totals.
  • Merges the same model's id/display spellings into one row; models the catalog doesn't cover show no dollar figure.

Cost is an estimate (list price × tokens); no API exposes per-model billed spend.

Screenshot 2026-08-13 at 2 50 48 PM

@andy-xu-db
andy-xu-db marked this pull request as ready for review August 13, 2026 17:20
@andy-xu-db
andy-xu-db force-pushed the andy/ucode-usage-per-model-cost branch from 7e3e19b to 0910558 Compare August 13, 2026 18:06
@andy-xu-db
andy-xu-db enabled auto-merge (squash) August 13, 2026 19:07
@andy-xu-db
andy-xu-db merged commit 2483de0 into main Aug 13, 2026
2 checks passed
@andy-xu-db
andy-xu-db deleted the andy/ucode-usage-per-model-cost branch August 13, 2026 19:16
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.

2 participants