Install
openclaw skills install token-monitorMonitors all configured model quotas and sends alerts when usage drops below or recovers above a configurable threshold, avoiding duplicate notifications.
openclaw skills install token-monitorMonitors OpenClaw token/quota usage and outputs alerts when any quota drops below a configurable threshold (default 20%).
Install:
clawhub install token-monitor
Update:
clawhub update token-monitor
(You can also run clawhub update --all.)
Remove the Token Monitor section from HEARTBEAT.md (or comment it out). No further uninstall needed.
Disable/remove the cron job:
openclaw cron list
openclaw cron remove <jobId>
rm -f ~/.openclaw/workspace/skills/token-monitor/.token-state.json
Run the monitoring script directly:
skills/token-monitor/scripts/check-quota.sh
If installed into ~/.openclaw/skills, run:
~/.openclaw/skills/token-monitor/scripts/check-quota.sh
With custom threshold (default 20%):
skills/token-monitor/scripts/check-quota.sh --threshold 10
Add to HEARTBEAT.md for periodic checks:
## Token Monitor (every ~60min, rotate)
Check model quotas and alert if below threshold.
**Instructions:**
1. Run `output=$(skills/token-monitor/scripts/check-quota.sh 2>&1)`
2. If output non-empty → send wake event with output text
3. If empty → all quotas OK, continue silently
**Rotate check:** Only run every ~4th heartbeat (once/hour if heartbeat is 15min)
**Example integration:**
```bash
output=$(skills/token-monitor/scripts/check-quota.sh 2>&1)
if [[ -n "$output" ]]; then
openclaw cron wake --text "$output" --mode now
fi
### Automated Monitoring (Cron Job)
Create a dedicated cron job for precise scheduling:
```bash
openclaw cron add --schedule "*/30 * * * *" \
--payload '{"kind":"systemEvent","text":"Run quota monitor: skills/token-monitor/scripts/check-quota.sh"}' \
--name "Token Monitor (30min)"
⚠️ Model Quota Alert (<20%):
• openai-codex Day: 0% left
• github-copilot Premium: 5% left
✅ Quota Recovered (>=20%):
• openai-codex 5h: 100% left
The script maintains state in:
~/.openclaw/workspace/skills/token-monitor/.token-state.json
Example state:
{
"warned": [
"openai-codex Day: 0% left",
"github-copilot Premium: 5% left"
],
"current": [
"openai-codex:5h=100",
"openai-codex:Day=0",
"github-copilot:Premium=5",
"github-copilot:Chat=100"
],
"lastCheck": "2026-02-15T09:30:00Z",
"threshold": 20
}
QUOTA_THRESHOLD: Alert threshold percentage (default: 20)QUOTA_STATE_FILE: Path to state file (default: ~/.openclaw/workspace/skills/token-monitor/.token-state.json)--threshold <pct>: Set alert threshold (overrides QUOTA_THRESHOLD)--state-file <path>: Set state file location (overrides QUOTA_STATE_FILE)openclaw models status and extracts all "X% left" valuesopenclaw cron wake to deliver notificationsopenclaw CLI (models status, cron wake)jq (JSON parsing)bash 4.0+No alerts sent:
openclaw models statuscat ~/.openclaw/workspace/skills/token-monitor/.token-state.jsonskills/token-monitor/scripts/check-quota.shDuplicate alerts:
warned array: jq .warned ~/.openclaw/workspace/skills/token-monitor/.token-state.jsonScript fails:
jq is installed: jq --versionls -l skills/token-monitor/scripts/check-quota.shbash -x skills/token-monitor/scripts/check-quota.sh