Fix cache token calculation for Claude Max/Pro users#10
Open
zfogg wants to merge 3 commits intogrp06:mainfrom
Open
Fix cache token calculation for Claude Max/Pro users#10zfogg wants to merge 3 commits intogrp06:mainfrom
zfogg wants to merge 3 commits intogrp06:mainfrom
Conversation
Fixes grp06#6 - Enhanced hook with proper cache token pricing. Backend needs one line change: use effective_total_tokens field. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…che token calculation
Open
Author
|
Alternative approach: You could fix this on the backend instead of requiring hook updates. The hook already sends cache_creation and cache_read fields. Backend just needs: const effectiveTokens = tokens.input + tokens.output +
(tokens.cache_creation * 1.25) + (tokens.cache_read * 0.1);Backend fix advantages:
This PR provides the enhanced hook for completeness, but backend-only fix would work too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6 - Resolves "Count Is Wrong" user complaints about severely under-reported usage.
The Problem
Claude Max/Pro users are dramatically under-credited on the leaderboard. Example:
This happens because the current system counts raw tokens instead of effective tokens, ignoring Anthropic's cache pricing model.
The Fix
Backend: One line change to use enhanced token calculation
Hook: Enhanced to calculate proper effective tokens using official Anthropic cache pricing
Impact
This ensures Claude Pro/Max users get proper credit for their actual usage costs, building trust in the leaderboard's accuracy.
🤖 Generated with Claude Code