Skip to main content
statuslinesSource-backedReview first Safety Privacy

Python Rich Statusline - Statuslines

Feature-rich statusline using Python's Rich library for beautiful formatting, progress bars, and real-time token cost tracking

by JSONbored·added 2025-10-01·
HarnessClaude Code
Language:python
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://rich.readthedocs.io/, https://github.com/JSONbored/awesome-claude/blob/main/content/statuslines/python-rich-statusline.mdx
Safety notes
Runs as a Claude Code statusline command on refresh and depends on the local Python/Rich environment being available., Does not perform network calls or write files, but statusline failures may affect prompt/status rendering until dependencies are installed.
Privacy notes
Reads Claude Code statusline JSON from stdin, including model, workspace path, token usage, estimated cost, and Git branch when present., Displays workspace path, Git branch, token usage, and cost information in the local terminal statusline.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-01

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Config edit

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

3/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

6 prerequisites to line up before setup.

0/6 ready
Install & runtime3Network & hosting2General1

Safety & privacy surface

Safety & privacy surface

2 safety and 2 privacy notes across 3 risk areas. Review closely: credentials & tokens, network access.

3 areas
  • SafetyExecution & processesRuns as a Claude Code statusline command on refresh and depends on the local Python/Rich environment being available.
  • SafetyNetwork accessDoes not perform network calls or write files, but statusline failures may affect prompt/status rendering until dependencies are installed.
  • PrivacyCredentials & tokensReads Claude Code statusline JSON from stdin, including model, workspace path, token usage, estimated cost, and Git branch when present.
  • PrivacyCredentials & tokensDisplays workspace path, Git branch, token usage, and cost information in the local terminal statusline.

Safety notes

  • Runs as a Claude Code statusline command on refresh and depends on the local Python/Rich environment being available.
  • Does not perform network calls or write files, but statusline failures may affect prompt/status rendering until dependencies are installed.

Privacy notes

  • Reads Claude Code statusline JSON from stdin, including model, workspace path, token usage, estimated cost, and Git branch when present.
  • Displays workspace path, Git branch, token usage, and cost information in the local terminal statusline.

Prerequisites

  • Claude Code CLI installed and configured
  • Python 3.7+ installed and available in PATH (python3 command)
  • Rich library installed (pip3 install rich or python3 -m pip install rich)
  • Terminal with UTF-8 encoding support (required for Unicode emojis: 🤖 📁 🎯 💰)
  • Terminal with truecolor support (24-bit color, recommended for best Rich rendering - set COLORTERM=truecolor)
  • Git command (optional, for Git branch display - statusline works without Git)

Schema details

Install type
config
Reading time
1 min
Difficulty score
3
Troubleshooting
Yes
Breaking changes
No
Runtime and command metadata
Script language
python
Script body
#!/usr/bin/env python3

import sys
import json
from rich.console import Console
from rich.text import Text

console = Console()

# Read JSON from stdin
try:
    data = json.load(sys.stdin)
except json.JSONDecodeError:
    console.print("[red]Error: Invalid JSON input[/red]")
    sys.exit(1)

# Extract session data
model = data.get('model', 'unknown')
workspace = data.get('workspace', {}).get('path', '~').replace(f"{os.path.expanduser('~')}", '~')
tokens = data.get('session', {}).get('totalTokens', 0)
cost = data.get('session', {}).get('estimatedCost', 0.0)
git_branch = data.get('git', {}).get('branch', None)

# Build status components
status = Text()

# Model indicator with emoji
status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")

# Directory
status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")

# Git branch if available
if git_branch:
    status.append(" │ ", style="dim")
    status.append(" ", style="bold")
    status.append(f"{git_branch}", style="magenta")

# Token usage
status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
status.append(f"{tokens:,}", style="green" if tokens < 100000 else "yellow")

# Cost with dynamic coloring
if cost > 0:
    status.append(" │ ", style="dim")
    status.append("💰 ", style="bold")
    cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
    status.append(f"${cost:.3f}", style=cost_color)

console.print(status)
Full copyable content
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py",
    "refreshInterval": 1000
  }
}

About this resource

