Skip to content

Clarify cost display as API-rate estimate - #926

Closed
yashiels wants to merge 2 commits into
steipete:mainfrom
yashiels:fix/clarify-cost-estimate
Closed

Clarify cost display as API-rate estimate#926
yashiels wants to merge 2 commits into
steipete:mainfrom
yashiels:fix/clarify-cost-estimate

Conversation

@yashiels

@yashiels yashiels commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add persistent hint below cost figures: "Estimated from local logs · may differ from your bill"
  • Change "Cost" section header to "Cost (estimated)" with localization (en, pt-BR, zh-Hans)
  • Update CLI output from "(local)" to "(API-rate estimate)" with footer disclaimer
  • Update chart footer to "Est. total (30d)" with truncation safety

Closes #549.

Context

Users on flat-rate subscriptions (Claude Max, Codex Pro) panic when they see dollar amounts computed from local logs at API pricing rates. The hint clarifies these are estimates, not invoiced charges. The wording is universally accurate — API users also benefit since local log estimates may differ from actual invoices due to caching, batching, and discount tiers.

Prior PR #464 was closed as too large (subscription detection + settings toggle). This PR follows the guidance to "reopen as a fresh, smaller PR" — no conditional logic, no new settings, just clear labeling.

Changes

File Change
UsageFormatter.swift Add costEstimateHint public constant
MenuCardView.swift Assign hint to hintLine, change 2× Text("Cost") → localized key
CostHistoryChartMenuView.swift Footer "Est. total (30d)" + lineLimit(1) + truncationMode(.head)
CLICostCommand.swift Header "(API-rate estimate)" + footer disclaimer
en/pt-BR/zh-Hans .strings Add cost_header_estimated + cost_estimate_hint keys
CLICostTests.swift Update CLI assertion + add hint stability test

Validation

  • swift build — clean (942 targets)
  • swift test --filter CLICostTests — all 5 tests pass (including updated + new tests)
  • Tested locally on macOS — built from source and verified UI + CLI
  • Translations are machine-generated for pt-BR and zh-Hans — happy to take corrections

Screenshots

Menu bar (dark mode)

Cost estimated menu card

Before: Header says "Cost", no hint line
After: Header says "Cost (estimated)", hint line reads "Estimated from local logs · may differ from your bill"

CLI output

Claude Cost (API-rate estimate)
Today: $113.58 · 154M tokens
Last 30 days: $1,097.61 · 1.3B tokens
Estimated from local logs · may differ from your bill

Deferred (separate PRs)

  • Widget labels → "Today est." / "30d est." (compact widget layout requires different approach)
  • Preferences subtitle wording update

Add hint line below cost figures explaining that amounts are estimated
from local token logs and may differ from actual billing. Change section
headers from "Cost" to "Cost (estimated)" with full localization support
(en, pt-BR, zh-Hans). Update CLI output header and chart footer to
reflect the estimated nature of the figures.

Closes #549

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 495ab0f429

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/CodexBar/MenuCardView.swift Outdated
The hint line was using UsageFormatter.costEstimateHint (hardcoded
English) instead of looking up the localized key from .strings files.
Switch to String(localized:) so pt-BR and zh-Hans translations are
actually used in the menu card. CLI output keeps the English constant.
@yashiels

yashiels commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

Verified locally — menu bar + CLI (dark mode, macOS 15.3)

Built from source and tested all changes:

  • Header: "Cost (estimated)" ✓
  • Hint line: "Estimated from local logs · may differ from your bill" in secondary/grey ✓
  • CLI: "Claude Cost (API-rate estimate)" with footer disclaimer ✓
  • Chart footer: "Est. total (30d)" ✓

CLI output:

Claude Cost (API-rate estimate)
Today: $113.58 · 154M tokens
Last 30 days: $1,097.61 · 1.3B tokens
Estimated from local logs · may differ from your bill

SanderM2 added a commit to SanderM2/CodexBar that referenced this pull request May 13, 2026
…links, cost estimate clarification, menu refresh glitch fix)
@steipete

Copy link
Copy Markdown
Owner

Thanks @yashiels. Landed a maintainer version on main in 73c8209, with your attribution preserved in the commit.

I kept the intent and adjusted it against current main:

  • Menu/card/chart/CLI labels now say the totals are API-rate/local-log estimates.
  • Added localized strings for the new menu labels.
  • Updated CLI cost tests for the estimate header and hint.

Verified with swift test and make check. Closing this PR because main now contains the shipped version.

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.

Cost display should clarify it's API-equivalent, not actual charges

2 participants