A customizable statusline for Claude Code CLI with OAuth usage metrics
npm install @p5hema2/claude-code-cli-statuslineA customizable statusline for Claude Code CLI with OAuth usage metrics.



- π Directory - Fish-shell style shortened path
- πΏ Git Branch - Current branch with status indicators (*+?ββ)
- π€ Model - Current Claude model name
- π Context Usage - Context window utilization bar
- β±οΈ 5-Hour Session - OAuth API usage (rolling session limit)
- π
7-Day Usage - OAuth API usage (weekly all models)
- π― 7-Day Sonnet - OAuth API usage (weekly Sonnet-specific)
- π¨ Output Style - Current output style indicator
- β¨οΈ Vim Mode - Current vim mode with color coding
Unlike other statuslines, this tool integrates with Claude Code's OAuth API to show your real usage limits:
- 5-hour session: Rolling usage within the current session window
- 7-day total: Weekly usage across all models
- 7-day Sonnet: Weekly Sonnet-specific usage
This helps you manage your API usage and avoid hitting rate limits.
``bash`
npx @p5hema2/claude-code-cli-statusline@latest
`bash`
npm install -g @p5hema2/claude-code-cli-statusline
Add to your Claude Code settings (~/.claude/settings.json):
`json`
{
"statusline": {
"command": "npx @p5hema2/claude-code-cli-statusline@latest"
}
}
Open a browser-based WYSIWYG editor to configure your statusline:
`bash`
npx @p5hema2/claude-code-cli-statusline --configure
The GUI allows you to:
- Drag & drop widgets to arrange your layout
- Multi-row support for complex statuslines
- Live preview with different terminal themes
- N/A state toggles to preview various widget states
Create ~/.claude/statusline-settings.json to customize:
`json`
{
"widgets": {
"directory": { "enabled": true },
"gitBranch": { "enabled": true },
"model": { "enabled": true },
"contextUsage": { "enabled": true },
"sessionUsage": { "enabled": true },
"weeklyUsage": { "enabled": true },
"weeklySonnet": { "enabled": false },
"outputStyle": { "enabled": true },
"vimMode": { "enabled": true }
},
"separator": "|",
"cacheTtl": 300000
}
Configure multiple rows using the rows option:
`json`
{
"rows": [
{ "widgets": ["directory", "gitBranch", "model"] },
{ "widgets": ["contextUsage", "sessionUsage", "weeklyUsage", "vimMode"] }
]
}
| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| widgets. | boolean | true | Enable/disable specific widget |separator
| | string | \| | Character between widgets |cacheTtl
| | number | 300000 | Cache TTL in ms (5 min) |rows
| | array | - | Multi-row layout configuration |
| Widget | Description |
|--------|-------------|
| directory | Current working directory (fish-style) |gitBranch
| | Git branch with status indicators |model
| | Claude model name |contextUsage
| | Context window usage bar |sessionUsage
| | 5-hour session usage (OAuth) |weeklyUsage
| | 7-day all models usage (OAuth) |weeklySonnet
| | 7-day Sonnet usage (OAuth) |outputStyle
| | Output style name |vimMode
| | Vim mode indicator |
`bashClone the repository
git clone https://github.com/p5hema2/claude-code-cli-statusline.git
cd claude-code-cli-statusline
1. Claude Code pipes status JSON to stdin
2. The statusline parses and validates the input
3. OAuth usage data is fetched (cached for 5 minutes)
4. Widgets render their respective data
5. Output is printed to stdout
- Node.js >= 18.0.0
- Claude Code CLI (for full functionality)
MIT Β© Martin HeΓ