Features

  • Rich library for beautiful terminal formatting
  • Real-time token cost calculation and display
  • Progress bar showing session token usage
  • Git branch and status indicators
  • Emoji support for visual feedback
  • Dynamic color schemes based on cost thresholds
  • JSON parsing with error handling
  • Customizable Rich table layouts for multi-metric display

Use Cases

  • Track token costs in real-time during long sessions
  • Monitor git branch when working across multiple projects
  • Visual feedback for budget-conscious API usage
  • Enhanced aesthetics for presentation or streaming
  • Python developers leveraging Rich library ecosystem
  • Data visualization enthusiasts wanting rich terminal output

Requirements

  • Claude Code CLI installed and configured
  • Python 3.7+ installed and available in PATH (python3 command)
  • Rich library installed (pip3 install rich or python3 -m pip install rich)
  • Terminal with UTF-8 encoding support (required for Unicode emojis: 🤖 📁 🎯 💰)
  • Terminal with truecolor support (24-bit color, recommended for best Rich rendering - set COLORTERM=truecolor)
  • Git command (optional, for Git branch display - statusline works without Git)

Configuration

{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py",
    "refreshInterval": 1000
  }
}

Examples

Enhanced Python Rich Statusline with Progress Bar

Extended version with Rich progress bar showing token usage percentage

#!/usr/bin/env python3

import sys
import json
import os
from rich.console import Console
from rich.text import Text
from rich.progress import BarColumn, Progress

console = Console()

try:
    data = json.load(sys.stdin)
except json.JSONDecodeError:
    console.print("[red]Error: Invalid JSON input[/red]")
    sys.exit(1)

model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)

tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)

# Token limit (adjust based on model)
if 'sonnet' in model.lower() or 'opus' in model.lower():
    token_limit = 1000000
else:
    token_limit = 200000

token_percentage = min((tokens / token_limit) * 100, 100)

# Git branch
git_branch = None
if os.path.exists('.git'):
    try:
        import subprocess
        result = subprocess.run(
            ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
            capture_output=True,
            text=True,
            timeout=1
        )
        if result.returncode == 0:
            git_branch = result.stdout.strip()
    except (subprocess.TimeoutExpired, FileNotFoundError):
        pass

status = Text()

status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")

status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")

if git_branch:
    status.append(" │ ", style="dim")
    status.append(f"{git_branch}", style="magenta")

status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = "green" if token_percentage < 50 else "yellow" if token_percentage < 80 else "red"
status.append(f"{tokens:,}", style=token_style)
status.append(f" ({token_percentage:.1f}%)", style="dim")

if cost > 0:
    status.append(" │ ", style="dim")
    status.append("💰 ", style="bold")
    cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
    status.append(f"${cost:.3f}", style=cost_color)

console.print(status)

Python Rich Statusline with Custom Themes

Version with configurable color themes via environment variables

#!/usr/bin/env python3

import sys
import json
import os
from rich.console import Console
from rich.text import Text

console = Console()

try:
    data = json.load(sys.stdin)
except json.JSONDecodeError:
    console.print("[red]Error: Invalid JSON input[/red]")
    sys.exit(1)

# Theme configuration (via environment variables)
theme = os.environ.get('RICH_STATUSLINE_THEME', 'default')

themes = {
    'default': {
        'model': 'bold cyan',
        'directory': 'yellow',
        'git': 'magenta',
        'token_low': 'green',
        'token_med': 'yellow',
        'token_high': 'red',
        'cost_low': 'green',
        'cost_med': 'yellow',
        'cost_high': 'red'
    },
    'dark': {
        'model': 'bold white',
        'directory': 'bright_white',
        'git': 'bright_magenta',
        'token_low': 'bright_green',
        'token_med': 'bright_yellow',
        'token_high': 'bright_red',
        'cost_low': 'bright_green',
        'cost_med': 'bright_yellow',
        'cost_high': 'bright_red'
    },
    'minimal': {
        'model': 'cyan',
        'directory': 'white',
        'git': 'white',
        'token_low': 'white',
        'token_med': 'white',
        'token_high': 'white',
        'cost_low': 'white',
        'cost_med': 'white',
        'cost_high': 'white'
    }
}

colors = themes.get(theme, themes['default'])

model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)

tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)

git_branch = None
if os.path.exists('.git'):
    try:
        import subprocess
        result = subprocess.run(
            ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
            capture_output=True,
            text=True,
            timeout=1
        )
        if result.returncode == 0:
            git_branch = result.stdout.strip()
    except (subprocess.TimeoutExpired, FileNotFoundError):
        pass

status = Text()

status.append("🤖 ", style="bold")
status.append(f"{model}", style=colors['model'])
status.append(" │ ", style="dim")

status.append("📁 ", style="bold")
status.append(f"{workspace}", style=colors['directory'])

if git_branch:
    status.append(" │ ", style="dim")
    status.append(f"{git_branch}", style=colors['git'])

status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = colors['token_low'] if tokens < 100000 else colors['token_med'] if tokens < 500000 else colors['token_high']
status.append(f"{tokens:,}", style=token_style)

if cost > 0:
    status.append(" │ ", style="dim")
    status.append("💰 ", style="bold")
    cost_style = colors['cost_low'] if cost < 0.10 else colors['cost_med'] if cost < 1.0 else colors['cost_high']
    status.append(f"${cost:.3f}", style=cost_style)

console.print(status)

Python Rich Statusline Installation Example

Complete setup script with Rich library installation and Python version verification

#!/bin/bash
# Installation script for Python Rich Statusline

# Check Python version
if ! command -v python3 &> /dev/null; then
    echo "Python 3 is required but not installed"
    echo "Install Python 3: macOS (brew install python3), Linux (sudo apt-get install python3 or sudo yum install python3)"
    exit 1
fi

PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
echo "Python version: $PYTHON_VERSION"

# Check if Rich is installed
if ! python3 -c "import rich" 2>/dev/null; then
    echo "Installing Rich library..."
    python3 -m pip install rich --user || python3 -m pip install rich
    echo "Rich library installed"
else
    echo "Rich library already installed"
fi

# Verify Rich installation
if python3 -c "import rich" 2>/dev/null; then
    RICH_VERSION=$(python3 -c "import rich; print(rich.__version__)" 2>/dev/null || echo "unknown")
    echo "Rich version: $RICH_VERSION"
else
    echo "Error: Rich library installation failed"
    exit 1
fi

# Test emoji support
if python3 -c "print('🤖 📁 🎯 💰')" &> /dev/null; then
    echo "Emoji support verified: 🤖 📁 🎯 💰"
else
    echo "Warning: Emoji support may not be available"
fi

# Test Rich console
if python3 -c "from rich.console import Console; Console().print('[bold green]Test[/bold green]')" &> /dev/null; then
    echo "Rich console working"
else
    echo "Warning: Rich console test failed"
fi

# Check for truecolor support
if [ -n "$COLORTERM" ] && [ "$COLORTERM" = "truecolor" ]; then
    echo "Truecolor support enabled"
else
    echo "Note: Set COLORTERM=truecolor for best color support"
fi

# Create statuslines directory
mkdir -p .claude/statuslines

cat > .claude/statuslines/python-rich-statusline.py << 'SCRIPT_EOF'
#!/usr/bin/env python3

import sys
import json
import os
from rich.console import Console
from rich.text import Text

console = Console()

try:
    data = json.load(sys.stdin)
except json.JSONDecodeError:
    console.print("[red]Error: Invalid JSON input[/red]")
    sys.exit(1)

model = data.get('model', {}).get('display_name') or data.get('model', {}).get('id') or 'unknown'
workspace_path = data.get('workspace', {}).get('current_dir') or data.get('workspace', {}).get('path') or data.get('cwd', '~')
workspace = workspace_path.replace(os.path.expanduser('~'), '~')
workspace = os.path.basename(workspace)

tokens = data.get('cost', {}).get('total_lines_added') or data.get('session', {}).get('totalTokens', 0)
cost = data.get('cost', {}).get('total_cost_usd') or data.get('session', {}).get('estimatedCost', 0.0)

git_branch = None
if os.path.exists('.git'):
    try:
        import subprocess
        result = subprocess.run(
            ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
            capture_output=True,
            text=True,
            timeout=1
        )
        if result.returncode == 0:
            git_branch = result.stdout.strip()
    except (subprocess.TimeoutExpired, FileNotFoundError):
        pass

status = Text()

status.append("🤖 ", style="bold")
status.append(f"{model}", style="bold cyan")
status.append(" │ ", style="dim")

status.append("📁 ", style="bold")
status.append(f"{workspace}", style="yellow")

if git_branch:
    status.append(" │ ", style="dim")
    status.append(f"{git_branch}", style="magenta")

status.append(" │ ", style="dim")
status.append("🎯 ", style="bold")
token_style = "green" if tokens < 100000 else "yellow" if tokens < 500000 else "red"
status.append(f"{tokens:,}", style=token_style)

if cost > 0:
    status.append(" │ ", style="dim")
    status.append("💰 ", style="bold")
    cost_color = "green" if cost < 0.10 else "yellow" if cost < 1.0 else "red"
    status.append(f"${cost:.3f}", style=cost_color)

console.print(status)
SCRIPT_EOF

chmod +x .claude/statuslines/python-rich-statusline.py

# Add to settings.json
if [ ! -f .claude/settings.json ]; then
    echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py","refreshInterval":1000}}' > .claude/settings.json
else
    jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py","refreshInterval":1000}' .claude/settings.json > .claude/settings.json.tmp
    mv .claude/settings.json.tmp .claude/settings.json
fi

echo "Python Rich Statusline installed successfully!"
echo "Note: Ensure terminal supports truecolor for best color rendering"
echo "Set with: export COLORTERM=truecolor"

Troubleshooting

ModuleNotFoundError: No module named 'rich'

Install the Rich library: pip3 install rich or python3 -m pip install rich. Verify installation: python3 -c 'import rich'. Check Python path: python3 -c 'import sys; print(sys.path)'. If using virtual environment, activate it first. For user installation: python3 -m pip install --user rich. Verify Rich version: python3 -c 'import rich; print(rich.version)'.

Emojis displaying as boxes or not rendering

Ensure terminal supports Unicode emojis. Use iTerm2, Kitty, or Windows Terminal. Test with: python3 -c 'print("🤖 Test")'. Verify terminal encoding: locale charmap (should be UTF-8). Set encoding: export LANG=en_US.UTF-8. Check font supports emojis: Install emoji-capable font (e.g., Noto Color Emoji). Test emoji rendering: python3 -c "from rich.console import Console; Console().print('🤖 📁 🎯 💰')".

Colors look washed out or incorrect

Enable truecolor support. Set COLORTERM=truecolor environment variable or use a terminal that supports 24-bit color. Verify truecolor: python3 -c "from rich.console import Console; c = Console(); print(c.is_terminal, c.color_system)". Check terminal: iTerm2, Kitty, Windows Terminal support truecolor. Test colors: python3 -c "from rich.console import Console; Console().print('[bold red]Red[/bold red] [bold green]Green[/bold green]')". If still issues, check terminal color settings.

Script execution too slow

Rich has some startup overhead. Consider increasing refreshInterval to 2000-3000ms or use the minimal-powerline statusline instead. Check Python startup time: time python3 -c 'import rich'. Optimize imports: Only import what's needed (from rich.console import Console, from rich.text import Text). Consider using faster alternatives: Use bash statusline for better performance. Profile script: python3 -m cProfile script.py to identify bottlenecks.

Python version error or incompatible

Rich requires Python 3.7+. Check Python version: python3 --version (should be 3.7+). Verify Python 3: which python3 (should return path). If Python 3.6 or older, upgrade: macOS (brew install python3), Linux (sudo apt-get install python3.8 or newer). Check if python3 points to correct version: python3 -c 'import sys; print(sys.version)'.

Git branch not detected despite being in repository

Check Git installed: git --version. Verify subprocess works: python3 -c "import subprocess; print(subprocess.run(['git', '--version'], capture_output=True, text=True).stdout)". Check timeout: Script uses 1 second timeout - increase if Git is slow. Verify Git command: python3 -c "import subprocess; result = subprocess.run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], capture_output=True, text=True, timeout=1); print(result.stdout)". Check .git directory: os.path.exists('.git') should return True.

JSON parsing errors or invalid input

Verify JSON input: echo '$input' | python3 -m json.tool (should parse without errors). Check JSON structure: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print(data.keys())". Verify stdin: Script reads from sys.stdin - ensure JSON is piped correctly. Test with sample JSON: echo '{"model":{"display_name":"test"}}' | python3 script.py. Check error handling: Script should print error message and exit gracefully on invalid JSON.

Token count or cost showing as 0 or incorrect values

Check JSON field names: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print(data.get('cost', {}).get('total_cost_usd'))". Verify field extraction: Script checks multiple field names (cost.total_cost_usd, session.estimatedCost). Check if fields exist: echo '$input' | python3 -c "import json, sys; data = json.load(sys.stdin); print('cost' in data, 'session' in data)". Verify data structure: Some Claude Code versions may use different field names. Update script to check additional field names if needed.

Source citations

Add this badge to your README

Show that Python Rich Statusline - Statuslines is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/statuslines/python-rich-statusline.svg)](https://heyclau.de/entry/statuslines/python-rich-statusline)

How it compares

Python Rich Statusline - 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

Feature-rich statusline using Python's Rich library for beautiful formatting, progress bars, and real-time token cost tracking

Open dossier

Real-time burn rate monitor showing cost per minute, tokens per minute, and projected daily spend to prevent budget overruns during Claude Code sessions.

Open dossier

Real-time AI cost tracking statusline with per-session spend analytics, model pricing, and budget alerts

Open dossier

Claude Code statusline that reads Anthropic Claude Code Analytics Admin API data and shows daily estimated cost, hourly pace, sessions, and budget pressure.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
SubmitterDiffersMkDev11
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Brand
Categorystatuslinesstatuslinesstatuslinesstatuslines
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredMkDev11
Added2025-10-012025-10-252025-10-162026-06-04
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesRuns as a Claude Code statusline command on refresh and depends on the local Python/Rich environment being available. Does not perform network calls or write files, but statusline failures may affect prompt/status rendering until dependencies are installed.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.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.Claude Code Analytics data is daily aggregated and can lag recent activity, so the burn-rate display is a pacing signal rather than real-time billing control. Keep the refresh interval moderate because the statusline calls an authenticated Admin API endpoint. Treat budget thresholds as operational prompts; reconcile invoices and Console reports before making spending decisions.
Privacy notesReads Claude Code statusline JSON from stdin, including model, workspace path, token usage, estimated cost, and Git branch when present. Displays workspace path, Git branch, token usage, and cost information in the local terminal statusline.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.Reads the Claude Code statusline JSON from stdin (model, token usage, and cost) and renders it in the local terminal; it does not send data off-machine.The script sends an Admin API request to Anthropic and receives organization-level Claude Code analytics. It prints aggregate cost, session, and budget numbers, not email addresses, model names, prompts, file paths, or code. Admin API keys can expose organization analytics; store them in a scoped local secret manager or shell environment with restricted access. The script feeds the API key to curl through a config file descriptor instead of command-line arguments and unsets the exported key before launching curl, reducing process-list exposure on shared machines.
Prerequisites
  • Claude Code CLI installed and configured
  • Python 3.7+ installed and available in PATH (python3 command)
  • Rich library installed (pip3 install rich or python3 -m pip install rich)
  • Terminal with UTF-8 encoding support (required for Unicode emojis: 🤖 📁 🎯 💰)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ required for floating point calculations - script will fail without bc)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, arithmetic operations, and string manipulation)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • awk command (for floating point cost calculation with printf - preferred method)
  • Anthropic Admin API access for an organization with Claude Code Analytics enabled.
  • ANTHROPIC_ADMIN_API_KEY set in the statusline environment; prefer a narrowly scoped/read-only credential if Anthropic offers one for analytics access.
  • curl and jq available on the machine running the Claude Code statusline command.
  • Optional CLAUDE_CODE_ANALYTICS_EMAIL to limit the display to one user and CLAUDE_CODE_DAILY_BUDGET_USD to set the budget denominator.
Install
Config
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/python-rich-statusline.py",
    "refreshInterval": 1000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/burn-rate-monitor.sh",
    "refreshInterval": 500
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/real-time-cost-tracker.sh",
    "refreshInterval": 1000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/claude-code-analytics-burn-statusline.sh"
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.