api-quota-monitor

查询监控 API 供应商/服务的额度、余额、消耗情况。支持官方供应商(Gemini/xAI/ZAI/Minimax/OpenRouter等)、中转站(AIXN/Provider-A等)、订阅服务(Brave/Tavily/Serper)。触发词:查额度、查余额、API用量、供应商额度、quota、balance、usage、billing。

33 stars

Best use case

api-quota-monitor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

查询监控 API 供应商/服务的额度、余额、消耗情况。支持官方供应商(Gemini/xAI/ZAI/Minimax/OpenRouter等)、中转站(AIXN/Provider-A等)、订阅服务(Brave/Tavily/Serper)。触发词:查额度、查余额、API用量、供应商额度、quota、balance、usage、billing。

Teams using api-quota-monitor should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-quota-monitor/SKILL.md --create-dirs "https://raw.githubusercontent.com/aAAaqwq/AGI-Super-Team/main/skills/api-quota-monitor/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-quota-monitor/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-quota-monitor Compares

Feature / Agentapi-quota-monitorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

查询监控 API 供应商/服务的额度、余额、消耗情况。支持官方供应商(Gemini/xAI/ZAI/Minimax/OpenRouter等)、中转站(AIXN/Provider-A等)、订阅服务(Brave/Tavily/Serper)。触发词:查额度、查余额、API用量、供应商额度、quota、balance、usage、billing。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# API Quota Monitor

查询监控各类 API 供应商和订阅服务的额度/余额/消耗。

## 快速使用

```bash
# 查询所有已配置的供应商
python3 scripts/query_quota.py

# 查询特定供应商
python3 scripts/query_quota.py xai
python3 scripts/query_quota.py openrouter
python3 scripts/query_quota.py brave

# 只查官方供应商
python3 scripts/query_quota.py --type official

# 只查订阅服务
python3 scripts/query_quota.py --type service

# JSON 输出
python3 scripts/query_quota.py --format json

# 发现已配置的供应商
python3 scripts/query_quota.py --discover
```

## 工作流

```
1. 发现本地已配置的 API/供应商(从环境变量、auth-session-state.json)
   ↓
2. 按类型查询:API 直查 > 浏览器抓取
   ↓
3. 生成报告:供应商 | 消耗 | 总额度 | 状态
```

## 供应商分类

### 官方供应商 (Official)

| 供应商 | 查询方式 | 环境变量 | 状态 |
|--------|----------|----------|------|
| ZAI (智谱) | API 直查 | `ZAI_API_KEY` | ✅ 支持 |
| Minimax | API 直查 | `MINIMAX_API_KEY` + `MINIMAX_GROUP_ID` | ✅ 支持 |
| OpenRouter | API 直查 | `OPENROUTER_API_KEY` | ✅ 支持 |
| xAI (Grok) | 浏览器 | `XAI_API_KEY` | 🔍 需浏览器 |
| Gemini | 浏览器 | `GOOGLE_API_KEY` | 🔍 需浏览器 |
| Anthropic | 浏览器 | `ANTHROPIC_API_KEY` | 🔍 需浏览器 |

### 中转站 (Reseller)

| 平台 | 查询方式 | 状态来源 |
|------|----------|----------|
| AIXN | 浏览器抓 ai.9w7.cn | auth-session-state.json |
| Provider-A | 浏览器抓 your-provider.example.com | auth-session-state.json |

中转站查询流程:
1. 检查 `~/.openclaw/auth-session-state.json` 获取登录状态
2. 使用 `browser(action='navigate', profile='openclaw')` 访问控制台
3. 从 snapshot 提取余额/消耗信息

### 订阅服务 (Services)

| 服务 | 查询方式 | 环境变量 |
|------|----------|----------|
| Brave Search API | API 直查 | `BRAVE_API_KEY` |
| Tavily API | API 直查 | `TAVILY_API_KEY` |
| Serper API | API 直查 | `SERPER_API_KEY` |

## 浏览器查询 (需浏览器抓取的供应商)

当供应商没有公开的 usage API 时,使用 browser 工具:

```
# 1. 导航到控制台页面
browser(action='navigate', profile='openclaw', targetUrl='<console_url>')

# 2. 等待加载后获取快照
browser(action='snapshot', profile='openclaw', compact=true, maxChars=2000)

# 3. 从快照中提取余额/消耗信息
# 查找关键词:余额、balance、usage、消耗、tokens、额度
```

**各供应商控制台 URL:**
- xAI: https://console.x.ai/usage
- Gemini: https://aistudio.google.com/apikey
- Anthropic: https://console.anthropic.com/settings/billing
- AIXN: https://ai.9w7.cn/console
- Provider-A: https://your-provider.example.com/dashboard

