[BUG] Token usage missing from Models stats when Claude Code is launched via shell alias
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?
When Claude Code is launched via a zsh shell alias that wraps the claude command with additional flags (for example, --dangerously-skip-permissions), token usage is tracked inconsistently:
- Token usage does appear in
/stats→ Overview - Token usage does NOT appear (or is incomplete) in
/stats→ Models (per-model statistics)
This causes the per-model usage view to underreport or miss usage entirely for sessions started via an alias.
What Should Happen?
Token usage should be tracked and attributed consistently across all statistics views, including Models, regardless of how Claude Code is launched:
- Directly via the
claudecommand - Indirectly via a shell alias that wraps
claudewith additional flags
Alias-based launches should not affect accounting or attribution logic.
Error Messages/Logs
Steps to Reproduce
- In zsh, define an alias:
``bash``
alias cc='claude --dangerously-skip-permissions'
- Launch Claude Code using the alias:
``bash``
cc
- Use Claude Code normally and consume tokens.
- Run
/statsinside Claude Code. - Observe:
- Overview shows correct token usage.
- Models does not include the usage from this session.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.19
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