[BUG] /cost Command Underreporting Actual Charges

Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 14 comments · opened May 12, 2025 · closed May 14, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
I noticed the /cost output is no longer matching how much is being deducted from my account on console.anthropic.com/settings/billing and much more money is actually being deducted than what /cost is reporting. For instance, this short session it's telling me the cost was $0.2230 but I was watching my billing page and it went from balance of $15.73 at the start of this session to $14.30 currently so it deducted $1.43 and not $0.22. This was happening for my earlier sessions but I didn't watch them as carefully and just noticed that /cost was claiming I only spent a couple of dollars today but in reality around $12 got deducted. So I started to watch more closely with this current session. What's happening with the billing? Is /cost broken or is it overcharging? It feels like the latter to me based on previous usage.

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 0.2.107
  • Feedback ID: 9361be75-a09a-4ebf-8dfd-2b4d0be7415c

View original on GitHub ↗

14 Comments

chrissiwaffler · 1 year ago

The /cost command is also for me massively underreporting the actual cost.
A few days ago I also asked support to clarify the cost of the “Prompt Caching Read” tokens, as their API prices are quoted at 0.30 USD per MTok, while the actual cost to me is pretty much 0.50 USD per MTok.
I haven't received a response yet. 🙁

has207 · 1 year ago

good to hear I'm not alone, seems like this might be tied to the move to "max" pricing somehow...

StephenBadger · 1 year ago

I am also having this. I have stopped using CC for now because of it. Its a non negotiable for me and my devs to be able to be aware of the cost of what we are doing while we do it.

mauro3 · 1 year ago

I was just looking into this as well. In today's session reported token count by /cost was 120k and in the dash 3600k, as well as cost was reported $0.34 vs dash of >$2.

Naturally, I asked CC what was going on and ran below prompts in CC whilst also keeping tab on the web-dashboard:

> /cost
  ⎿  Total cost:            $0.3408
     Total duration (API):  12m 47.0s
     Total duration (wall): 1h 36m 7.4s
     Total code changes:    108 lines added, 25 lines removed
     Tokens:                120.8k base input, 0 cache write, 0 cache read, 18.8k base output

> Ok, let's have a quick check. Currently cost reports 120.8k base input, dash reports (for today, for which this session is 99%) 3,685,717 . I'll see what the token counter
  says for this very request and see.

● I understand you're trying to reconcile the significant discrepancy between what the CLI /cost command reports (120.8k input tokens) and what the dashboard shows
  (approximately 3.69 million input tokens) for today's usage.

  This suggests the CLI tool might only be counting the direct conversation tokens (what you type and what I respond with) while excluding all the tokens used in tool calls,
  context windows, and system instructions.

  When I process each request, especially those involving code reading and analysis, the entire files and previous conversation context are included in the input tokens. For
  example, when we read the source files earlier, each file's content became part of the input token count for the model.

  It would be interesting to see what the token counter reports for this specific message. This could give you a better understanding of how the token counting differs between
  the two reporting methods. Feel free to share those results if you'd like to discuss further.

> /cost
  ⎿  Total cost:            $0.3544
     Total duration (API):  13m 36.7s
     Total duration (wall): 1h 39m 8.8s
     Total code changes:    108 lines added, 25 lines removed
     Tokens:                132.6k base input, 0 cache write, 0 cache read, 19.3k base output

The token count in the web-dashboard after running this was 3,761,607. Thus the deltas were 12k vs 84k.

However, this discrepancy still seems low as /cost reported a token count of 120k up to that point and that was from a session a lot longer that 10x just above prompt and for which the dash reported 3600k. So, both the delta for one prompt is off as well as the token count of /cost in-itself.

rss-holmes · 1 year ago

I am also facing this issue while using claude api via Amazon Bedrock.The cost shown in the billing console is ~6X the cost shown in the Claude Code /cost command.

mindhunter77 · 1 year ago

Also having this issue, except the cost command seems to be correct, what is being removed from the balance seems to be an overcharge. Also, I just noticed that overnight I lost an even 1.00 with no usage on the system. That was a first I noticed too.

update: I noticed there was an update in reference this but it's still off. Here is from my test about 3 minutes ago.

balance: 11.83

     Total cost:            $0.0634
     Total duration (API):  2m 4.4s
     Total duration (wall): 7m 12.2s
     Total code changes:    23 lines added, 0 lines removed
     Tokens:                6.4k base input, 0 cache write, 0 cache read, 4.1k base output

New balance: 11.18

Difference: 0.65

The /cost told me six cents, actually took sixty-five cents

wolffiex collaborator · 1 year ago

Thanks for all these reports. We will make sure our cost reporting is accurate ASAP

bcherny collaborator · 1 year ago

This is fixed in the latest version. Restart to update.

has207 · 1 year ago

Can you share whether the bug was in /cost calculation or the billing? It sure felt like the billing charges were out of hand, in which case I would be expecting some refunds

mindhunter77 · 1 year ago

I too would like more information on this. It was happening for weeks, not days, and since it effects billing, I think being transparent about happened is a good idea.

GaryDean · 1 year ago

time for a /refund command.

arty-hlr · 1 year ago

I can't believe that there was no testing of any kind on this and that all this is working as intended.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.