Skills gmncode-usage
通过 HTTP 接口查询 GMNCODE / gmncode.cn 中转站的大模型用量,包括 dashboard 汇总、每日趋势、按模型拆分的 token 与费用数据。当用户要求查看 GMNCODE token 用量、每日模型消耗、API/中转站花费、dashboard 用量,或希望用脚本/HTTP 接口直接获取 GMNCODE 使用数据而不是手动打开网页时使用。
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/alex-shen1121/gmncode-usage" ~/.claude/skills/openclaw-skills-gmncode-usage && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/alex-shen1121/gmncode-usage" ~/.openclaw/skills/openclaw-skills-gmncode-usage && rm -rf "$T"
manifest:
skills/alex-shen1121/gmncode-usage/SKILL.mdsource content
GMNCODE Usage
使用本技能自带脚本,通过可用的 dashboard HTTP 接口查询 GMNCODE 用量数据。
快速开始
- 先确保凭据已经通过环境变量或
提供。~/.openclaw/.env - 优先运行
,不要每次都重新手写登录、token 缓存和重试逻辑。scripts/gmncode_usage.py - 常用命令:
python3 scripts/gmncode_usage.py brief
查询你最常要的那组指标:账户每日额度 + 今日模型用量python3 scripts/gmncode_usage.py quota
只看账户每日额度python3 scripts/gmncode_usage.py report --date todaypython3 scripts/gmncode_usage.py report --date 2026-03-25python3 scripts/gmncode_usage.py report --start 2026-03-01 --end 2026-03-26python3 scripts/gmncode_usage.py models --date 2026-03-25 --jsonpython3 scripts/gmncode_usage.py trend --start 2026-03-01 --end 2026-03-26 --json
工作流
1. 安全加载凭据
不要把邮箱和密码硬编码进临时脚本、回复内容或日志里。
优先使用:
GMNCODE_EMAILGMNCODE_PASSWORD
GMNCODE_BASE_URL 已固定写死为 https://gmncode.cn,因为这不是敏感信息,不需要放进环境变量。
如果缺少凭据,就停止执行,并提示用户补充到
~/.openclaw/.env。
2. 复用内置客户端
脚本已经处理好了:
- 通过
登录/api/v1/auth/login - access token 本地缓存
- 遇到
/401
时自动重新登录并重试一次INVALID_TOKEN - dashboard 所需的 referer / headers
除非 HTTP 接口失效,否则不要退回浏览器自动化方案。
3. 使用正确接口
使用以下接口:
/api/v1/subscriptions?status=active/api/v1/usage/dashboard/stats/api/v1/usage/dashboard/trend/api/v1/usage/dashboard/models
请求参数统一传:
start_date=YYYY-MM-DDend_date=YYYY-MM-DDtimezone=Asia/Shanghai
不要用
/api/v1/admin/dashboard/*,普通用户 token 会返回 403 FORBIDDEN。
4. 按指标口径取值
如果用户要的是这组固定指标,按下面口径取:
A. 账户每日使用额度
从
/api/v1/subscriptions?status=active 读取所有活跃订阅:
- 每日使用额度 =
sum(group.daily_limit_usd) - 今日已用 =
sum(daily_usage_usd) - 今日剩余 = 每日使用额度 - 今日已用
B. 今日模型用量
从
/api/v1/usage/dashboard/models 读取指定日期:
- 模型名:
model - token 用量:
total_tokens - 实际金额:
actual_cost
默认把 token 格式化成
x.x M / x.xx B 这种紧凑写法。
输出建议
如果用户只想看固定口径,优先给两块:
- 账户额度:每日使用额度 / 今日已用 / 今日剩余
- 今日模型使用:模型名 / token 用量 / 实际金额
如果用户要更完整的汇报,再补:
的汇总数据stats
的每日趋势trend- 当查询区间为单日时,补
的按模型拆分models
默认使用紧凑表格或短列表,避免冗长描述。
资源
scripts/
:安全的 HTTP 客户端与 CLI,负责登录、stats、trend、models 查询。scripts/gmncode_usage.py
references/
:接口说明、安全约定、凭据存储方式与字段解释。references/api.md