[BUG] Cost counts by requested model, not the model from response
Status Open
Reported on v2.1.289
Maintainer reply None cached
Activity 0 comments · opened Oct 5, 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?
Session cost is computed per request from the model client requested, not from the model in response. I have an alias for auto-router, which returns known models as the model which was used, but it's still gets classified as unrecognized model and overcounts spendings
What Should Happen?
When a response reports a model id - use it for cost lookup and fallback to requested model.
Error Messages/Logs
Steps to Reproduce
Point ANTHROPIC_BASE_URL at any gateway compatible with /messages that returns different model in response than requested, then compare modelUsage from claude -p --output-format json.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.289
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Related: https://github.com/anthropics/claude-code/issues/88659