Skip to content

Instantly share code, notes, and snippets.

@ricky9w
Created February 25, 2026 17:10
Show Gist options
  • Select an option

  • Save ricky9w/247e1c3d99f1aab9a4d98bac21d6597f to your computer and use it in GitHub Desktop.

Select an option

Save ricky9w/247e1c3d99f1aab9a4d98bac21d6597f to your computer and use it in GitHub Desktop.
A simple status line script for Claude Code that shows token usage.
{
"statusLine": {
"type": "command",
"command": "/bin/bash ~/.claude/statusline.sh",
"padding": 0
}
}
#!/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