Monitor session costs and maintain context effortlessly.
Project details
Tokendiet provides a real-time view of session costs in Claude Code, helping users manage their token usage effectively. With detailed cost estimation and visual cues, it encourages users to clear their context before expenses escalate, ensuring a streamlined coding experience.
tokendiet provides an efficient and transparent Claude Code statusline that tracks the real-time costs of a coding session, ensuring users are informed about their token usage and can act proactively by using the /clear command when necessary.
The core focus of tokendiet is on managing context size rather than verbosity in responses. This approach is vital, as expenses escalate quickly in lengthy sessions, regardless of the length of individual responses. For further insights, visit the detailed explanation at mcancellotti.github.io/tokendiet.
Context Monitoring: Displays a context bar that visually tracks the token usage over time, shifting from green (under 150K tokens) to yellow (over 150K tokens) and to red (above 350K tokens).
Cost Tracking for Each Turn: Each turn displays the incremental token usage compared to previous interactions, providing a clear picture of cost escalation over time. The reporting format is as follows:
Opus 5 · ~/myproject · main* · ██████░░░░ 620K/1.0M · $18.40 · ⚠ /clear
turn +160K · $1.40 · 6.7× vs first turn · 1h34m
Customizable Configuration: Users can set thresholds for warnings (yellow and red states) and control the output format based on personal preferences.
Secure and Privacy-Conscious: tokendiet doesn't communicate with external servers, ensuring total privacy. It processes only session data and stores minimal information locally for efficiency.
Extensive sessions may incur costs that compound with every turn, leading to unsustainable expenses. The tool analyzes past session data to quantify costs accurately, helping to visualize the need for context-clearing at critical moments.
Using a statusline approach ensures that monitoring costs nothing in terms of tokens. Unlike alternative methods that could add to input costs, tokendiet operates independently, presenting essential metrics where users can view them without incurring additional charges.
Set up is straightforward, requiring minimal steps to integrate into the existing Claude Code environment.
Customize the statusline with user-specific commands and preferences to append token diet management to your workflow seamlessly.
For a hands-on experience, testing can be performed to ensure configurations are working as intended with the included test scripts.
In summary, tokendiet serves as a crucial tool for developers utilizing Claude Code, delivering insights that can significantly reduce costs associated with token usage during extended coding sessions.
Comments
0Start the conversation
Share the first comment.