Skip to content

fix: include output_tokens in token total calculation#54

Closed
Deepak8858 wants to merge 1 commit intoRuya-AI:mainfrom
Deepak8858:fix/issue-36-token-formula
Closed

fix: include output_tokens in token total calculation#54
Deepak8858 wants to merge 1 commit intoRuya-AI:mainfrom
Deepak8858:fix/issue-36-token-formula

Conversation

@Deepak8858
Copy link
Copy Markdown

Updated extract_usage_tokens and quick_token_estimate to include output_tokens in the total token count calculation. This matches Claude Code's own formula (input_tokens + cache_creation_input_tokens + cache_read_input_tokens + output_tokens) and fixes an undercounting issue in context window estimation.

Fixes #36

@junaidtitan junaidtitan added bug Something isn't working context-management good first issue Good for newcomers labels Apr 2, 2026
@junaidtitan
Copy link
Copy Markdown
Collaborator

Same fix as #53 — already shipped in v1.4.0. Thanks for the contribution @Deepak8858! Closing this duplicate but the fix is live.

@junaidtitan junaidtitan closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working context-management good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: token total formula missing output_tokens from last turn

2 participants