Skip to content

feat: personal Claude Code usage tracking#13

Merged
TobiiNT merged 3 commits intomainfrom
feat/personal-api-usage
Mar 18, 2026
Merged

feat: personal Claude Code usage tracking#13
TobiiNT merged 3 commits intomainfrom
feat/personal-api-usage

Conversation

@TobiiNT
Copy link
Copy Markdown
Owner

@TobiiNT TobiiNT commented Mar 17, 2026

Summary

  • Fix user identity picker hidden after initial API setup (moved outside ApiSetupPanel, auto-loads for configured profiles)
  • Fix status line showing "Waiting for usage data" permanently for API-only users (no subscription)
  • Fetch org spend threshold from rate_limits endpoint — fixes "Left: $0.00" for orgs with monthly spend limits
  • Add daily personal metrics (today's cost/sessions/lines) alongside monthly totals
  • Throttle API/personal metrics fetches to 5-min intervals to avoid rate limiting
  • Redesign floating panel for API-only users: "Org Budget" with $used/$total progress bar, "My Usage" with Month/Today sub-rows
  • Fix named pipe ACL: grant current user explicit FullControl to resolve HookBridge connection failures (UnauthorizedAccessException)

Files Changed (18)

  • Models: SpendLimitCents, LastUpdated in APIUsage.cs; OrganizationRateLimitsResponse in ApiResponseModels.cs; DailyMetrics in Profile.cs
  • Services: Fetch rate_limits endpoint + 3-way parallel requests in ClaudeApiService; pipe ACL fix in HookIpcService; 5-min throttle + daily metrics parallel fetch in UsageRefreshCoordinator; LoadClaudeCodeUsers command in ApiBillingViewModel
  • ViewModels: Daily metrics + ApiTotalText properties in PopoverViewModel; user picker auto-load in ApiBillingViewModel
  • Views: Floating panel redesign (Org Budget + My Usage cards); daily metrics row in popover PersonalCard; user picker moved outside ApiSetupPanel; status line checks HasApiUsage/HasPersonalMetrics
  • Interfaces: Date range params on FetchClaudeCodeUserMetrics

Test plan

  • dotnet test — all pass
  • dotnet build --configuration Release — 0 errors, 0 warnings
  • Hooks: verified pipe ACL fix — events now received after ClaudeTracker restart
  • Manual: Settings → API section → user picker visible for already-configured profile
  • Manual: Popover shows "My Claude Code" with Month totals + Today row
  • Manual: Floating panel shows "Org Budget" progress bar with correct $used/$total
  • Manual: Status line shows green "Updated X ago" for API-only users (no subscription)

🤖 Generated with Claude Code

TobiiNT and others added 3 commits March 17, 2026 22:09
Add per-user Claude Code metrics (cost, sessions, lines accepted) using
the platform.claude.com /api/claude_code/metrics_aggs/users endpoint.
Includes user identity picker in API settings and "My Claude Code" card
in popover. Centralize platform.claude.com URLs via Constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… popups

When a session has active subagents, PostToolUse/PostToolUseFailure
events likely originate from child agents rather than the parent.
Skip auto-close for these events to avoid dismissing the parent
session's pending permission popup prematurely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… pipe ACL fix

- Fix user picker hidden after API setup (move outside ApiSetupPanel)
- Auto-load user picker for already-configured profiles
- Fix status line showing "Waiting for usage data" for API-only users
- Fetch org spend threshold from rate_limits endpoint for correct budget display
- Add daily personal metrics (today's cost/sessions/lines) alongside monthly
- Throttle API/personal metrics fetches to 5-min intervals to avoid rate limits
- Redesign floating panel for API-only users: "Org Budget" with $used/$total,
  "My Usage" with Month/Today sub-rows in bordered cards
- Fix named pipe ACL: grant current user explicit FullControl to resolve
  UnauthorizedAccessException when HookBridge connects from different security context

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@TobiiNT TobiiNT merged commit 2e577f7 into main Mar 18, 2026
1 check passed
@TobiiNT TobiiNT deleted the feat/personal-api-usage branch March 18, 2026 06:18
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.

1 participant