anthropics / anthropics/claude-agent-sdk-python

Python SDK ResultMessage's message.usage['input_tokens'] isn't correct

オープン
#112 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Python
スター
8.1k
フォーク
1.3k
平均マージ
2日 31分
マージ済み PR(30日)
1

説明

I am trying to analyze token in and out for Claude Code Python SDK.
For my task, after completion, I looked at the ResultMessage,
usage['input_tokens'] is 69
usage['output_tokens'] is 18467

The input_tokens here is really off
and output_tokens seem to be accumulated correctly.

I looked at cache_creation_input_tokens and cache_read_input_tokens stored in usage dictionary.
They don't seem to represent cumulative input_tokens.

I used this prompt for my coding task

https://github.com/RooCodeInc/Roo-Code-Evals/blob/main/prompts/python.md

and had cwd pointed to this

https://github.com/RooCodeInc/Roo-Code-Evals/tree/main/python/pov

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。