{"slug":"api-provider-status","title":"api-provider-status","summary":"查询 API 供应商的余额、用量与可用状态，支持多供应商监控与定时汇报。","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-18T13:23:56.067918Z","repo":{"url":"https://github.com/aAAaqwq/AGI-Super-Team","stars":100,"forks":23,"license":"MIT","updatedAt":"2026-09-27T10:44:59Z"},"bodyHtml":"<hr>\n<h2>name: api-provider-status\ndescription: 查询 API 供应商的余额、用量与可用状态，支持多供应商监控与定时汇报。</h2>\n<h1>API Provider Status Skill</h1>\n<p>API 供应商状态查询与余额监控。</p>\n<h2>功能</h2>\n<ul>\n<li>查询各 API 供应商的余额/用量</li>\n<li>生成统计报告</li>\n<li>支持定时自动查询</li>\n</ul>\n<h2>支持的供应商</h2>\n<table>\n<thead>\n<tr>\n<th>供应商</th>\n<th>查询方式</th>\n<th>登录状态存储</th>\n<th>状态</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><del>Anapi (Claude)</del></td>\n<td><del>API 直接查询</del></td>\n<td>-</td>\n<td>❌ 已废弃</td>\n</tr>\n<tr>\n<td>Provider-B</td>\n<td>Playwright / Browser Tool</td>\n<td><code>~/.playwright-data/provider-b</code></td>\n<td>✅ 可用</td>\n</tr>\n<tr>\n<td>GitHub Copilot</td>\n<td>Playwright 抓取</td>\n<td><code>~/.playwright-data/github</code></td>\n<td>✅ 可用</td>\n</tr>\n<tr>\n<td>Provider-A (your-provider)</td>\n<td>Playwright 抓取</td>\n<td><code>~/.playwright-data/your-provider</code></td>\n<td>✅ 可用</td>\n</tr>\n<tr>\n<td>OpenRouter VIP</td>\n<td>API 暂不支持</td>\n<td>-</td>\n<td>⏳</td>\n</tr>\n<tr>\n<td>ZAI (智谱)</td>\n<td>无公开 API，不查询</td>\n<td>-</td>\n<td>⏭️ 跳过</td>\n</tr>\n</tbody>\n</table>\n<h2>查询方法详解</h2>\n<h3>1. Provider-B</h3>\n<p><strong>方式</strong>: Browser Tool 或 Playwright 抓取</p>\n<p><strong>查询页面</strong>: <code>https://ai.9w7.cn/console</code></p>\n<p><strong>登录状态</strong>: <code>~/.playwright-data/&lt;provider&gt;/model</code></p>\n<p><strong>抓取数据</strong>:</p>\n<ul>\n<li>当前余额 (¥)</li>\n<li>历史消耗 (¥)</li>\n<li>请求次数</li>\n<li>统计 Tokens</li>\n<li>统计额度 (¥)</li>\n<li>平均 RPM / TPM</li>\n</ul>\n<p><strong>使用 Browser Tool 查询</strong>:</p>\n<ol>\n<li>打开 <code>https://ai.9w7.cn/console</code>（openclaw browser 已保存登录状态）</li>\n<li>从页面 snapshot 中提取数据看板信息</li>\n</ol>\n<h3>2. GitHub Copilot Pro</h3>\n<p><strong>方式</strong>: Playwright 抓取（需要先登录）</p>\n<p><strong>查询页面</strong>: <code>https://github.com/settings/copilot</code></p>\n<p><strong>登录流程</strong>:</p>\n<pre><code>from playwright.sync_api import sync_playwright\nimport os\n\nuser_data_dir = os.path.expanduser('~/.playwright-data/github')\nos.makedirs(user_data_dir, exist_ok=True)\n\nwith sync_playwright() as p:\n    context = p.chromium.launch_persistent_context(\n        user_data_dir,\n        headless=False,  # 显示浏览器让用户登录\n    )\n    page = context.pages[0] if context.pages else context.new_page()\n    page.goto('https://github.com/settings/copilot')\n    # 用户手动登录后，登录状态会保存到 user_data_dir\n</code></pre>\n<p><strong>抓取数据</strong>:</p>\n<ul>\n<li>Premium requests 用量百分比</li>\n<li>订阅状态 (Active/Inactive)</li>\n</ul>\n<p><strong>正则匹配</strong>:</p>\n<pre><code>import re\nusage_match = re.search(r'Premium requests\\s*([\\d.]+)%', text)\nis_active = 'Copilot Pro is active' in text\n</code></pre>\n<h3>3. Provider-A (your-provider)</h3>\n<p><strong>方式</strong>: Playwright 抓取（需要先登录）</p>\n<p><strong>查询页面</strong>: <code>https://your-provider.example.com/console</code></p>\n<p><strong>登录流程</strong>:</p>\n<pre><code>user_data_dir = os.path.expanduser('~/.playwright-data/your-provider')\n# 同上，使用 launch_persistent_context\n</code></pre>\n<p><strong>抓取数据</strong>:</p>\n<ul>\n<li>当前余额</li>\n<li>历史消耗</li>\n<li>请求次数</li>\n<li>总 Tokens</li>\n</ul>\n<p><strong>正则匹配</strong>:</p>\n<pre><code>balance_match = re.search(r'当前余额\uD83D\uDCB0([\\d.]+)', text)\nconsumed_match = re.search(r'历史消耗\uD83D\uDCB0([\\d.]+)', text)\nrequests_match = re.search(r'请求次数(\\d+)', text)\ntokens_match = re.search(r'总Tokens(\\d+)', text)\n</code></pre>\n<h2>使用方法</h2>\n<h3>命令行</h3>\n<pre><code># 生成完整报告\npython3 ~/clawd/skills/api-provider-status/balance_checker.py report\n\n# 查询指定供应商\npython3 ~/clawd/skills/api-provider-status/balance_checker.py query anapi\npython3 ~/clawd/skills/api-provider-status/balance_checker.py query github-copilot\npython3 ~/clawd/skills/api-provider-status/balance_checker.py query your-provider\n\n# JSON 格式查询所有\npython3 ~/clawd/skills/api-provider-status/balance_checker.py all\n</code></pre>\n<h3>用量统计</h3>\n<pre><code># 最近 12 小时用量\npython3 ~/clawd/skills/api-provider-status/usage_tracker.py report 12\n\n# 最近 24 小时用量\npython3 ~/clawd/skills/api-provider-status/usage_tracker.py report 24\n\n# JSON 格式\npython3 ~/clawd/skills/api-provider-status/usage_tracker.py stats 12\n</code></pre>\n<h2>首次登录设置</h2>\n<p>如果 Playwright 登录状态过期，需要重新登录：</p>\n<pre><code># GitHub 登录\ncd ~/clawd/skills/playwright-automation\npython3 &lt;&lt; 'EOF'\nfrom playwright.sync_api import sync_playwright\nimport os\n\nuser_data_dir = os.path.expanduser('~/.playwright-data/github')\nos.makedirs(user_data_dir, exist_ok=True)\n\nwith sync_playwright() as p:\n    context = p.chromium.launch_persistent_context(\n        user_data_dir, headless=False\n    )\n    page = context.pages[0] if context.pages else context.new_page()\n    page.goto('https://github.com/login')\n    input('登录完成后按 Enter...')\n    context.close()\nEOF\n\n# Provider-A登录\npython3 &lt;&lt; 'EOF'\nfrom playwright.sync_api import sync_playwright\nimport os\n\nuser_data_dir = os.path.expanduser('~/.playwright-data/your-provider')\nos.makedirs(user_data_dir, exist_ok=True)\n\nwith sync_playwright() as p:\n    context = p.chromium.launch_persistent_context(\n        user_data_dir, headless=False\n    )\n    page = context.pages[0] if context.pages else context.new_page()\n    page.goto('https://your-provider.example.com/')\n    input('登录完成后按 Enter...')\n    context.close()\nEOF\n</code></pre>\n<h2>定时任务</h2>\n<h3>OpenClaw 健康监控</h3>\n<p><strong>任务名</strong>: OpenClaw 健康监控\n<strong>模型</strong>: </p>\n<ul>\n<li>检查 OpenClaw 系统状态</li>\n<li>查询 Provider-B 和 your-provider 余额</li>\n<li>生成健康报告推送到 Telegram</li>\n<li>异常时发送 ⚠️ 告警</li>\n</ul>\n<h2>文件结构</h2>\n<pre><code>skills/api-provider-status/\n├── SKILL.md              # 本文档\n├── balance_checker.py    # 余额查询脚本\n└── usage_tracker.py      # 用量统计脚本（从 OpenClaw 日志读取）\n</code></pre>\n<h2>登录状态存储</h2>\n<pre><code>~/.playwright-data/\n├── &lt;provider&gt;/model                 # Provider-B 登录状态\n├── github/               # GitHub 登录状态\n└── your-provider/         # Provider-A登录状态\n</code></pre>\n<h2>OpenClaw 系统数据 (2026-02-07)</h2>\n<p><strong>系统状态</strong>: ✅ Gateway 运行中 | 11 Agents | 7 活跃会话</p>\n<p><strong>通道</strong>: Telegram ✅ | WhatsApp ✅</p>\n<p><strong>API 供应商</strong>:</p>\n<table>\n<thead>\n<tr>\n<th>供应商</th>\n<th>余额</th>\n<th>状态</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Provider-B</td>\n<td>¥321.83</td>\n<td>✅ 正常</td>\n</tr>\n<tr>\n<td>your-provider</td>\n<td>¥41.79</td>\n<td>⚠️ 偏低</td>\n</tr>\n<tr>\n<td>GitHub Copilot</td>\n<td>免费额度</td>\n<td>✅ 可用</td>\n</tr>\n<tr>\n<td>ZAI (智谱)</td>\n<td>-</td>\n<td>✅ 可用</td>\n</tr>\n<tr>\n<td>OpenRouter VIP</td>\n<td>-</td>\n<td>✅ 可用</td>\n</tr>\n</tbody>\n</table>\n","files":[{"path":"balance_checker.py","sizeBytes":13454,"isText":true},{"path":"references/credentials.md","sizeBytes":660,"isText":true},{"path":"scripts/query_balance.py","sizeBytes":2790,"isText":true},{"path":"SKILL.md","sizeBytes":6139,"isText":true},{"path":"usage_tracker.py","sizeBytes":9297,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"notes-only","suspicious":0,"notes":1,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-18T13:25:03.673095Z","sha256":"791FF461C1AB16D2EA03C8B98722FD846307E3101B93491CDAF6DD7B711945CE","sizeBytes":10565},"review":null,"source":{"repositoryUrl":"https://github.com/aAAaqwq/AGI-Super-Team","path":"skills/api-provider-status","license":"MIT","commit":"331ecd3c1dd6597c351e5dc5d7a7d9f6e6bcab13","subtreeSha":"CB438567FF903E1F52ADBA1556028D1AC6C7627ED81C2214ABB3CCC8E0F58B27","lastSyncedAt":"2026-09-27T19:30:31.933956Z"},"reviewedAt":"2026-09-18T13:27:22.349871Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/aAAaqwq/AGI-Super-Team/tree/main/skills/api-provider-status"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install aaaaqwq-agi-super-team@llmmart"},{"target":"git","command":"git clone https://github.com/aAAaqwq/AGI-Super-Team.git"}]}