Skip to content

fix: token total formula missing output_tokens from last turn#53

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

fix: token total formula missing output_tokens from last turn#53
Deepak8858 wants to merge 1 commit intoRuya-AI:mainfrom
Deepak8858:fix/issue-36-output-tokens

Conversation

@Deepak8858
Copy link
Copy Markdown

Description

Corrects the token calculation in extract_usage_tokens() and quick_token_estimate() to include output_tokens from the last assistant turn, matching the formula used in Claude Code.

Changes

  • Updated extract_usage_tokens() to include output_tokens in total.
  • Updated quick_token_estimate() to include output_tokens in the final return value.

Fixes #36

@junaidtitan
Copy link
Copy Markdown
Collaborator

Thanks for the PR @Deepak8858! This is the exact right fix — we actually shipped this same change in v1.4.0 (commit 2f97f81). Both extract_usage_tokens() and quick_token_estimate() now include output_tokens in the total.

Closing since it's already merged, but appreciate you spotting it and taking the time to submit. If you find other issues feel free to open a PR — contributions are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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