Install command
Not provided
Claude Code statusline that reads the active model identifier from session input and displays real-time token usage as a percentage of the context window, with green/yellow/red color-coded warnings.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Not provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
6 to clear
Platforms
1 listed
Difficulty
4/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Prerequisite readiness
6 prerequisites to line up before setup.
Safety & privacy surface
1 safety and 1 privacy notes across 1 risk area. Review closely: credentials & tokens.
#!/usr/bin/env bash
# Multi-Provider Token Counter - 2025 Context Limits
# Supports: Claude Sonnet 4 (1M), GPT-4.1 (1M), Gemini 2.x (1M), Grok 3 (1M)
read -r input
# Extract model and token info
model=$(echo "$input" | jq -r '.model // "unknown"')
tokens=$(echo "$input" | jq -r '.session.totalTokens // 0')
# Determine provider and context limit
if [[ "$model" == *"claude"* ]]; then
if [[ "$model" == *"sonnet-4"* ]] || [[ "$model" == *"sonnet-3.5"* ]]; then
limit=1000000
provider="Claude"
icon="🔮"
else
limit=200000
provider="Claude"
icon="🔮"
fi
elif [[ "$model" == *"gpt-4.1"* ]]; then
limit=1000000
provider="GPT-4.1"
icon="🤖"
elif [[ "$model" == *"gpt-4o"* ]]; then
limit=128000
provider="GPT-4o"
icon="🤖"
elif [[ "$model" == *"gemini"* ]]; then
if [[ "$model" == *"2."* ]] || [[ "$model" == *"1.5-pro"* ]]; then
limit=1000000
provider="Gemini"
icon="💎"
else
limit=128000
provider="Gemini"
icon="💎"
fi
elif [[ "$model" == *"grok-3"* ]]; then
limit=1000000
provider="Grok"
icon="⚡"
elif [[ "$model" == *"grok-4"* ]]; then
limit=256000
provider="Grok"
icon="⚡"
else
limit=100000
provider="Unknown"
icon="❓"
fi
# Calculate usage percentage
percentage=$(awk "BEGIN {printf \"%.1f\", ($tokens / $limit) * 100}")
# Color coding based on usage
if (( $(echo "$percentage < 50" | bc -l) )); then
color="\033[32m" # Green
elif (( $(echo "$percentage < 80" | bc -l) )); then
color="\033[33m" # Yellow
else
color="\033[31m" # Red
fi
# Format token count with commas
tokens_formatted=$(printf "%'d" $tokens)
limit_formatted=$(printf "%'d" $limit)
# Output statusline
echo -e "${icon} ${provider} │ ${color}${tokens_formatted}${color}\033[0m/${limit_formatted} (${percentage}%)\033[0m"{
"statusLine": {
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-provider-token-counter.sh",
"refreshInterval": 1000
}
}awk for floating-point percentage calculation with an integer fallback when bc is unavailable{
"statusLine": {
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-provider-token-counter.sh",
"refreshInterval": 1000
}
}
Extended version tracking input and output tokens separately
#!/usr/bin/env bash
# Enhanced Multi-Provider Token Counter with Input/Output Split
read -r input
model=$(echo "$input" | jq -r '.model.id // .model.display_name // "unknown"')
input_tokens=$(echo "$input" | jq -r '.cost.input_tokens // 0')
output_tokens=$(echo "$input" | jq -r '.cost.output_tokens // 0')
total_tokens=$((input_tokens + output_tokens))
# Determine provider and context limit (same logic as base script)
if [[ "$model" == *"claude"* ]] || [[ "$model" == *"Claude"* ]]; then
if [[ "$model" == *"sonnet-4"* ]] || [[ "$model" == *"sonnet-3.5"* ]] || [[ "$model" == *"Sonnet 4"* ]]; then
limit=1000000
provider="Claude"
icon="🔮"
else
limit=200000
provider="Claude"
icon="🔮"
fi
elif [[ "$model" == *"gpt-4.1"* ]] || [[ "$model" == *"GPT-4.1"* ]]; then
limit=1000000
provider="GPT-4.1"
icon="🤖"
elif [[ "$model" == *"gemini"* ]] || [[ "$model" == *"Gemini"* ]]; then
if [[ "$model" == *"2."* ]] || [[ "$model" == *"1.5-pro"* ]]; then
limit=1000000
provider="Gemini"
icon="💎"
else
limit=128000
provider="Gemini"
icon="💎"
fi
elif [[ "$model" == *"grok-3"* ]] || [[ "$model" == *"Grok 3"* ]]; then
limit=1000000
provider="Grok"
icon="⚡"
else
limit=100000
provider="Unknown"
icon="❓"
fi
# Calculate usage percentage
tokens=$total_tokens
if command -v awk > /dev/null 2>&1; then
percentage=$(awk "BEGIN {printf \"%.1f\", ($tokens / $limit) * 100}" 2>/dev/null || echo "0.0")
else
percentage="0.0"
fi
# Color coding
if command -v bc > /dev/null 2>&1; then
if (( $(echo "$percentage < 50" | bc -l 2>/dev/null) )); then
color="\033[32m"
elif (( $(echo "$percentage < 80" | bc -l 2>/dev/null) )); then
color="\033[33m"
else
color="\033[31m"
fi
else
percentage_int=${percentage%.*}
if [ $percentage_int -lt 50 ]; then
color="\033[32m"
elif [ $percentage_int -lt 80 ]; then
color="\033[33m"
else
color="\033[31m"
fi
fi
# Format token counts
if command -v printf > /dev/null 2>&1; then
tokens_formatted=$(printf "%'d" $tokens 2>/dev/null || echo "$tokens")
limit_formatted=$(printf "%'d" $limit 2>/dev/null || echo "$limit")
input_formatted=$(printf "%'d" $input_tokens 2>/dev/null || echo "$input_tokens")
output_formatted=$(printf "%'d" $output_tokens 2>/dev/null || echo "$output_tokens")
else
tokens_formatted="$tokens"
limit_formatted="$limit"
input_formatted="$input_tokens"
output_formatted="$output_tokens"
fi
RESET="\033[0m"
echo -e "${icon} ${provider} │ ${color}${tokens_formatted}${RESET}/${limit_formatted} (${percentage}%) │ In:${input_formatted} Out:${output_formatted}"
Version with configurable context limits via environment variables
#!/usr/bin/env bash
# Multi-Provider Token Counter with Custom Limits
read -r input
model=$(echo "$input" | jq -r '.model.id // .model.display_name // "unknown"')
tokens=$(echo "$input" | jq -r '.cost.total_lines_added // 0')
# Custom limits via environment variables (defaults to standard limits)
CLAUDE_LIMIT=${CLAUDE_TOKEN_LIMIT:-1000000}
GPT_LIMIT=${GPT_TOKEN_LIMIT:-1000000}
GEMINI_LIMIT=${GEMINI_TOKEN_LIMIT:-1000000}
GROK_LIMIT=${GROK_TOKEN_LIMIT:-1000000}
DEFAULT_LIMIT=${DEFAULT_TOKEN_LIMIT:-100000}
# Determine provider and context limit
if [[ "$model" == *"claude"* ]] || [[ "$model" == *"Claude"* ]]; then
limit=$CLAUDE_LIMIT
provider="Claude"
icon="🔮"
elif [[ "$model" == *"gpt"* ]] || [[ "$model" == *"GPT"* ]]; then
limit=$GPT_LIMIT
provider="GPT"
icon="🤖"
elif [[ "$model" == *"gemini"* ]] || [[ "$model" == *"Gemini"* ]]; then
limit=$GEMINI_LIMIT
provider="Gemini"
icon="💎"
elif [[ "$model" == *"grok"* ]] || [[ "$model" == *"Grok"* ]]; then
limit=$GROK_LIMIT
provider="Grok"
icon="⚡"
else
limit=$DEFAULT_LIMIT
provider="Unknown"
icon="❓"
fi
# Calculate usage percentage
if command -v awk > /dev/null 2>&1; then
percentage=$(awk "BEGIN {printf \"%.1f\", ($tokens / $limit) * 100}" 2>/dev/null || echo "0.0")
else
percentage="0.0"
fi
# Color coding
if command -v bc > /dev/null 2>&1; then
if (( $(echo "$percentage < 50" | bc -l 2>/dev/null) )); then
color="\033[32m"
elif (( $(echo "$percentage < 80" | bc -l 2>/dev/null) )); then
color="\033[33m"
else
color="\033[31m"
fi
else
percentage_int=${percentage%.*}
if [ $percentage_int -lt 50 ]; then
color="\033[32m"
elif [ $percentage_int -lt 80 ]; then
color="\033[33m"
else
color="\033[31m"
fi
fi
# Format token count
if command -v printf > /dev/null 2>&1; then
tokens_formatted=$(printf "%'d" $tokens 2>/dev/null || echo "$tokens")
limit_formatted=$(printf "%'d" $limit 2>/dev/null || echo "$limit")
else
tokens_formatted="$tokens"
limit_formatted="$limit"
fi
RESET="\033[0m"
echo -e "${icon} ${provider} │ ${color}${tokens_formatted}${RESET}/${limit_formatted} (${percentage}%)"
Complete setup script with provider detection testing and bc calculator verification
#!/bin/bash
# Installation script for Multi-Provider Token Counter
# Check for jq (required for JSON parsing)
if ! command -v jq &> /dev/null; then
echo "Installing jq for JSON parsing..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install jq
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y jq || sudo yum install -y jq
else
echo "Please install jq manually: https://jqlang.github.io/jq/"
fi
fi
# Check for bc (optional, for floating point comparison)
if ! command -v bc &> /dev/null; then
echo "Installing bc calculator (optional, for precise percentage comparison)..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install bc
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y bc || sudo yum install -y bc
else
echo "bc is optional - script will use integer comparison fallback"
fi
fi
# Test emoji/Unicode characters
if echo -e '🔮 🤖 💎 ⚡ ❓' &> /dev/null; then
echo "Emoji characters supported: 🔮 🤖 💎 ⚡ ❓"
else
echo "Warning: Emoji characters may not display correctly"
echo "Install Nerd Font or emoji-capable font"
fi
# Test color support
if echo -e '\033[32mGreen\033[0m' &> /dev/null; then
echo "ANSI color codes supported"
else
echo "Warning: ANSI color codes may not work"
fi
# Test TERM variable
if [ -n "$TERM" ]; then
echo "TERM variable set: $TERM"
else
echo "Warning: TERM variable not set - colors may not work"
echo "Set with: export TERM=xterm-256color"
fi
# Create statuslines directory
mkdir -p .claude/statuslines
cat > .claude/statuslines/multi-provider-token-counter.sh << 'SCRIPT_EOF'
#!/usr/bin/env bash
# Multi-Provider Token Counter - 2025 Context Limits
# Supports: Claude Sonnet 4 (1M), GPT-4.1 (1M), Gemini 2.x (1M), Grok 3 (1M)
read -r input
model=$(echo "$input" | jq -r '.model.id // .model.display_name // "unknown"')
tokens=$(echo "$input" | jq -r '.cost.total_lines_added // 0')
# Determine provider and context limit
if [[ "$model" == *"claude"* ]] || [[ "$model" == *"Claude"* ]]; then
if [[ "$model" == *"sonnet-4"* ]] || [[ "$model" == *"sonnet-3.5"* ]] || [[ "$model" == *"Sonnet 4"* ]]; then
limit=1000000
provider="Claude"
icon="🔮"
else
limit=200000
provider="Claude"
icon="🔮"
fi
elif [[ "$model" == *"gpt-4.1"* ]] || [[ "$model" == *"GPT-4.1"* ]]; then
limit=1000000
provider="GPT-4.1"
icon="🤖"
elif [[ "$model" == *"gemini"* ]] || [[ "$model" == *"Gemini"* ]]; then
if [[ "$model" == *"2."* ]] || [[ "$model" == *"1.5-pro"* ]]; then
limit=1000000
provider="Gemini"
icon="💎"
else
limit=128000
provider="Gemini"
icon="💎"
fi
elif [[ "$model" == *"grok-3"* ]] || [[ "$model" == *"Grok 3"* ]]; then
limit=1000000
provider="Grok"
icon="⚡"
else
limit=100000
provider="Unknown"
icon="❓"
fi
# Calculate usage percentage
if command -v awk > /dev/null 2>&1; then
percentage=$(awk "BEGIN {printf \"%.1f\", ($tokens / $limit) * 100}" 2>/dev/null || echo "0.0")
else
percentage="0.0"
fi
# Color coding based on usage
if command -v bc > /dev/null 2>&1; then
if (( $(echo "$percentage < 50" | bc -l 2>/dev/null) )); then
color="\033[32m" # Green
elif (( $(echo "$percentage < 80" | bc -l 2>/dev/null) )); then
color="\033[33m" # Yellow
else
color="\033[31m" # Red
fi
else
percentage_int=${percentage%.*}
if [ $percentage_int -lt 50 ]; then
color="\033[32m"
elif [ $percentage_int -lt 80 ]; then
color="\033[33m"
else
color="\033[31m"
fi
fi
# Format token count with commas
if command -v printf > /dev/null 2>&1; then
tokens_formatted=$(printf "%'d" $tokens 2>/dev/null || echo "$tokens")
limit_formatted=$(printf "%'d" $limit 2>/dev/null || echo "$limit")
else
tokens_formatted="$tokens"
limit_formatted="$limit"
fi
RESET="\033[0m"
echo -e "${icon} ${provider} │ ${color}${tokens_formatted}${RESET}/${limit_formatted} (${percentage}%)"
SCRIPT_EOF
chmod +x .claude/statuslines/multi-provider-token-counter.sh
# Add to settings.json
if [ ! -f .claude/settings.json ]; then
echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-provider-token-counter.sh","refreshInterval":1000}}' > .claude/settings.json
else
jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-provider-token-counter.sh","refreshInterval":1000}' .claude/settings.json > .claude/settings.json.tmp
mv .claude/settings.json.tmp .claude/settings.json
fi
echo "Multi-Provider Token Counter installed successfully!"
echo "Note: Ensure terminal supports emoji characters for provider icons"
echo "Test with: echo -e '🔮 🤖 💎 ⚡ ❓'"
Update model detection logic with latest model names. Check Claude docs for current model IDs. Verify model field: echo '$input' | jq .model.id. Test pattern matching: [[ "$model" == "claude" ]] && echo "Matched". Update limit values for new model versions. Check if tokens exceed limit (may indicate incorrect limit or token counting issue).
Install Nerd Font or emoji-capable font. Test with: echo '🔮 🤖 💎 ⚡ ❓'. Verify terminal encoding: locale charmap (should be UTF-8). Set encoding: export LANG=en_US.UTF-8. Check font configuration in terminal settings. If not supported, modify script to use ASCII alternatives: icon="[C]" for Claude, "[G]" for GPT, etc.
Ensure TERM environment variable supports colors: echo $TERM (should show 'xterm-256color' or similar). Set if needed: export TERM=xterm-256color. Test colors: echo -e '\033[32mGreen\033[0m' (should show green text). Check 256-color mode: tput colors (should be >= 256). Verify ANSI escape sequences are supported by terminal.
Add patterns to detection logic. Common patterns: claude-_ (Opus/Sonnet/Haiku), gpt-_ (4o/4.1/o3), gemini-_ (2.0/2.5-pro), grok-_ (3/4). Update with: [["$model" == "pattern"]]. Check model name format: echo '$input' | jq .model.id. Test pattern matching: [["test-claude-sonnet-4" == "claude"]] && echo "Matched". Add new model variants to appropriate provider block.
Increase awk precision for decimals. Current: awk 'BEGIN {printf "%.1f", ...}' (1 decimal). Use: awk 'BEGIN {printf "%.2f", ($tokens / $limit) _ 100}' for two decimals. Higher precision: awk 'BEGIN {printf "%.3f", ...}' (3 decimals). Note: Higher precision may slow execution. Verify calculation: echo '456789 1000000' | awk 'BEGIN {printf "%.1f", (456789 / 1000000) _ 100}' (should return 45.7).
Check JSON field names: echo '$input' | jq .cost.total_lines_added (tokens). Verify jq extraction: echo '$input' | jq -r '.cost.total_lines_added // 0'. Check if field exists: echo '$input' | jq 'has("cost")'. Verify token counting: Some Claude Code versions may use different field names (e.g., 'total_tokens', 'input_tokens', 'output_tokens'). Update script to check multiple field names.
Install bc calculator: macOS (brew install bc), Linux (sudo apt-get install bc or sudo yum install bc). Verify installation: command -v bc (should return /usr/bin/bc or similar). Test bc: echo '45.7 < 50' | bc -l (should return 1 for true). If bc unavailable, script uses integer comparison fallback. Verify fallback works: percentage_int=${percentage%.*} (extracts integer part).
Verify printf supports thousands separator: printf "%'d" 12345 (should return 12,345). Check locale settings: locale (should include thousands separator). Set locale if needed: export LC_NUMERIC=en_US.UTF-8. Test formatting: printf "%'d" 1234567 (should return 1,234,567). If not supported, script falls back to plain numbers. Alternative: Use awk for formatting: awk '{printf "%'"'"'d", $1}' <<< 12345.
Show that Multi Provider Token Counter - Statuslines is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/statuslines/multi-provider-token-counter)Multi Provider Token Counter - Statuslines side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
1 trust signal differ across this comparison (Submitter).
| Field | Claude Code statusline that reads the active model identifier from session input and displays real-time token usage as a percentage of the context window, with green/yellow/red color-coded warnings. Open dossier | Claude 5-hour conversation block tracker with visual countdown, expiration warnings, and color-coded indicators to prevent unexpected session terminations. Open dossier | Claude Code statusline that estimates context pressure from local session token counts and a configurable context limit, then prints a compact risk tier. Open dossier | Multi-provider AI performance dashboard with context occupancy tracking, truncation warnings, TTFT latency, tokens/min rate, and model comparison metrics. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| SubmitterDiffers | — | — | MkDev11 | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | statuslines | statuslines | statuslines | statuslines |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | MkDev11 | JSONbored |
| Added | 2025-10-16 | 2025-10-23 | 2026-06-04 | 2025-10-23 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Reads session JSON from stdin and writes formatted text to stdout only; does not modify files or make network calls. | ✓Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session. | ✓Context percentage is only as accurate as the configured limit and the usage fields available in the statusline input. Use the warning as a cue to summarize or checkpoint work before context pressure affects reasoning quality. Do not treat a low percentage as proof that all relevant files, instructions, or tool results are still in scope. | ✓Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session. |
| Privacy notes | ✓Processes token counts and model identifiers from the local Claude Code session input; no data is sent externally. | ✓Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine. | ✓The script reads local session counters and does not inspect prompt text, files, or transcript contents. Token counts and configured limits can still reveal workload size in screenshots or shared terminal logs. Teams should avoid placing customer names or project identifiers in shell variables that appear in debugging output. | ✓Reads the Claude Code statusline JSON from stdin (model, token usage, context occupancy) and renders it in the local terminal; it does not send data off-machine. |
| Prerequisites |
|
|
|
|
| Install | — | — | — | — |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.