← Back to Skills Marketplace
alex-shen1121

GMNCODE Usage

by AlexShen · GitHub ↗ · v0.1.3 · MIT-0
cross-platform ⚠ suspicious
117
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install gmncode-usage
Description
通过 HTTP 接口查询 GMNCODE / gmncode.cn 中转站的大模型用量,包括 dashboard 汇总、每日趋势、按模型拆分的 token 与费用数据。当用户要求查看 GMNCODE token 用量、每日模型消耗、API/中转站花费、dashboard 用量,或希望用脚本/HTTP 接口直接获取...
README (SKILL.md)

GMNCODE Usage

使用本技能自带脚本,通过可用的 dashboard HTTP 接口查询 GMNCODE 用量数据。

快速开始

  1. 先确保凭据已经通过环境变量或 ~/.openclaw/.env 提供。
  2. 优先运行 scripts/gmncode_usage.py,不要每次都重新手写登录、token 缓存和重试逻辑。
  3. 常用命令:
    • python3 scripts/gmncode_usage.py brief
      查询你最常要的那组指标:账户每日额度 + 今日模型用量
    • python3 scripts/gmncode_usage.py quota
      只看账户每日额度
    • python3 scripts/gmncode_usage.py report --date today
    • python3 scripts/gmncode_usage.py report --date 2026-03-25
    • python3 scripts/gmncode_usage.py report --start 2026-03-01 --end 2026-03-26
    • python3 scripts/gmncode_usage.py models --date 2026-03-25 --json
    • python3 scripts/gmncode_usage.py trend --start 2026-03-01 --end 2026-03-26 --json

工作流

1. 安全加载凭据

不要把邮箱和密码硬编码进临时脚本、回复内容或日志里。

优先使用:

  • GMNCODE_EMAIL
  • GMNCODE_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-DD
  • end_date=YYYY-MM-DD
  • timezone=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 这种紧凑写法。

输出建议

如果用户只想看固定口径,优先给两块:

  1. 账户额度:每日使用额度 / 今日已用 / 今日剩余
  2. 今日模型使用:模型名 / token 用量 / 实际金额

如果用户要更完整的汇报,再补:

  • stats 的汇总数据
  • trend 的每日趋势
  • 当查询区间为单日时,补 models 的按模型拆分

默认使用紧凑表格或短列表,避免冗长描述。

资源

scripts/

  • scripts/gmncode_usage.py:安全的 HTTP 客户端与 CLI,负责登录、stats、trend、models 查询。

references/

  • references/api.md:接口说明、安全约定、凭据存储方式与字段解释。
Usage Guidance
This skill's code and docs show it logs into https://gmncode.cn and queries usage data; that's consistent with its description. However: (1) the registry metadata omits the required GMNCODE_EMAIL/GMNCODE_PASSWORD env vars—expect the skill to ask for those; (2) it needs your account password (not just an API key), which is sensitive—prefer creating a dedicated/limited account or API token if GMNCODE supports one; (3) the script caches a bearer token at ~/.cache/openclaw/gmncode-usage/token.json and reads ~/.openclaw/.env, so check those file permissions (chmod 600) and inspect the cache content if concerned; (4) review the full script yourself (it's included) to confirm no unexpected network destinations or behavior; and (5) if you proceed, run it in a confined environment or with an account that has minimal privileges. The main issue is the metadata mismatch and the sensitivity of requiring a full password—fixing the metadata or using an API token would increase trust.
Capability Analysis
Type: OpenClaw Skill Name: gmncode-usage Version: 0.1.3 The skill is a legitimate utility for querying AI usage statistics from the GMNCODE platform. The Python script (scripts/gmncode_usage.py) follows security best practices by implementing local token caching with restricted file permissions (chmod 600) and loading credentials from a dedicated environment file. All network requests are directed to the service's official domain (gmncode.cn), and the instructions in SKILL.md explicitly warn the agent against leaking sensitive credentials in logs or output.
Capability Assessment
Purpose & Capability
The skill's purpose is to query GMNCODE usage and the code implements login + dashboard usage queries against https://gmncode.cn, which is coherent. However, the registry metadata lists no required environment variables or primary credential while both SKILL.md and the script require GMNCODE_EMAIL and GMNCODE_PASSWORD. That metadata omission is an inconsistency that could cause unexpected credential prompts.
Instruction Scope
SKILL.md and the script limit actions to reading credentials from environment or ~/.openclaw/.env, calling specific dashboard API endpoints, and caching a bearer token under ~/.cache/openclaw/gmncode-usage/token.json. The instructions do not request unrelated files, admin routes, or external endpoints beyond the hardcoded https://gmncode.cn.
Install Mechanism
There is no install spec (instruction-only) and the included Python script uses only standard library networking; nothing is downloaded from arbitrary URLs and no archives are extracted. Risk from install mechanism is low.
Credentials
Requiring GMNCODE_EMAIL and GMNCODE_PASSWORD is proportionate to performing a login-based API access, but the skill requests a full account password rather than an API token (more sensitive). Also, the registry did not declare these required env vars nor a primary credential, which is misleading. The script writes a token cache in the user's home directory (normal) but users should be aware they're giving account credentials.
Persistence & Privilege
The skill does not request elevated or persistent platform privileges. It creates a local token cache under the user's home directory and will delete/refresh it on 401; always:false and no modification of other skills or system-wide settings. This is typical and limited in scope.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install gmncode-usage
  3. After installation, invoke the skill by name or use /gmncode-usage
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.3
Configuration update: hardcoded GMNCODE_BASE_URL to https://gmncode.cn inside the skill because it is non-sensitive, removed base URL from env configuration guidance, and refreshed Chinese documentation to keep only GMNCODE_EMAIL and GMNCODE_PASSWORD as required secrets.
v0.1.2
Feature update: documented the exact metric mapping for account daily quota and today model usage; added active subscription quota derivation via /api/v1/subscriptions; added quota and brief commands to the bundled CLI for the concise report format (daily quota, used, remaining, and per-model token/actual cost); refreshed Chinese skill guidance and API reference accordingly.
v0.1.1
Documentation update: translated SKILL.md and API reference into Chinese, clarified secure credential loading from environment or ~/.openclaw/.env, documented automatic re-login/token refresh behavior, and polished release notes for production use.
v0.1.0
Initial release: secure GMNCODE HTTP usage skill with login, token refresh, daily trend, and per-model usage queries.
Metadata
Slug gmncode-usage
Version 0.1.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is GMNCODE Usage?

通过 HTTP 接口查询 GMNCODE / gmncode.cn 中转站的大模型用量,包括 dashboard 汇总、每日趋势、按模型拆分的 token 与费用数据。当用户要求查看 GMNCODE token 用量、每日模型消耗、API/中转站花费、dashboard 用量,或希望用脚本/HTTP 接口直接获取... It is an AI Agent Skill for Claude Code / OpenClaw, with 117 downloads so far.

How do I install GMNCODE Usage?

Run "/install gmncode-usage" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is GMNCODE Usage free?

Yes, GMNCODE Usage is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does GMNCODE Usage support?

GMNCODE Usage is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created GMNCODE Usage?

It is built and maintained by AlexShen (@alex-shen1121); the current version is v0.1.3.

💬 Comments