Skip to content

fix(usage): distinguish unpriced usage from zero cost - #5827

Closed
caezium wants to merge 1 commit into
pingdotgg:mainfrom
caezium:agent/usage-unpriced-visibility
Closed

caezium wants to merge 1 commit into
pingdotgg:mainfrom
caezium:agent/usage-unpriced-visibility

Conversation

@caezium

@caezium caezium commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Render fully unpriced usage as — and mixed priced/unpriced usage as a lower bound (≥$X) instead of an exact $0.00 or $X.
  • Surface unpriced coverage consistently across the web/desktop and mobile headline, provider, model, chart, and day breakdowns while keeping token totals complete.
  • Share the cost presentation rules between clients and add focused all-priced, mixed, and fully-unpriced regression coverage.

Why

The aggregation layer already knows when a model has no matching API rate, but the UI formatted that missing price as zero. That made unknown cost look like a genuine free result and made mixed totals look exact. This keeps the existing API-rate estimate model while making its coverage honest.

Fixes #5799.

Focused verification:

  • 33 shared/web/mobile usage tests
  • targeted format and lint checks
  • @t3tools/web and @t3tools/mobile typechecks
  • independent standards/spec review

UI Changes

All screenshots use isolated synthetic transcripts and rates.

Web / desktop

Before After
Web before Web after

Mobile summary and providers

Before After
Mobile usage summary before Mobile usage summary after

Mobile model breakdown

Before After
Mobile model breakdown before Mobile model breakdown after

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • No animation or interaction changed, so a video is not applicable

Note

Distinguish unpriced usage from zero cost across web and mobile usage views

  • Adds unpricedShare to provider, model, day, and per-provider-day totals in usageMerge.ts, tracking the fraction of records with no matching API rate.
  • Adds formatCostEstimate in usageFormat.ts to render — for fully unpriced, ≥$ for partial, and plain USD for fully priced costs.
  • Updates web (UsagePage.tsx, UsageProviderChart.tsx) and mobile (UsageRouteScreen.tsx) to use coverage-aware formatting throughout headlines, chart tooltips, provider rows, and breakdown tables.
  • Adds guidance text (e.g. ≥ and — explanations) inline when any unpriced records are present.
  • Behavioral Change: any cost previously shown as $0.00 for unpriced models or providers now displays — or ≥$X.XX depending on pricing coverage.

Macroscope summarized 9920f0e.


Note

Low Risk
Presentation-only changes to usage cost formatting with shared helpers and broad test coverage; no auth, billing, or aggregation logic beyond exposing existing unpriced record counts.

Overview
Usage cost UI no longer treats missing API rates as $0.00 or exact totals when coverage is incomplete.

Shared: formatCostEstimate returns — when everything is unpriced, ≥$… when only part of usage has rates, and unchanged dollar amounts when fully priced. mergeUsage now surfaces unpricedShare on providers, models, daily rows, and per-provider day cells so clients can format honestly.

Web: Headlines, provider rows, model/day breakdowns, and chart hovers use those rules; partial windows get (partial) labels, a short cost guide, and “share of priced cost” where relevant. Missing provider-days show — (no activity), not priced zero.

Mobile: presentUsageCost / presentUsageCostShare mirror the same copy for the chart card, providers, and models, including the cost guide when any usage is unpriced.

Regression tests cover all-priced, mixed, and fully-unpriced cases on shared, web, mobile, and chart helpers.

Reviewed by Cursor Bugbot for commit 9920f0e. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37ee1a91-8de3-414a-b67b-e92e2b2a93a7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 9, 2026
@caezium
caezium force-pushed the agent/usage-unpriced-visibility branch from 66c7d2a to a1812e6 Compare August 9, 2026 12:07
@caezium
caezium marked this pull request as ready for review August 9, 2026 12:30
Comment thread apps/web/src/components/usage/UsagePage.tsx Outdated
Comment thread apps/web/src/components/usage/UsagePage.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR modifies billing/usage cost presentation logic, changing how costs are displayed when API rate matching is incomplete. Changes to billing-related display warrant human review to ensure the new presentation (using '—' and '≥' indicators) accurately conveys pricing information to users.

You can customize Macroscope's approvability policy. Learn more.

@caezium
caezium force-pushed the agent/usage-unpriced-visibility branch from a1812e6 to ddbc724 Compare August 9, 2026 13:17

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ddbc7240621222df81c9f9fa64c03a77de65fe38. Configure here.

Comment thread apps/web/src/components/usage/UsagePage.tsx
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 9, 2026
@caezium
caezium force-pushed the agent/usage-unpriced-visibility branch from ddbc724 to 9920f0e Compare August 9, 2026 13:24
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 9, 2026 13:25

Dismissing prior approval to re-evaluate 9920f0e

@juliusmarminge

Copy link
Copy Markdown
Member

Closing as part of the open-PR backlog sweep (wave 1).

Reason: Unpriced-cost UI targets a usage page that has since been rewritten
Related: #9860

Reopen if this is still wanted and you’re willing to rebase onto current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Usage page displays unpriced activity as zero cost

2 participants