Feature Request: Log cost of session to disk (ideally in a structured way)
Status Closed — not planned
Maintainer reply None cached
Activity 6 comments · opened Jun 26, 2025 · closed Jan 11, 2026
I would like to generate a cost report showing me how much I spend per project/directory per day.
Would be great to have something logged in JSON, ideally structured (eg. some field called total_cost_usd), in the context of a timestamp (eg. end of session if logging the total cost accrued throughout a session) as well as the project.
One simple way to do this would be to add a jsonl line to the .jsonl files in ~/.claude/projects/ after exiting claude, with the some session cost metadata?
6 Comments
This would also be super useful to get costs for cancelled non-interactive sessions (where the last "result" message is not received)
When exiting CC would log the cost for that session. Its now been removed as a feature.
https://github.com/anthropics/claude-code/issues/9293
https://github.com/anthropics/claude-code/issues/9463
Both of the above have been closed as a duplicate of this issue. This issue requests it logged to disk. The other two tickets request the existing behaviour be reinstated.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Bump
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
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.