Repository navigation
Surface unpriced models instead of silently counting them at $0 - #646
Merged
Merged
Conversation
…d, and MCP Models missing from the pricing tables silently contributed $0 to every total with no indication anywhere (the warning was gated behind CODEBURN_VERBOSE). Add render-time detection that flags aggregated model rows with usage but $0 cost whose pricing lookup fails right now, and surface it in overview, report/today/month JSON (unpricedModels), the TUI By Model panel, and the MCP get_usage summary. Render-time detection covers cached sessions (cost is computed at parse time) and heals as soon as pricing data, an alias, or a price override arrives. Rows with real cost are never flagged: aggregation keys rows by display name, which the pricing lookup misses; $0 display-name rows are reverse-resolved to their raw id before flagging so sessions cached before their model's pricing landed don't get a misleading alias hint. Local models and model-savings mappings stay excluded: $0 is correct for them. Fixes #638
Adversarial review found two false-negative paths and two polish items: - Drop the reverse-display-name suppression. Droid prices the lowercased display name and gets $0, so a $0 row keyed "Sonnet 4.6" is real uncounted spend; suppressing it because claude-sonnet-4-6 prices today hid exactly the failure this feature exists to expose. - Treat zero-rate pricing hits as unpriced. LiteLLM ships [0,0] stubs for models it lists without a price; a stub hit means unknown price, not free. Explicit zero-rate user overrides still count as free. - Make MenubarPayload.current.unpricedModels optional for source compatibility with payload producers that predate the field. - Replace localeCompare with a byte comparison so tied rows sort identically on every host locale. Refs #638
getModelCosts resolves exact overrides before any table hit, so an exact zero-rate override provably priced the model and means free. Prefix and case-insensitive overrides resolve after table hits: a zero-rate stub shadowed by one still reports $0 from the stub, so it stays flagged. Refs #638
…truncates At 80 columns the By Model footer truncated mid-command. The flagged models are already visible as $0 rows in the table above, so put the fix command before the names and let the names truncate instead. Refs #638
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #638
Problem
A model missing from the pricing tables contributes $0 to every total, breakdown, export, and MCP response, and the only warning is gated behind CODEBURN_VERBOSE. A new model id shipping ahead of the pricing data (the #629 scenario) silently undercounts real spend.
Change
Render-time detection (findUnpricedModels in src/models.ts): flag aggregated model rows that carry usage but $0 cost and whose pricing lookup yields no billable rate right now. Render-time rather than parse-time because costs are computed at parse time and cached; checking at render covers cached sessions and heals the moment pricing data, an alias, or a price override arrives.
Surfaces:
Correctness notes (from adversarial review)
Verification