## 报告格式

```
📊 API Quota Report
⏰ 2026-03-15 20:30

━━ 官方供应商 ━━
✅ ZAI (智谱): ¥50.00
✅ Minimax: ¥10.00 CNY
✅ OpenRouter: $45.00 remaining
🔍 xAI (Grok): 需浏览器查询

━━ 订阅服务 ━━
✅ Brave Search: 1500/2000 requests
✅ Tavily: 800 remaining

━━ 中转站 ━━
✅ AIXN: ¥238.81
✅ Provider-A: ¥9.35
```

## 扩展新供应商

在 `scripts/query_quota.py` 中添加新供应商配置:

```python
OFFICIAL_PROVIDERS = {
    "new_provider": {
        "name": "New Provider",
        "env_key": "NEW_PROVIDER_API_KEY",
        "api_url": "https://api.newprovider.com/v1/usage",
        "method": "api",  # 或 "browser"
        "extract": lambda data: {
            "balance": data.get("balance", 0),
        }
    },
}
```

## 缓存策略

- API 查询结果可缓存 1-6 小时(避免频繁请求)
- 缓存文件: `~/.openclaw/quota-cache.json`
- 格式:
```json
{
  "openrouter": {
    "queried_at": "2026-03-15T20:00:00",
    "balance": 45.0,
    "cached": true
  }
}
```

## 定时监控

可配置 cron 定期检查并推送报告:

```bash
# 在 OpenClaw cron 中添加
# 每 6 小时检查一次 API 供应商额度
0 */6 * * * python3 ~/clawd/skills/api-quota-monitor/scripts/query_quota.py --report | newsbot_send
```

## 参考文档

详细的 API 端点和响应格式见 [references/providers.md](references/providers.md)

Related Skills

monitoring-whale-activity

33
from aAAaqwq/AGI-Super-Team

Track large cryptocurrency transactions and whale wallet movements across multiple blockchains. Monitor exchange inflows/outflows, manage watchlists, Track large cryptocurrency transactions and whale wallet movements in real-time. Use when tracking large holder movements, exchange flows, or wallet activity. Trigger with phrases like "track whales", "monitor large transfers", "check whale activity", "exchange inflows", or "watch wallet".

position-monitor

33
from aAAaqwq/AGI-Super-Team

Hourly position monitor — execute take-profit/stop-loss and track peak gains

email-monitor

33
from aAAaqwq/AGI-Super-Team

AI inbox classification + Telegram notification

effect-monitoring

33
from aAAaqwq/AGI-Super-Team

Use when monitoring Xiaohongshu marketing campaign performance, tracking promotion effectiveness, analyzing advertising ROI, measuring influencer collaboration results, evaluating activity success rates, or optimizing marketing spend allocation

ct-monitor-skill

33
from aAAaqwq/AGI-Super-Team

> 证书透明度监控——SSL/TLS 证书透明度日志监控与告警

browser-login-monitor

33
from aAAaqwq/AGI-Super-Team

> 浏览器登录安全监控——监测浏览器会话状态与登录安全

a-fund-monitor

33
from aAAaqwq/AGI-Super-Team

监控 A 股基金实时估值与盘后净值,自动判断交易日并生成提醒或分析。

wemp-operator

33
from aAAaqwq/AGI-Super-Team

> 微信公众号全功能运营——草稿/发布/评论/用户/素材/群发/统计/菜单/二维码 API 封装

Content & Documentation

zsxq-smart-publish

33
from aAAaqwq/AGI-Super-Team

Publish and manage content on 知识星球 (zsxq.com). Supports talk posts, Q&A, long articles, file sharing, digest/bookmark, homework tasks, and tag management. Use when publishing content to 知识星球, creating/editing posts, uploading files/images/audio, managing digests, batch publishing, or formatting content for 知识星球.

zoom-automation

33
from aAAaqwq/AGI-Super-Team

Automate Zoom meeting creation, management, recordings, webinars, and participant tracking via Rube MCP (Composio). Always search tools first for current schemas.

zoho-crm-automation

33
from aAAaqwq/AGI-Super-Team

Automate Zoho CRM tasks via Rube MCP (Composio): create/update records, search contacts, manage leads, and convert leads. Always search tools first for current schemas.

ziliu-publisher

33
from aAAaqwq/AGI-Super-Team

字流(Ziliu) - AI驱动的多平台内容分发工具。用于一次创作、智能适配排版、一键分发到16+平台(公众号/知乎/小红书/B站/抖音/微博/X等)。当用户需要多平台发布、内容排版、格式适配时使用。触发词:字流、ziliu、多平台发布、一键分发、内容分发、排版发布。