-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Root Cause
pricing.py exports lookup_model_pricing, categorize_model, KNOWN_PRICING, ModelPricing, and PricingTier. These are fully tested via test_pricing.py, but zero production modules import them:
$ grep -r "from copilot_usage.pricing" src/
# (no output)The module was built to support cost estimation (tier classification, partial model-name matching, multiplier lookup) but was never wired into the CLI.
Impact
render_cost_view in report.py shows mm.requests.cost (raw data from session.shutdown) for completed sessions — but for active sessions (no shutdown event yet), the Premium Cost column shows "—":
# report.py — active session row
table.add_row(
" ↳ Since last shutdown",
s.model or "—",
"N/A", # Requests — no shutdown data
"N/A", # Premium Cost — ← this could be estimated
str(s.active_model_calls),
format_tokens(s.active_output_tokens),
)Using lookup_model_pricing(model_name).multiplier * active_model_calls would give a useful estimate. The same gap exists in the live command, which shows no cost information at all.
Proposed Fix
- In
render_cost_view(report.py): for the↳ Since last shutdownrow, replace"N/A"for Premium Cost withf"~{estimated_cost:.0f}"computed asround(active_model_calls * lookup_model_pricing(model_name).multiplier). - In
render_live_sessions(report.py): add an "Est. Cost" column using the same estimation. - Document the estimated nature with a
~prefix or a table footnote so users know it's an approximation, not shutdown-data truth.
If integration is out of scope for now, the module should at minimum gain a docstring note explaining it is a standalone utility API and not called by the CLI at runtime — removing the false impression that it is actively used.
Testing Requirement
- Unit test:
render_cost_viewfor an active session shows a numeric estimated cost (not"N/A") when a known model is set. - Unit test: estimated cost is
0forgpt-5-mini(0× multiplier) and3 * multiplierfor 3 calls of a premium model. - Existing
test_pricing.pytests must continue to pass unchanged.
Generated by Code Health Analysis · ◷