Skip to content

Conversation

@MiwiDots
Copy link
Member

Summary

  • Implement real-time billing block tracking aligned with Claude's 5-hour cycles
  • Add granular token tracking with breakdown by type (input/output/cache-creation/cache-read)
  • Create enhanced project view with advanced filtering and live monitoring

Key Features

1. Billing Block Tracking

  • Real-time tracking of Claude's 5-hour billing windows
  • Visual progress bars with color-coded burn rate indicators
  • Accurate cost projections based on current usage patterns
  • Proper hour flooring for first entry in each block (matching ccusage behavior)

2. Enhanced Project View

  • Replaced simple "Top 5 Projects" list with comprehensive ProjectGridView
  • Added search functionality for finding projects by name or path
  • Filter options: All, Active Only, Recent Activity, High Cost (>10%)
  • Sort options: Cost, Name, Last Used, Efficiency, Burn Rate
  • Live monitoring mode with auto-refresh capabilities
  • Activity indicators showing real-time project status

3. Token Breakdown

  • Granular tracking of all token types:
    • Input tokens
    • Output tokens
    • Cache creation tokens
    • Cache read tokens
  • Efficiency metrics (cost per 1000 tokens)
  • Burn rate calculations using only non-cache tokens

4. Internationalization

  • Full translations for all 6 supported languages
  • Currency conversion integrated throughout billing components
  • Localized number and date formatting

Technical Details

  • Created new TypeScript types for billing blocks in src/shared/types/billing.ts
  • Implemented BillingBlockService for managing billing data
  • Added utility functions for billing calculations in src/shared/utils/billingBlocks.ts
  • Enhanced IPC communication for billing block data
  • React components use memoization for optimal performance

Testing

  • Manually tested billing block calculations against ccusage project
  • Verified hour flooring behavior matches expected Claude billing windows
  • Tested all filtering and sorting options in ProjectGridView
  • Confirmed translations work correctly in all languages
  • Verified currency conversion throughout components

Screenshots

Components integrate seamlessly into existing UsageDashboard with matching theme support.

Martin Wilke added 2 commits July 19, 2025 18:53
- Implement real-time billing block tracking aligned with Claude's 5-hour cycles
- Add granular token tracking (input/output/cache-creation/cache-read)
- Create BillingBlockDashboard component with burn rate indicators
- Replace simple project list with enhanced ProjectGridView component
- Add search, filtering, sorting, and live monitoring capabilities
- Implement hour flooring for first entry in billing blocks
- Add full internationalization for new features (all 6 languages)
- Integrate currency conversion throughout billing components
- Fix async/await lint error in IPC handler
- Replace logical OR with nullish coalescing operator throughout
- Rename unused variables with underscore prefix
- Fix type imports and remove unused imports
- Ensure all code follows strict TypeScript and ESLint rules
- Build now completes successfully without errors
@MiwiDots MiwiDots merged commit 09b56f3 into main Jul 19, 2025
1 of 2 checks passed
@MiwiDots MiwiDots deleted the feature/billing-blocks-granular-tokens branch July 19, 2025 11:08
MiwiDots pushed a commit that referenced this pull request Jul 20, 2025
MiwiDots added a commit that referenced this pull request Jul 20, 2025
* Revert "REFACTOR: Streamline CI/CD workflows to reduce GitHub Actions costs (#27)"

This reverts commit 13b312d.

* Revert "FIX: Improve cost calculation accuracy and dashboard UX (#26)"

This reverts commit 8b51ece.

* Revert "FEAT: Add 5-hour billing block tracking and enhanced project view (#25)"

This reverts commit 09b56f3.

* Revert "CLEANUP: Remove unnecessary development files and improve .gitignore (#24)"

This reverts commit fe3d287.

---------

Co-authored-by: Martin Wilke <miwi@FreeBSD.org>
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.

2 participants