A tmux plugin that displays Claude AI usage statistics from ccusage in your tmux status bar.
- ccusage must be installed and available in your PATH
- tmux (tested with tmux 2.0+)
- Add the following line to your
~/.tmux.conf:
set -g @plugin 'yanskun/tmux-ccusage'-
Press
prefix + Ito install the plugin. -
Add ccusage variables to your status bar:
# Example: Add to your status-left or status-right
set -g status-right "#{ccusage_today_cost} #{ccusage_today_tokens} | %Y-%m-%d %H:%M"- Reload tmux configuration:
tmux source-file ~/.tmux.conf-
Clone this repository:
git clone https://github.com/yanskun/tmux-ccusage.git ~/.tmux/plugins/tmux-ccusage -
Add this line to your
~/.tmux.conf:run-shell ~/.tmux/plugins/tmux-ccusage/ccusage.tmux -
Reload tmux configuration:
tmux source-file ~/.tmux.conf
After installation, you can use the following interpolation variables in your tmux configuration:
| Variable | Description | Example Output |
|---|---|---|
#{ccusage_today_cost} |
Today's total cost | $0.12 |
#{ccusage_yesterday_cost} |
Yesterday's total cost | $0.06 |
#{ccusage_month_cost} |
This month's total cost | $12.35 |
#{ccusage_last_month_cost} |
Last month's total cost | $45.67 |
#{ccusage_today_tokens} |
Today's total tokens | 123K |
#{ccusage_yesterday_tokens} |
Yesterday's total tokens | 89K |
#{ccusage_today_input_tokens} |
Today's input tokens | 67K |
#{ccusage_today_output_tokens} |
Today's output tokens | 56K |
#{ccusage_today_models} |
Models used today | opus-4 sonnet-4 |
#{ccusage_total_cost} |
Total cost (all time) | $123.46 |
#{ccusage_total_tokens} |
Total tokens (all time) | 12M |
#{ccusage_total_input_tokens} |
Total input tokens (all time) | 8M |
#{ccusage_total_output_tokens} |
Total output tokens (all time) | 4M |
Add any of these variables to your tmux status bar:
# Show today's cost and tokens in status-right
set -g status-right "#{ccusage_today_cost} #{ccusage_today_tokens} | %Y-%m-%d %H:%M"
# Show cost comparison in status-left
set -g status-left "Today: #{ccusage_today_cost} Yesterday: #{ccusage_yesterday_cost} | "
# Show monthly summary
set -g status-right "Month: #{ccusage_month_cost} Today: #{ccusage_today_cost} | %H:%M"
# Show detailed breakdown
set -g status-right "#{ccusage_today_input_tokens}→#{ccusage_today_output_tokens} #{ccusage_today_cost} | #{ccusage_today_models}"
# Show total usage summary
set -g status-right "Total: #{ccusage_total_cost} (#{ccusage_total_tokens}) | Today: #{ccusage_today_cost}"- Tokens are automatically formatted with K/M suffixes for readability:
1500→1K1500000→1M
- Costs are displayed with dollar sign and rounded to 2 decimal places:
$0.12
- The plugin requires
ccusageto be installed and accessible in your PATH - Data is fetched in real-time when tmux refreshes the status bar
- If
ccusageis not available, default values ($0.00,0,none) will be displayed - The plugin uses basic shell tools for JSON parsing to minimize dependencies
For more comprehensive examples, see .tmux.conf.example which includes various configuration options and color schemes.
-
No data displayed: Ensure
ccusageis installed and working:ccusage daily --json
-
Permission denied: Make sure scripts are executable:
chmod +x ~/.tmux/plugins/tmux-ccusage/scripts/*.sh
-
Interpolation not working: If variables like
#{ccusage_today_cost}appear literally in your status bar:- Make sure the plugin is installed correctly via TPM
- Try restarting tmux completely:
tmux kill-server && tmux - For manual installation, ensure you have
run-shell ~/.tmux/plugins/tmux-ccusage/ccusage.tmuxin your config
-
Slow updates: The plugin fetches data on every status bar refresh. Consider adjusting tmux's
status-intervalif needed.
MIT