Rich status line for Claude Code showing context usage, rate limits, and costs at a glance.
- Context Window - Progress bar with percentage and token count (color-coded: green β yellow β red)
- 5h Rate Limit - Usage + pace indicator + smart time display
- 7d Rate Limit - Usage + pace (work-day aware) + time display
- Pace Indicator - Shows if you're on track (
1.0x) or burning fast (2.0x) - Agent Count - Shows number of active Claude processes when running with subagents
- Ollama Savings Tracker - Tracks local model usage and shows estimated Haiku-equivalent cost savings
- Stale Context Detection - Ignores stale API percentages after clear/compact
- Cross-Tab Sync - All sessions share rate limit data (10s refresh)
- API-Key Mode - Session + daily cost tracking with burn rate
Requires: jq (brew install jq / apt install jq)
# Add marketplace & install
claude plugin marketplace add Benniphx/claude-statusline
claude plugin install statusline
# Restart Claude CodeOpus 4.6 (3) β Ctx: ββββββββ 30% (60K/200K) β 5h: ββββββββ 46% 0.5x β47m β π₯ 5.0K t/m β 7d: ββββββββ 27% 0.6x β 12m β +142/-38 β π¦ saved ~$1.71 (387 req Β· 3.3M tok)
| Section | Description |
|---|---|
Opus 4.6 |
Model name, color-coded by context usage (green <50%, yellow 50-80%, red >80%) |
(3) |
Active Claude processes β only shown when >1 (teams/subagents) |
Ctx: ββββββββ 30% (60K/200K) |
Context window: progress bar + percentage + tokens used/total |
5h: ββββββββ 46% 0.5x β47m |
5-hour rate limit: usage, pace (0.5x = half speed), time until reset |
π₯ 5.0K t/m |
Burn rate: tokens per minute (current consumption speed) |
7d: ββββββββ 27% 0.6x |
7-day rate limit: weekly usage + pace |
12m |
Session duration in minutes |
+142/-38 |
Lines added (green) / removed (red) in this session |
π¦ saved ~$1.71 (387 req Β· 3.3M tok) |
Ollama savings: estimated Haiku-equivalent cost saved by running locally |
Pace details:
| Example | Meaning |
|---|---|
5h: ββββββββ 40% 0.8x |
Under budget (sustainable) |
5h: ββββββββ 72% 1.3x |
30% over sustainable pace |
5h: ββββββββ 95% 2.1x |
Will hit limit before reset |
5h: ββββββββ 85% 1.3x β45m |
Reset in 45min (shown when β€1h) |
5h: ββββββββ 90% 1.5x β12m @14:30 |
Reset at 14:30 (shown when β€30m) |
Opus 4.6 β Ctx: ββββββββ 45% (90K/200K) β π° $0.42 β π
$3.85 β π₯ 8.2K t/m $1.20/h β 12m β +142/-38
| Section | Description |
|---|---|
π° $0.42 |
Session cost (green <$0.50, yellow <$2.00, red >$2.00) |
π
$3.85 |
Daily cost across all sessions today (green <$5, yellow <$20, red >$20) |
π₯ 8.2K t/m $1.20/h |
Burn rate: tokens/min + cost per hour (green <$1/h, yellow <$5/h, red >$5/h) |
Ollama/local models display with the llama icon and detected context size:
π¦ Qwen3 β Ctx: ββββββββ 15% (3K/32K) β ...
The pace indicator (1.3x) shows how fast you're consuming your limit compared to a sustainable rate.
| Pace | Color | Meaning |
|---|---|---|
0.5x |
π’ Green | Half the sustainable rate - very conservative |
1.0x |
π’ Green | Exactly sustainable - will use 100% by reset |
1.3x |
π‘ Yellow | 30% faster than sustainable |
2.0x |
π΄ Red | Double speed - will hit limit at 50% time |
5h Pace: Based on usage% / hours_elapsed. Sustainable = 20%/hour.
7d Pace: Based on work days (Mon-Fri by default). If you've used 40% after 2 work days, and have 3 work days left, that's (40%/2) / (100%/5) = 1.0x.
Create ~/.config/claude-statusline/config:
mkdir -p ~/.config/claude-statusline
cat > ~/.config/claude-statusline/config << 'EOF'
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Context Warning Threshold
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Show β οΈ when context usage exceeds this percentage
# Useful to get a heads-up before hitting context limits
# Range: 1-100, Default: disabled
CONTEXT_WARNING_THRESHOLD=75
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Rate Limit Cache TTL
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# How often to refresh rate limit data from API (seconds)
# Lower = faster cross-tab sync, slightly more API calls
# Range: 10-120, Default: 15
RATE_CACHE_TTL=15
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Work Days Per Week
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Used for 7d pace calculation
# 5 = Monday-Friday (excludes weekends)
# 7 = All days (if you work weekends)
# Range: 1-7, Default: 5
WORK_DAYS_PER_WEEK=5
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Background Daemon (opt-in)
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Keeps rate limit cache fresh in the background
# Useful if you have multiple Claude sessions open
# Starts automatically on session start, stops when idle
# Default: false (disabled)
ENABLE_DAEMON=true
EOFThe optional background daemon keeps your rate limit cache fresh across all Claude sessions. Here's exactly what it does:
- Refreshes rate limit data every 15 seconds from the Anthropic API
- Writes to a shared cache file (
/tmp/claude_rate_limit_cache.json) - Calculates global burn rate by tracking 5h% changes over time
- Auto-stops after ~60 seconds of no Claude processes running
- β Does not send any data to external servers (only reads from Anthropic API)
- β Does not track your conversations or prompts
- β Does not run when Claude Code is not running
- β Does not use significant CPU or memory (~0.1% CPU when active)
| Scenario | Without Daemon | With Daemon |
|---|---|---|
| Multiple tabs | Each tab refreshes independently | Shared cache, less API calls |
| Rate limit accuracy | May be stale (up to 15s) | Always fresh |
| Burn rate display | Only shows when actively typing | Shows even during pauses |
Location: /tmp/claude_statusline_daemon.pid
Log file: /tmp/claude_statusline_daemon.log
Cache file: /tmp/claude_rate_limit_cache.json
Refresh: Every 15 seconds
Idle timeout: 60 seconds (4 checks Γ 15s)
The daemon is currently opt-in (ENABLE_DAEMON=false by default). We may change this to opt-out in a future version once it has been thoroughly tested by the community. Any such change will be clearly documented in the changelog.
This statusline supports local models running via Ollama. When you use Ollama models with Claude Code, the statusline will:
- Display the model name with a π¦ icon (e.g.,
π¦ Qwen3,π¦ Llama3) - Auto-detect your ACTUAL context size (not just max capacity):
- If model is running: reads your configured
num_ctxfrom/api/ps - If not running: shows max capacity from
/api/show
- If model is running: reads your configured
- Cache the context size for 30 seconds (short cache since config can change)
- Track savings when routing tasks locally instead of using the Haiku API
- Ollama installed and running
- Model pulled (e.g.,
ollama pull qwen3-coder:30b)
To use local models with Claude Code, you can integrate Ollama via MCP:
- ollama-mcp - Official Ollama MCP server
- Claude Code MCP Docs - How to configure MCP servers
The statusline recognizes and shortens common model names:
| Ollama Model | Displayed As |
|---|---|
qwen3-coder:30b |
π¦ Qwen3 |
llama3:8b |
π¦ Llama3 |
codellama:13b |
π¦ CodeLlama |
mistral:7b |
π¦ Mistral |
deepseek-coder:6.7b |
π¦ DeepSeek |
| Other models | π¦ <ModelName> |
When you run tasks locally via Ollama instead of the Haiku API, the statusline tracks usage and shows estimated savings:
π¦ saved ~$1.71 (387 req Β· 3.3M tok)
How it works:
- Your Ollama agent writes stats to
/tmp/claude_ollama_stats.jsonafter each API call - The statusline reads this file and calculates what those tokens would have cost using Haiku pricing ($0.25/1M input, $1.25/1M output)
- Stats are only shown when the file exists and is fresh (< 5 minutes old)
Stats file format:
{
"requests": 387,
"total_prompt_tokens": 2400000,
"total_completion_tokens": 890000,
"last_updated": 1739367600
}If you prefer not to use the plugin system:
# Download
curl -o ~/.claude/statusline.sh \
https://raw.githubusercontent.com/Benniphx/claude-statusline/main/scripts/statusline.sh
chmod +x ~/.claude/statusline.shAdd to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}Run /statusline:config in Claude Code to check:
- Account type detection (subscription vs API-key)
- Credential access
- Cache file locations
- Current rate limit data
Cache files (in /tmp/ or $CLAUDE_CODE_TMPDIR):
claude_rate_limit_cache.json- API data (shared across tabs)claude_display_cache.json- Display fallbackclaude_daily_cost_YYYY-MM-DD.txt- Daily cost trackingclaude_session_total_*.txt- Per-session tracking
Credentials:
| Platform | Location |
|---|---|
| macOS | Keychain (Claude Code-credentials) |
| Linux | ~/.claude/.credentials.json |
| Override | $CLAUDE_CODE_OAUTH_TOKEN env var |
v4.0.0 is a complete rewrite from Bash to Go with hexagonal architecture:
core/ Domain logic (pure, no I/O)
context/ Context window calculations
ratelimit/ Rate limits, burn rate, pace
cost/ Session cost tracking
agents/ Claude process counting
ollama/ Ollama stats reader + savings calculation
model/ Model detection + Ollama context
update/ Update check
daemon/ Background daemon
adapter/ Implementations
api/ HTTP client for Anthropic + GitHub APIs
cache/ File-based cache with TTL
config/ Config file parsing
platform/ OS-specific (macOS/Linux) process detection
render/ ANSI color output + progress bars
cmd/statusline/ Entry point
- Go rewrite β Full statusline rewritten in Go for speed and maintainability
- Agent count display β Shows active Claude process count when running subagents:
Opus 4.6 (3) - Ollama savings tracker β Tracks local model usage and calculates Haiku-equivalent cost savings:
π¦ saved ~$1.71 (387 req Β· 3.3M tok) - Stale context fix β Detects and ignores stale API percentages after context clear/compact
- Hooks on more events β Now triggers on
startup|resume|clear|compact(was only startup) - All v3.x features preserved: pace indicators, work-day aware 7d, Ollama model display, daemon, cross-tab sync
Feedback: Open an issue.
MIT