-
Notifications
You must be signed in to change notification settings - Fork 211
feat: real-time token cost calculation + subscription ROI dashboard #147
Description
Problem
calculateMetrics() has always returned costUsd: 0 — the field exists in SessionMetrics and appears in session exports, but was never populated. Users have no way to see what their actual API usage costs, or compare it against their subscription spend.
Proposed solution
Three connected pieces:
-
Token pricing model — a
pricingModel.tsmodule with rates for all Claude model families (2/instant/3/3.5/3.7/4), including cache read/write.calculateMetrics()now returns real USD cost. -
Subscription tracker — a Billing tab in Settings to record monthly charges (supports multiple entries per month, e.g. Pro + Max on separate billing dates).
-
ROI dashboard block — compares subscription paid vs API-equivalent cost for the current month across all sessions. Shows savings (or break-even gap) and a coverage progress bar.
Why this fits the project scope
The CONTRIBUTING guidelines highlight "context engineering insight — features that help users understand what is consuming their context window, how tokens flow through a session, and where to optimize." Cost visibility is a direct extension: users need to know not just how many tokens a session consumed, but what it cost — and whether their subscription tier is paying off.
Implementation
Branch: feat/subscription-roi (in fork jackrescuer-gif/claude-devtools)
No new dependencies. TypeScript-clean. Tests added for pricing model and config validation. Happy to adjust scope based on feedback.