claude-hud-glm
v0.0.7
Published
Real-time statusline HUD for Claude Code with GLM API support
Downloads
95
Maintainers
Readme
Claude HUD GLM
A Claude Code plugin that shows what's happening — context usage, active tools, running agents, todo progress, and GLM API balance tracking. Always visible below your input.
This is a fork of jarrodwatts/claude-hud with added support for Zhipu AI GLM API usage tracking.
Features
| What You See | Why It Matters | |--------------|----------------| | Project path | Know which project you're in (configurable 1-3 directory levels) | | Context health | Know exactly how full your context window is before it's too late | | Tool activity | Watch Claude read, edit, and search files as it happens | | Agent tracking | See which subagents are running and what they're doing | | Todo progress | Track task completion in real-time | | GLM Balance | 🆕 Track your GLM API token balance and usage percentage |
GLM API Support
This version adds support for tracking usage when using the GLM API (Zhipu AI/BigModel):
- Automatic Detection: Automatically detects when you're using GLM API via
ANTHROPIC_BASE_URLcontainingbigmodel.cn - Balance Tracking: Shows your token balance usage as a percentage
- Expiration Display: Shows when your token balance expires
- Fallback Support: Still works with original Anthropic API if you're not using GLM
Display Example
[glm-4.7 | GLM] █████░░░░ 45% | my-project git:(main) | GLM: 23% (expires 15d) | ⏱️ 5mInstall
Inside a Claude Code instance, run the following commands:
Step 1: Add the marketplace
/plugin marketplace add Siiichenggg/claude-hud-glmStep 2: Install the plugin
On Linux, /tmp is often a separate filesystem (tmpfs), which causes plugin installation to fail with:
EXDEV: cross-device link not permittedFix: Set TMPDIR before installing:
mkdir -p ~/.cache/tmp && TMPDIR=~/.cache/tmp claudeThen run the install command below in that session. This is a Claude Code platform limitation.
/plugin install claude-hud-glmStep 3: Configure the statusline
/claude-hud-glm:setupDone! The HUD appears immediately — no restart needed.
What Each Line Shows
Session Info
[glm-4.7 | GLM] █████░░░░ 45% | my-project git:(main) | 2 CLAUDE.md | GLM: 23% (expires 15d) | ⏱️ 5m- Model — Current model in use (shown first)
- Plan name — GLM when using GLM API, or Pro/Max/Team for Anthropic
- Context bar — Visual meter with color coding (green → yellow → red as it fills)
- Project path — Configurable 1-3 directory levels (default: 1)
- Git branch — Current branch name (configurable on/off)
- Config counts — CLAUDE.md files, rules, MCPs, and hooks loaded
- Usage/Balance — GLM token usage % (or Anthropic 5h/7d for Pro/Max/Team)
- Duration — How long the session has been running
Tool Activity
✓ TaskOutput ×2 | ✓ mcp_context7 ×1 | ✓ Glob ×1 | ✓ Skill ×1- Running tools show a spinner with the target file
- Completed tools aggregate by type with counts
Agent Status
✓ Explore: Explore home directory structure (5s)
✓ open-source-librarian: Research React hooks patterns (2s)- Agent type and what it's working on
- Elapsed time for each agent
Todo Progress
✓ All todos complete (5/5)- Current task or completion status
- Progress counter (completed/total)
Configuration
Customize your HUD anytime:
/claude-hud-glm:configureThe guided flow walks you through customization — no manual editing needed.
Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| lineLayout | string | expanded | Layout style: compact or expanded |
| pathLevels | 1-3 | 1 | Directory levels to show in project path |
| gitStatus.enabled | boolean | true | Show git branch in HUD |
| gitStatus.showDirty | boolean | true | Show * for uncommitted changes |
| gitStatus.showAheadBehind | boolean | false | Show ↑N ↓N for ahead/behind remote |
| gitStatus.showFileStats | boolean | false | Show file change counts !M +A ✘D ?U |
| display.showModel | boolean | true | Show model name [glm-4.7] |
| display.showContextBar | boolean | true | Show visual context bar ████░░░░░░ |
| display.showConfigCounts | boolean | true | Show CLAUDE.md, rules, MCPs, hooks counts |
| display.showDuration | boolean | true | Show session duration ⏱️ 5m |
| display.showUsage | boolean | true | Show GLM balance or Anthropic usage limits |
| display.usageThreshold | number | 0 | Only show usage when above this % |
| display.showTokenBreakdown | boolean | true | Show token details at high context (85%+) |
| display.showTools | boolean | true | Show tools activity line |
| display.showAgents | boolean | true | Show agents activity line |
| display.showTodos | boolean | true | Show todos progress line |
Example Configuration
{
"lineLayout": "expanded",
"pathLevels": 2,
"gitStatus": {
"enabled": true,
"showDirty": true,
"showAheadBehind": true,
"showFileStats": true
},
"display": {
"showModel": true,
"showContextBar": true,
"showConfigCounts": true,
"showDuration": true,
"showUsage": true,
"usageThreshold": 10,
"showTokenBreakdown": true,
"showTools": true,
"showAgents": true,
"showTodos": true
}
}How GLM Usage Tracking Works
- Reads Configuration: Automatically reads your
~/.claude/settings.jsonto detect GLM API configuration - Queries Balance: Calls GLM's balance query API (
GET /api/biz/tokenAccounts/list/my) - Aggregates Bundles: Sums up all token bundles (通用, GLM-4.6, GLM-4.5, etc.)
- Calculates Percentage: Shows used balance as a percentage of total balance (if
totalAmountis available) - Tracks Expiry: Finds the earliest expiration date across all bundles
- Caches Results: Caches for 60 seconds to avoid excessive API calls
- Falls Back: Automatically falls back to Anthropic API if GLM is not detected
GLM API Response Format
The plugin calls GLM's balance API and expects:
{
"total": 6,
"rows": [
{
"id": 19350025,
"tokenNo": "bundle_689",
"tokenBalance": 20,
"totalAmount": 100,
"expirationTime": "2026-03-23T12:04:57Z",
"resourcePackageName": "【新用户专享】20次图片/视频生成资源包"
}
]
}Local Installation (for development)
If you want to install from a local copy:
Step 1: Clone and build
git clone https://github.com/your-username/claude-hud-glm
cd claude-hud-glm
npm ci && npm run buildStep 2: Install in Claude Code
/plugin install /path/to/claude-hud-glmStep 3: Configure
/claude-hud-glm:setupRequirements
- Claude Code v1.0.80+
- Node.js 18+ or Bun
- For GLM usage tracking: Valid GLM API credentials in your Claude settings
Development
git clone https://github.com/your-username/claude-hud-glm
cd claude-hud-glm
npm ci && npm run build
npm testSee CONTRIBUTING.md for guidelines.
License
MIT License — see LICENSE
This is a fork of jarrodwatts/claude-hud, which is also licensed under the MIT License.
Acknowledgments
- Original project: jarrodwatts/claude-hud
- Original author: Jarrod Watts
- GLM API integration added for Chinese users and Zhipu AI customers
