[BUG] In Claude Code versions after 2.1.7, the input_tokens and output_tokens fields in the JSON are inaccurate

Resolved 💬 2 comments Opened Jan 21, 2026 by best-joker Closed Mar 4, 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?

After integrating third-party models that follow Anthropic’s API format, the JSON files saved in the ~\.claude\projects folder for each session always show input_tokens and output_tokens as 0. However, before version 2.1.6 this did not happen, and the statistics were correct. This affects my ability to track the current conversation context length. Third-party API users in Claude Code can no longer find any way to view the current context length. Please fix this issue 🥹 — it’s very important to us.

What Should Happen?

input_tokens and output_tokens should not be 0.

Error Messages/Logs

Steps to Reproduce

Nothing

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.6

Claude Code Version

2.1.14

Platform

Other

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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