Created
February 25, 2026 17:10
-
-
Save ricky9w/247e1c3d99f1aab9a4d98bac21d6597f to your computer and use it in GitHub Desktop.
A simple status line script for Claude Code that shows token usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "statusLine": { | |
| "type": "command", | |
| "command": "/bin/bash ~/.claude/statusline.sh", | |
| "padding": 0 | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| input=$(cat) | |
| MODEL=$(echo "$input" | jq -r '.model.display_name') | |
| PERCENT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1) | |
| TOKENS=$(echo "$input" | jq -r '.context_window.current_usage | ((.input_tokens // 0) + (.cache_creation_input_tokens // 0) + (.cache_read_input_tokens // 0))') | |
| TOKENS_K=$(awk "BEGIN {printf \"%.1f\", $TOKENS / 1000}") | |
| COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0') | |
| printf "🤖 %s | 🧠 %d%% (%sk) | 💰 \$%.2f" "$MODEL" "$PERCENT" "$TOKENS_K" "$COST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment