A real-time status bar for monitoring Claude Code API usage, integrating directly with Claude Code's statusLine feature to display token usage, costs, and burn rate at the bottom of your interface.
δΈζζζ‘£ / Chinese Documentation
This tool adds a compact status bar to Claude Code that shows:
- Current model being used (reads from Claude Code context)
- Real token usage from your Claude session
- Cost calculation in USD based on actual usage
- Git branch and folder information
- Animated transitions for smooth updates
Example output:
claude-opus-4-1-20250805 | 19.43k | $1.46 | β main | π my-project
- Real Token Data: Reads actual token usage from Claude Code transcript files
- Real-time Model Detection: Automatically detects which Claude model you're using
- Accurate Cost Calculation: Calculates costs based on actual model pricing and real usage
- Git Integration: Shows current git branch
- Smooth Animations: Animated transitions when values change
- Color-coded Token Usage:
- π’ Green: < 20k tokens
- π‘ Yellow: 20k-50k tokens
- π Orange: 50k-100k tokens
- π΄ Red: > 100k tokens
curl -fsSL https://raw.githubusercontent.com/B143KC47/ClaudeCode_status_bar/main/web-install.sh | bashFeatures:
- β No password or authentication required
- β No sudo needed
- β Downloads directly from public GitHub repository
- β
Installs to user home directory (
~/.claude/)
This will:
- Download and install the status bar to
~/.claude/ClaudeCode_status_bar - Auto-configure
~/.claude/settings.jsonto use a local Node command - If a settings file already exists, it will print a snippet for you to paste
- Display instructions for restarting Claude Code
After installation, restart Claude Code to see the status bar at the bottom of your interface.
npm uninstall -g claude-code-status-bar && rm -rf ~/.claude/ClaudeCode_status_bar && sed -i '/"statusLine"/,/}/d' ~/.claude/settings.jsonThis will:
- Remove the global npm package (if installed)
- Delete the local installation directory
- Remove the statusLine configuration from your Claude settings
Use the one-line installer above for a completely passwordless and authentication-free setup. Alternatively, if you prefer to review the script first:
# Download and review the script
curl -fsSL https://raw.githubusercontent.com/B143KC47/ClaudeCode_status_bar/main/web-install.sh -o web-install.sh
cat web-install.sh # Review the script
bash web-install.sh # Run installationOr clone and use the local install script:
git clone https://github.com/B143KC47/ClaudeCode_status_bar.git
cd ClaudeCode_status_bar
./install.sh-
Clone this repository:
git clone https://github.com/B143KC47/ClaudeCode_status_bar.git cd ClaudeCode_status_bar -
Install dependencies:
npm install
-
Install globally (optional):
npm install -g . -
Configure Claude Code by editing
~/.claude/settings.json:{ "statusLine": { "type": "command", "command": "claude-statusbar", "padding": 0 } }If you didn't install globally (passwordless web install), use a local Node command:
{ "statusLine": { "type": "command", "command": "node ~/.claude/ClaudeCode_status_bar/bin/statusline.js", "padding": 0 } } -
Restart Claude Code to see the status bar at the bottom of your interface.
Run the Next.js web application for a demonstration dashboard with mock data.
-
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser
Note: The web dashboard uses mock data for demonstration purposes. The actual CLI status bar reads real token data from Claude Code.
-
Claude Code Integration
- Claude Code executes the status bar command approximately every 300ms
- Passes context JSON via stdin containing model info, version, and working directory
- Displays the first line of output at the bottom of the interface
-
Data Flow
Claude Code β Context JSON β stdin β statusline.js β Processing β stdout β Status Bar -
Model Detection
- Reads
model.display_nameormodel.idfrom Claude Code context - No hardcoding - always shows the actual model you're using
- Reads
The CLI tool (bin/statusline.js):
- Reads JSON context from stdin (provided by Claude Code)
- Extracts model information and session ID from context
- Reads actual token usage from Claude Code transcript files in
~/.claude/projects/ - Calculates costs based on real model pricing
- Implements smooth animations using state persistence
- Formats output with ANSI color codes
- Outputs single line to stdout
The status bar reads real token usage data from Claude Code:
- Session Detection: Identifies your current Claude session from context
- Transcript Reading: Reads JSONL transcript files from
~/.claude/projects/ - Token Extraction: Extracts actual output tokens from assistant messages
- Cost Calculation: Uses official Claude pricing for accurate cost tracking
- State Persistence: Maintains state between updates for smooth animations
To customize the status bar output, modify the formatStatusLine() function in bin/statusline.js:
function formatStatusLine(data) {
// Customize which information to display
// Modify colors, separators, or add/remove fields
// The function returns a single line string
}- Next.js 14: App Router with Server Actions
- TypeScript: Type-safe development
- Tailwind CSS: Responsive styling
- React Server Actions: Using
'use server'directive - useFormState Hook: React DOM hook for server action state management
- Node.js CLI: Real-time token tracking for Claude Code
The CLI status bar displays real token usage data from your Claude Code sessions:
- Full Model Version: Shows complete model ID (e.g.,
claude-opus-4-1-20250805) - Actual Token Counts: Reads real output tokens from Claude Code transcript files
- Accurate Costs: Calculates costs using official Claude API pricing
- Session Tracking: Tracks tokens for your current session
- Smooth Animations: Uses state persistence for animated value transitions
The Next.js web application provides a demonstration interface:
- Uses React Server Actions with
'use server'directive - Implements
useFormStatehook for form state management - Shows mock data for demonstration purposes
- Auto-refreshes every 5 seconds
The issue has been resolved! The problem was that the Claude Code settings file (~/.claude/settings.json) was missing the statusLine configuration. The configuration has been added:
{
"model": "claude-opus-4-20250514",
"statusLine": {
"type": "command",
"command": "claude-statusbar",
"padding": 0
}
}To see the status bar:
- Restart Claude Code (the configuration is already in place)
- The status bar should appear at the bottom of your interface
If you still don't see it:
- Ensure the script is executable:
chmod +x bin/statusline.js - Check that the command in
settings.jsonis correct:- If installed globally:
"command": "claude-statusbar" - If using local path:
"command": "/full/path/to/bin/statusline.js"
- If installed globally:
- Restart Claude Code after configuration changes
- Check if the command works manually:
echo '{"model":{"display_name":"test"}}' | claude-statusbar - On Windows, test with PowerShell:
echo '{"model":{"display_name":"test"}}' | node bin/statusline.js
- The tool reads the model from Claude Code's context automatically
- If showing "claude-3-opus" as default, Claude Code might not be passing model info
- Try the advanced version which has better fallback handling
- Claude Code supports ANSI color codes
- If colors aren't showing, try
--no-coloroption - On Windows, ensure your terminal supports ANSI codes
βββ app/ # Next.js app directory
β βββ actions/ # Server actions
β βββ components/ # React components
β βββ page.tsx # Main page
βββ bin/ # CLI scripts
β βββ statusline.js # Claude Code status line script
βββ package.json # Dependencies and scripts
βββ README.md # This file
Test the status bar without Claude Code:
# Test basic version
echo '{"model":{"display_name":"claude-3.5-sonnet"}}' | node bin/statusline.js- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Test your changes thoroughly
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Inspired by the Claude Code statusLine documentation
- Based on the ccusage statusline format options
- Built for the Claude Code community
MIT
Made with β€οΈ for better Claude Code usage monitoring
