[BUG] Output token usage in logs is incorrect (at least on MAX plan)

Resolved 💬 8 comments Opened Oct 24, 2025 by madmaxbr5 Closed Feb 7, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I'm on MAX plan, but like to check my token usage from time to time with ccusage or other log parsing tools. Recently, I noticed that the output token figures were very low. I'm writing a lot of code and markdown, but only seeing like a couple thousand output tokens per day; should be at least 10x higher.

So I took at peak at my recent session logs, and noticed that output tokens are being wildly undercounted. Example, looking at tool use results from writing a long markdown file, I see Cache_create of 8836 tokens (correct):
<img width="258" height="21" alt="Image" src="https://github.com/user-attachments/assets/80411585-e64b-431b-beb8-6246e655cc54" />
but outputs tokens is only 13!
<img width="142" height="24" alt="Image" src="https://github.com/user-attachments/assets/1ccfce3a-6e14-4121-b138-f3f3aee8d211" />

Those tokens had to be created from model outputs, so are simply not being correctly logged. Same goes for model thinking tokens which should also be output tokens.
Here's an analysis of the totals for this log file. This is a 3-day logfile in which the context windows has been filled and compacted probably a dozen times or so:

<img width="461" height="147" alt="Image" src="https://github.com/user-attachments/assets/4c1bfac6-9fcb-4db0-8ee6-8ec7e0b57ffd" />

What Should Happen?

Output token counts should be accurate in the logs, regardless of what plan the user is on.

Error Messages/Logs

Steps to Reproduce

  1. Create a new project
  2. Launch claude code in the directory
  3. Have claude write some code and markdown representing >10k tokens of output
  4. Sum all output tokens in the project logs; it will be far lower than actual output by more than an order of magnitude.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

v2.0.26

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