A KDE Plasma 6 widget for monitoring GLM Coding Plan usage via Z.ai API.
- Token Usage Monitoring - Tracks token usage in 5-hour windows
- MCP Usage Monitoring - Tracks MCP usage monthly limits
- Real-time Updates - Automatic polling with configurable intervals
- Compact Display - Shows usage in panel as bars or gauge
- Detailed View - Full popup with usage breakdown
- Configurable Thresholds - Set warning and critical percentages
- Platform Detection - Automatically detects Z.ai or ZHIPU platform
- Token Details - Shows input/output tokens and request counts
- Local Cache - Caches responses to avoid rate limiting
- KDE Plasma 6
- Python 3
- curl
- jq (optional, for JSON handling)
- GLM Coding Plan credentials in
~/.local/share/opencode/auth.json
- Copy widget directory to plasma plasmoids folder:
cp -r plasma-applet-zaimeter ~/.local/share/plasma/plasmoids/com.github.focky.glmmeter- Reload Plasma shell:
plasmashell --replace- Add widget to your panel:
- Right-click on panel → Add Widgets…
- Search for "GLM Meter"
- Add to panel
cd plasma-applet-zaimeter
./install.shThe widget reads your GLM API credentials from:
~/.local/share/opencode/auth.json
The file should contain your API key in zai-coding-plan section:
{
"zai-coding-plan": {
"type": "api",
"key": "your-api-key-here"
}
}Right-click on widget → Configure GLM Meter:
- Poll interval: How often to refresh data (60-3600 seconds)
- Warning threshold: Percentage for warning color (default: 80%)
- Critical threshold: Percentage for critical color (default: 95%)
- Style: Display as bars or gauge
- Compact metric: Which metric to show in gauge mode (token_quota or time_quota)
- Gauge label: What to show inside gauge (percent or label)
- Normal usage: Blue (#2196F3) - Below warning threshold
- Warning usage: Yellow (#E5C07B) - Above warning threshold
- Critical usage: Red (system theme) - Above critical threshold
The widget uses these Z.ai API endpoints:
/api/monitor/usage/model-usage- Model token usage/api/monitor/usage/tool-usage- Tool usage/api/monitor/usage/quota/limit- Quota limits
Based on ClaudeMeter by p3kj.
plasma-applet-zaimeter/
├── metadata.json # Plasma widget metadata
├── README.md # This file
├── LICENSE # MIT License
├── install.sh # Installation script
├── uninstall.sh # Uninstallation script
├── reset.sh # Hard reset script
├── update.sh # Update script
└── contents/
├── config/ # Configuration
│ ├── config.qml
│ ├── ConfigGeneral.qml
│ └── main.xml
├── scripts/ # Backend scripts
│ └── fetch_usage.sh # API fetch script
└── ui/ # QML UI
├── main.qml
├── CompactRepresentation.qml
├── FullRepresentation.qml
├── GaugeRepresentation.qml
├── BarsRepresentation.qml
└── UsageBar.qml
- Check that your credentials file exists and is valid:
cat ~/.local/share/opencode/auth.json- Test the fetch script manually:
bash ~/.local/share/plasma/plasmoids/com.github.focky.glmmeter/contents/scripts/fetch_usage.sh- Check Plasma logs:
journalctl --user -u plasmashell -fThe widget implements exponential backoff. If you see rate limit errors, the widget will use cached data if available and increase the backoff multiplier.
The widget automatically detects Z.ai vs ZHIPU based on your base URL. If you need to force a specific platform, set the GLM_BASE_URL environment variable:
export GLM_BASE_URL="https://api.z.ai"MIT
- Original ClaudeMeter by p3kj
- GLM Coding Plan API documentation