You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Claude Code 1.0.9 no longer reports the costUSD field #4
The model and token counts are still included, however. This probably means that the costs could be calculated for these by multiplying them with their listed prices?
This only happens in opus model. Here is the summary by Claude Code:
⏺ Looking at the conversation history and the current state of the codebase, I can see that:
1. The initial issue where bun ./index.ts -s 20250603 showed tokens but zero cost has been fixed by correcting the schema to place the model field
inside the message object.
2. A verification script was created that revealed:
- 83.34% of entries with both costUSD and model match the new calculations
- 16.66% show mismatches, all with exactly 2x difference
- All mismatches are for the claude-opus-4-20250514 model
- This indicates the pricing for this model has doubled since the original calculations
3. The verification script has been kept as requested and shows detailed results including model-by-model breakdowns.
The user's requests have been completed:
- The bug was fixed
- The pricing verification was performed
- The verification script was kept
- Full results were shown
The codebase is now working correctly with the fixed schema and can handle both old entries (with pre-calculated costUSD) and new entries (with model
field for dynamic cost calculation).
As far as my understanding, the price hasn't changed
I would like you guys to test the script and report it here. This helps me to improve ccusage. Thanks
git clone https://github.com/ryoppippi/ccusage
cd ccusage
git checkout 91adb43
bun i
bun ./verify-prising.ts
@nnamon
Thank you for your report.
This is interesting because in your environment, all of the difference comes from sonnet, while my issue comes from opus.
Could probably be because I usually use sonnet most of the time and the error came from a bugged version? I sampled a few of the files, they were all from versions 1.0.7.
Here are my logs in case they help you with the investigation. I run your scripts using ts-node because I don't have bun installed. I always restarted claude code as soon as I saw the message "Update installed. Restart to apply"
Though, it could be just something on the server side end during that same time period for all of us that was reporting the wrong costUSDs regardless of version as @itsUndefined mentioned.
changed the title [-]Claude Code 1.0.9 no longer reports the costUSD field[/-][+]Claude Code 1.0.7 no longer reports the costUSD field[/+]on Jun 3, 2025
changed the title [-]Claude Code 1.0.7 no longer reports the costUSD field[/-][+]Claude Code 1.0.9 no longer reports the costUSD field[/+]on Jun 3, 2025
Activity
ryoppippi commentedon Jun 3, 2025
Hi nnamon!
Yes, I think we can integrate with https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json file.
This is my inital thought by the way.
I'll work on it tomorrow(maybe Claude Code can write code for my while I'm sleeping!)
Thank you for letting me know!
ryoppippi commentedon Jun 3, 2025
so it's related to #3
ryoppippi commentedon Jun 3, 2025
So I'm working on the updated version,
and I found the cost mismatch
nnamon commentedon Jun 3, 2025
Wow, the original reported cost being half of the actual API price is quite a big discrepancy.
ryoppippi commentedon Jun 3, 2025
This only happens in opus model. Here is the summary by Claude Code:
As far as my understanding, the price hasn't changed
ryoppippi commentedon Jun 3, 2025
I need your help!!!!!
I have pushed the validation scripts to the alpha branch.
https://github.com/ryoppippi/ccusage/blob/91adb43e7bdb34f1808f5f8e49f54809924cfbe8/verify-pricing.ts
I would like you guys to test the script and report it here. This helps me to improve
ccusage. Thanksgit clone https://github.com/ryoppippi/ccusage cd ccusage git checkout 91adb43 bun i bun ./verify-prising.tsAlso, you can test the new one by
nnamon commentedon Jun 3, 2025
I've attached the output from my box.
verify_pricing.txt
Looks like it's mostly matching with 3% discrepancy. Awesome work! :)
ryoppippi commentedon Jun 3, 2025
@nnamon
Thank you for your report.
This is interesting because in your environment, all of the difference comes from
sonnet, while my issue comes fromopus.nnamon commentedon Jun 3, 2025
Could probably be because I usually use sonnet most of the time and the error came from a bugged version? I sampled a few of the files, they were all from versions 1.0.7.
ryoppippi commentedon Jun 3, 2025
Oh really? How did you find the log comes from version 1.0.7
ryoppippi commentedon Jun 3, 2025
In my log, I found a mimatch before releasing 1.0.7 🤔
itsUndefined commentedon Jun 3, 2025
Here are my logs in case they help you with the investigation. I run your scripts using ts-node because I don't have bun installed. I always restarted claude code as soon as I saw the message "Update installed. Restart to apply"
verify-pricing.txt
ryoppippi commentedon Jun 3, 2025
@itsUndefined
Thanks. It looks like you can run it successfully.
Oh
81.9%matches? hmm3 remaining items
itsUndefined commentedon Jun 3, 2025
That's just the output of running
ts-node index.tson the commit91adb43, not sure if it's actually "good"nnamon commentedon Jun 3, 2025
I've got a modified verified-pricing.ts which dumps the version:
verify-pricing.ts.txt
verify_pricing_output_with_version.txt
Though, it could be just something on the server side end during that same time period for all of us that was reporting the wrong costUSDs regardless of version as @itsUndefined mentioned.
ryoppippi commentedon Jun 3, 2025
Thank you guys! I'll preparing for the script!
ryoppippi commentedon Jun 3, 2025
Hi! I pushed the new script. Check it out!!
mimikun commentedon Jun 3, 2025
I tried it myself, but I haven't used it much, so I don't know if it will be of any help. I ran it on the claude v1.0.3 and the v1.0.9.
log file: https://gist.github.com/mimikun/f10f44ac8417d52904fd96c42d8e2d5e
In my case, there was no difference in the numbers. I haven't used claude cli yet after updating.
[-]Claude Code 1.0.9 no longer reports the costUSD field[/-][+]Claude Code 1.0.7 no longer reports the costUSD field[/+]ryoppippi commentedon Jun 3, 2025
@mimikun I guess you are using API usage plan right? not max
itsUndefined commentedon Jun 3, 2025
verify-pricing-new.txt , using Max Plan 5x
mimikun commentedon Jun 3, 2025
I forgot to mention. sorry. that I am using for the Max Plan (100 USD/month).
[-]Claude Code 1.0.7 no longer reports the costUSD field[/-][+]Claude Code 1.0.9 no longer reports the costUSD field[/+]ryoppippi commentedon Jun 3, 2025
Thanks guys!!
Based on the verification so far.
costUSDvalues are different from API pricesFor now, we will incorporate this mechanism and create a new version
nnamon commentedon Jun 3, 2025
Awesome work @ryoppippi, thank you!
ryoppippi commentedon Jun 3, 2025
THANK YOU GUYS.
JUST PUBLISHED!!!!
GIVE ME FIVE!!!