/install xai-prepaid-monitor
Use this skill to add a reusable xAI prepaid balance check to an OpenClaw setup.
What this skill provides
scripts/check_xai_balance.py, a small script that queries the xAI Management API and returns normalized JSON- a reference file with cron prompt patterns for:
- alert-only monitoring
- alert + follow-up task creation
Environment required
Set these env vars in OpenClaw config or the runtime environment before using the script:
XAI_TEAM_IDXAI_MANAGEMENT_KEY
Optional thresholds:
XAI_BALANCE_WARN_BELOW_CENTS(default300)XAI_BALANCE_CRITICAL_BELOW_CENTS(default200)
Run the script
Use:
/usr/bin/python3 /path/to/skills/xai-prepaid-monitor/scripts/check_xai_balance.py
The script prints JSON like:
{
"ok": true,
"status": "warn",
"total_cents": 700,
"used_cents": 450,
"remaining_cents": 250,
"total": "$7.00",
"used": "$4.50",
"remaining": "$2.50",
"warn_below": "$3.00",
"critical_below": "$2.00",
"billing_cycle": "..."
}
Output contract
Interpret the result this way:
ok=false: the check failed, surface the error brieflystatus=ok: no action neededstatus=warn: remaining balance is below warning thresholdstatus=critical: remaining balance is below critical threshold
Recommended workflow
- Run the script with
exec - Parse the JSON output
- If
ok=false, send a short failure alert - If
status=ok, stay quiet or log success - If
status=warnorcritical, send a concise alert - Optionally create a follow-up task in the user’s task system
Cron setup
For prompt patterns, read:
references/cron-examples.md
Guardrails
- Keep delivery logic separate from the script. The script should only fetch and normalize balance data.
- Do not hard-code Discord channel IDs, Todoist paths, or user-specific routing into the script.
- Prefer environment variables for thresholds so the same script works across setups.
- If the xAI API contract changes, update the script and the examples together.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install xai-prepaid-monitor - 安装完成后,直接呼叫该 Skill 的名称或使用
/xai-prepaid-monitor触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
xAI Prepaid Monitor 是什么?
Monitor xAI prepaid credit balance with a reusable Python script and alert workflow. Use when setting up or troubleshooting low-credit checks for xAI/Grok us... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 59 次。
如何安装 xAI Prepaid Monitor?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install xai-prepaid-monitor」即可一键安装,无需额外配置。
xAI Prepaid Monitor 是免费的吗?
是的,xAI Prepaid Monitor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
xAI Prepaid Monitor 支持哪些平台?
xAI Prepaid Monitor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 xAI Prepaid Monitor?
由 Barry(@therealmrb123)开发并维护,当前版本 v1.0.0。