复古血条追踪五大AI平台余额
简介
复古游戏风格可视化追踪5大AI服务商API余额,支持手动同步与自动API拉取,适合多平台开发者实时掌控成本消耗。
原始描述
Display API credit balances for 5 core providers (Anthropic, OpenAI, OpenRouter, Mistral, Groq) with video game style health bars. API auto-checks and manual...
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
API Credits Lite 是一款面向AI开发者与多平台用户的轻量级API余额管理工具,采用复古电子游戏的血条(health bar)视觉风格,直观展示Anthropic、OpenAI、OpenRouter、Mistral、Groq五大核心服务商的实时余额状态。
主要功能模块
1. 可视化余额展示
运行 show_credits.py 即可生成彩色血条:🟩 充足(>75%) · 🟨 中等(50-75%) · 🟧 紧张(25-50%) · 🟥 告急(<25%)。一眼识别哪些服务需要充值。
2. 手动余额同步
针对无公开API的服务商(Anthropic、Mistral、Groq)或偏好手动管理的用户,通过 sync_provider.py 直接设定当前余额与上限,支持精确到分($XX.XX)的数值输入。
3. 自动API拉取 对支持余额查询的服务商,配置对应API密钥后即可自动获取:
- OpenAI →
check_openai.py(需OPENAI_API_KEY) - OpenRouter →
check_openrouter.py(需OPENROUTER_API_KEY) - Vercel AI Gateway →
check_vercel.py(需VERCEL_AI_GATEWAY_KEY)
4. 充值记录追踪
topup.py 模块记录充值历史,便于回溯消费模式与预算规划。
显著优点
- 零学习成本:游戏化UI降低认知负荷,非技术用户也能秒懂
- 多源聚合:单窗口统览五大主流平台,告别逐个登录控制台
- 灵活双模式:API自动同步+手动录入双轨并行,适应不同服务商开放程度
- 轻量无依赖:纯Python脚本,无需复杂数据库或云服务
局限性与风险
- 服务商覆盖有限:仅5家核心平台,AWS Bedrock、Azure OpenAI、Google Vertex等需升级Pro版
- 无自动预警:缺乏余额耗尽前的主动通知机制(邮件/Slack/短信)
- 手动维护成本:无公开API的服务商需定期人工更新,易遗忘
- 数据本地存储:配置与历史记录存于本地config.json,多设备同步需自行解决
适合人群
- 同时使用2-5个AI平台的独立开发者/小团队
- 偏好可视化仪表盘、排斥复杂BI工具的用户
- 需要快速估算月度API支出的预算敏感型项目
常规风险提示
- API密钥需配置为环境变量,避免硬编码泄露
- 自动拉取功能依赖第三方API稳定性,偶有延迟或限流
- 本地config.json建议定期备份,误删将导致历史记录丢失
技能正文
name: api-credits-lite description: Display API credit balances for 5 core providers (Anthropic, OpenAI, OpenRouter, Mistral, Groq) with video game style health bars. API auto-checks and manual sync. optionalEnv:
- OPENAI_API_KEY
- OPENROUTER_API_KEY
- VERCEL_AI_GATEWAY_KEY permissions:
- network: Contact OpenAI, OpenRouter, and Vercel APIs to check balances (optional)
- filesystem: Read/write config.json and health bar display
API Credits Lite
Use this skill when the user asks about API credits, balances, spending, or wants to update their credit info for Anthropic, OpenAI, OpenRouter, Mistral, or Groq.
When to Use
✅ USE this skill when the user asks:
- "How much credit do I have left?" / "What's my balance?"
- "Show my API credits" / "Check my credits"
- "Update my [provider] balance to $X"
- "I topped up [provider] by $X"
- "Am I running low on [provider]?"
❌ DON'T use when:
- The user needs 16+ providers, JSONL auto-tracking, cloud SDKs, or heartbeat integration → use api-credits-pro
How to Use
You run the scripts internally — the user never types python3. Respond naturally and present health bar output conversationally.
The skill root is at: ~/.openclaw/workspace/skills/api-credits-lite/
Run scripts with: python3 <skill-root>/scripts/<script>.py <args>
Show Credit Balances
Triggers: "show my credits", "how much do I have left", "check my API balance"
python3 scripts/show_credits.py
Displays retro health bars for all configured providers. Colors: 🟩 >75% · 🟨 50–75% · 🟧 25–50% · 🟥 <25%
Manual Balance Sync
Triggers: "set my Anthropic balance to $X", "update my OpenAI credits to $X", "I have $X left on [provider]"
python3 scripts/sync_provider.py <provider> <balance>
# With max: python3 scripts/sync_provider.py <provider> <balance> <max_credits>
# Examples:
python3 scripts/sync_provider.py anthropic 22.97
python3 scripts/sync_provider.py openai 95.00 100.00
Supported providers: anthropic, openai, openrouter, mistral, groq
Where to find balances:
- Anthropic → console.anthropic.com
- OpenAI → platform.openai.com/usage
- OpenRouter → openrouter.ai/activity
- Mistral → console.mistral.ai/billing
- Groq → console.groq.com/settings/billing
Auto-Check Balance via API
Triggers: "check my OpenAI balance automatically", "pull my OpenRouter credits"
For providers that expose a balance API (requires the relevant API key set as an env var):
python3 scripts/check_openai.py # uses OPENAI_API_KEY
python3 scripts/check_openrouter.py # uses OPENROUTER_API_KEY
python3 scripts/check_vercel.py # uses VERCEL_AI_GATEWAY_KEY
Anthropic, Mistral, and Groq don't have public balance APIs — use manual sync for those.
Record a Top-Up
Triggers: "I added $X to my [provider] account", "I topped up $50 on OpenRouter"
python3 scripts/topup.py <provider> <amount>
# Example: python3 scripts/topup.py openrouter 20.00
Troubleshooting
If the display shows no providers, the config may be empty. Tell the user to run the first manual sync for each provider they use, or copy the example config:
cp config.example.json config.json
Upgrading
Need 16+ providers, auto-tracking from session logs, cloud SDKs (AWS/Azure/GCP), or heartbeat integration? Suggest api-credits-pro.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。