Skip to content

Fix extra usage values shown 100x wrong due to double cent-to-dollar conversion#463

Open
Priyans-hu wants to merge 1 commit intosteipete:mainfrom
Priyans-hu:fix/227-extra-usage-double-divide
Open

Fix extra usage values shown 100x wrong due to double cent-to-dollar conversion#463
Priyans-hu wants to merge 1 commit intosteipete:mainfrom
Priyans-hu:fix/227-extra-usage-double-divide

Conversation

@Priyans-hu
Copy link

@Priyans-hu Priyans-hu commented Mar 2, 2026

Both the OAuth path (normalizeClaudeExtraUsageAmounts) and the Web path (parseOverageSpendLimit) already divide the raw API response by 100 to go from cents to dollars. But rescaleClaudeExtraUsageCostIfNeeded was dividing by 100 again whenever the post-normalization limit came out >= $1000 — so any Max/Team user with a high extra-usage cap got their values squished by another 100x.

Removed the rescale function entirely since the upstream conversion handles it correctly for every plan type now. Updated tests to match.

What changed

  • Deleted rescaleClaudeExtraUsageCostIfNeeded and extraUsageRescaleThreshold
  • Removed the 3 call sites (OAuth, Web, fallback web merge) that fed into it
  • Removed the _rescaleExtraUsageForTesting test hook
  • Updated ClaudeOAuthTests to expect the correct post-normalization values instead of the double-divided ones

Fixes #227

Both the OAuth path (normalizeClaudeExtraUsageAmounts) and the Web path
(parseOverageSpendLimit) already convert cents to dollars by dividing
by 100. The rescaleClaudeExtraUsageCostIfNeeded heuristic then divided
by 100 again when the post-normalization limit was >= 1000, which meant
any user with a limit of $1000 or more saw their extra usage values
divided by an extra factor of 100.

Remove the rescale function entirely since the upstream normalization
handles the conversion correctly for all plan types.

Fixes steipete#227
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.

Extra usage values displayed 100x too high

1 participant