skills/api-provider-status/SKILL.md
查询 API 供应商的余额、用量与可用状态,支持多供应商监控与定时汇报。
npx skillsauth add aaaaqwq/agi-super-skills api-provider-statusInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
API 供应商状态查询与余额监控。
| 供应商 | 查询方式 | 登录状态存储 | 状态 |
|--------|----------|--------------|------|
| ~~Anapi (Claude)~~ | ~~API 直接查询~~ | - | ❌ 已废弃 |
| Provider-B | Playwright / Browser Tool | ~/.playwright-data/provider-b | ✅ 可用 |
| GitHub Copilot | Playwright 抓取 | ~/.playwright-data/github | ✅ 可用 |
| Provider-A (your-provider) | Playwright 抓取 | ~/.playwright-data/your-provider | ✅ 可用 |
| OpenRouter VIP | API 暂不支持 | - | ⏳ |
| ZAI (智谱) | 无公开 API,不查询 | - | ⏭️ 跳过 |
方式: Browser Tool 或 Playwright 抓取
查询页面: https://ai.9w7.cn/console
登录状态: ~/.playwright-data/<provider>/model
抓取数据:
使用 Browser Tool 查询:
https://ai.9w7.cn/console(openclaw browser 已保存登录状态)方式: Playwright 抓取(需要先登录)
查询页面: https://github.com/settings/copilot
登录流程:
from playwright.sync_api import sync_playwright
import os
user_data_dir = os.path.expanduser('~/.playwright-data/github')
os.makedirs(user_data_dir, exist_ok=True)
with sync_playwright() as p:
context = p.chromium.launch_persistent_context(
user_data_dir,
headless=False, # 显示浏览器让用户登录
)
page = context.pages[0] if context.pages else context.new_page()
page.goto('https://github.com/settings/copilot')
# 用户手动登录后,登录状态会保存到 user_data_dir
抓取数据:
正则匹配:
import re
usage_match = re.search(r'Premium requests\s*([\d.]+)%', text)
is_active = 'Copilot Pro is active' in text
方式: Playwright 抓取(需要先登录)
查询页面: https://your-provider.example.com/console
登录流程:
user_data_dir = os.path.expanduser('~/.playwright-data/your-provider')
# 同上,使用 launch_persistent_context
抓取数据:
正则匹配:
balance_match = re.search(r'当前余额💰([\d.]+)', text)
consumed_match = re.search(r'历史消耗💰([\d.]+)', text)
requests_match = re.search(r'请求次数(\d+)', text)
tokens_match = re.search(r'总Tokens(\d+)', text)
# 生成完整报告
python3 ~/clawd/skills/api-provider-status/balance_checker.py report
# 查询指定供应商
python3 ~/clawd/skills/api-provider-status/balance_checker.py query anapi
python3 ~/clawd/skills/api-provider-status/balance_checker.py query github-copilot
python3 ~/clawd/skills/api-provider-status/balance_checker.py query your-provider
# JSON 格式查询所有
python3 ~/clawd/skills/api-provider-status/balance_checker.py all
# 最近 12 小时用量
python3 ~/clawd/skills/api-provider-status/usage_tracker.py report 12
# 最近 24 小时用量
python3 ~/clawd/skills/api-provider-status/usage_tracker.py report 24
# JSON 格式
python3 ~/clawd/skills/api-provider-status/usage_tracker.py stats 12
如果 Playwright 登录状态过期,需要重新登录:
# GitHub 登录
cd ~/clawd/skills/playwright-automation
python3 << 'EOF'
from playwright.sync_api import sync_playwright
import os
user_data_dir = os.path.expanduser('~/.playwright-data/github')
os.makedirs(user_data_dir, exist_ok=True)
with sync_playwright() as p:
context = p.chromium.launch_persistent_context(
user_data_dir, headless=False
)
page = context.pages[0] if context.pages else context.new_page()
page.goto('https://github.com/login')
input('登录完成后按 Enter...')
context.close()
EOF
# Provider-A登录
python3 << 'EOF'
from playwright.sync_api import sync_playwright
import os
user_data_dir = os.path.expanduser('~/.playwright-data/your-provider')
os.makedirs(user_data_dir, exist_ok=True)
with sync_playwright() as p:
context = p.chromium.launch_persistent_context(
user_data_dir, headless=False
)
page = context.pages[0] if context.pages else context.new_page()
page.goto('https://your-provider.example.com/')
input('登录完成后按 Enter...')
context.close()
EOF
任务名: OpenClaw 健康监控 模型: <provider>/glm-4.7 频率: 每天 2:00, 8:00, 14:00, 20:00 (每6小时) 功能:
skills/api-provider-status/
├── SKILL.md # 本文档
├── balance_checker.py # 余额查询脚本
└── usage_tracker.py # 用量统计脚本(从 OpenClaw 日志读取)
~/.playwright-data/
├── <provider>/model # Provider-B 登录状态
├── github/ # GitHub 登录状态
└── your-provider/ # Provider-A登录状态
系统状态: ✅ Gateway 运行中 | 11 Agents | 7 活跃会话
通道: Telegram ✅ | WhatsApp ✅
API 供应商: | 供应商 | 余额 | 状态 | |--------|------|------| | Provider-B | ¥321.83 | ✅ 正常 | | your-provider | ¥41.79 | ⚠️ 偏低 | | GitHub Copilot | 免费额度 | ✅ 可用 | | ZAI (智谱) | - | ✅ 可用 | | OpenRouter VIP | - | ✅ 可用 |
testing
AI驱动的智能浏览器自动化工具。使用LLM理解页面并自动执行任务,比传统Playwright更智能、更省token。适用于复杂交互、动态页面、需要智能决策的浏览器操作。Chrome浏览器优先。
tools
网页登录态管理。使用 fast-browser-use (fbu) 管理各平台登录状态,定期检查可用性,新平台授权时自动保存 profile。
development
Monitor and report on API provider quotas, balances, and usage. Query official providers (Moonshot, DeepSeek, xAI, Google AI Studio) and relay/proxy providers (Xingjiabiapi, Aixn, WoW) via their billing APIs. Also checks subscription services (Brave Search, OpenRouter). Generates quota reports. Triggers on "查额度", "API余额", "quota check", "billing report", "api balance", "供应商额度", "中转站余额", "费用报告", "check balance", "how much credit".
development
# A股基金监控 Skill A股基金净值监控,支持实时估值和盘后净值,自动判断交易日/节假日。 ## 用法 ### 快速监控(命令行) ```bash # 默认配置,输出到控制台 bash ~/clawd/skills/a-fund-monitor/scripts/monitor.sh # 推送到群(使用--push参数) bash ~/clawd/skills/a-fund-monitor/scripts/monitor.sh --push # 监控指定基金 bash ~/clawd/skills/a-fund-monitor/scripts/monitor.sh --codes "000979 002943" ``` ### Agent调用 ``` 执行A股基金监控任务。 1. 读取配置文件: ~/clawd/skills/a-fund-monitor/config.json 2. 获取实时净值数据 3. 非交易日自动切换为简短报告 配置文件格式: { "funds": [ {"code": "000979", "name": "景顺长城沪港深精选股票