<< Home | Work
Calculated API-equivalent token costs for Claude Code usage
| Area | Work |
| AI used | Claude Code |
| Source | r/BuildWithClaude |
| Posted | 2026-10-24 |
The move
Analyze your local Claude Code session logs to calculate API-equivalent token usage and costs.Steps
- Locate your Claude Code session logs on your local machine.
- Install the tokenburn tool using 'npx tokenburn-ai'.
- Run the tool against your log directory to generate a cost report.
- Use the --anonymize flag if you need to share the report securely.
Prompt for your AI
Analyze the Claude Code session logs located at [PATH_TO_LOGS] and calculate the total API-equivalent cost per project for the last [NUMBER] days.
What happened
The user was curious about their actual API usage while on a subscription plan. They built a local CLI tool that reads existing session logs to calculate costs per project and day. This allows users to track their spending without sending data to external servers.Watch out
The tool relies on internal log formats that may change with future updates. Dollar figures are list-price estimates and may not match your actual billing.Give it to your agent
Read https://howtheyuse.ai/p/calculated-api-equivalent-token-costs-for-claude-code-usage.md and help me do this.