Skip to content

feat: real-time token cost calculation + subscription ROI dashboard #147

@jackrescuer-gif

Description

@jackrescuer-gif

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:

  1. Token pricing model — a pricingModel.ts module 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.

  2. Subscription tracker — a Billing tab in Settings to record monthly charges (supports multiple entries per month, e.g. Pro + Max on separate billing dates).

  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions