Token Cost Guard

SKILLAI 工具
AI 工具 未标注权限 许可证不明确 已核验
安装这个技能

Monitor agent token usage and model cost from the active ecosystem's own records, compare the current run with the previous snapshot, and send an alert repor...

一句话选型结论

按资料字段整理

Token Cost Guard是AI 工具类的 Agent Skill,安装方式:ClawHub 市场,权限级别未标注,许可证不明确,有可直接复制的安装命令。技能本质是给模型读的说明书,效果取决于模型与客户端;装完先用一个小任务验证,再放进正式流程。

分类AI 工具 安装方式ClawHub 市场 权限级别未标注权限 许可证许可证不明确
累计安装 未标注 本周 未标注
GitHub 星标 未标注 仓库 未标注
下载量 未标注 技能市场下载数
权限级别 未标注权限 安装前请确认风险范围
许可证 许可证不明确 未说明

安装

ClawHub 市场
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
skillhub install user_15d05850/token-cost-guard
  1. 1
    确认客户端支持

    确认你的客户端支持 Skills(Claude、Codex、Cursor 等),并升级到较新的版本。

  2. 2
    拿到技能文件

    执行上面的命令安装;也可以把仓库里的 SKILL.md 手动放进客户端的 skills 目录。

  3. 3
    刷新技能列表

    重新打开客户端,或刷新技能列表,让新放进来的技能被加载。

  4. 4
    验证是否生效

    问一句「你有哪些技能」,确认列表里出现它,再拿一个小任务试跑。

技能档案

AI 工具
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方user_15d05850仓库 未标注 · 版本 未标注
宿主客户端未标注技能可被这些客户端加载
安装方式ClawHub 市场安装包 clawhub
权限级别未标注权限安装前请确认风险范围
许可证未说明许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验未标注上游最后核验时间 · 数据更新 1791622251
正文体量6.0 KBSKILL.md 原文大小,越大说明说明书写得越细

典型使用场景

3 类
按分类整理的常见用法,具体以 SKILL.md 为准
组合多个 AI 能力

把写作、检索、总结串成一条流程。

搭工作流

把固定流程做成可重复调用的步骤。

做提示词与评测

整理提示词并对比输出效果。

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 已做过站内核验,页面字段与仓库对得上。
  • 有可直接复制的安装命令,不用自己翻文档找入口。

先想清楚的地方

  • 没有标注权限级别,实际能做什么要装好后确认。
  • 许可证不明确,商用或二次分发前先到仓库确认条款。
  • 技能只是说明书,实际效果取决于模型与客户端,装完先用小任务试一遍。

更适合

  • 需要在AI 工具场景里给模型补一套做法的人。
  • 愿意先读一遍 SKILL.md、确认它会让模型做什么的人。

不太适合

  • 对许可证要求很严、必须明确可商用的人。
  • 只想装完就自动变强、不打算看说明书的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
技能权限级别安装方式累计安装宿主客户端安装命令
Token Cost Guard当前 未标注权限 ClawHub 市场 未标注 未标注 有
执行计划 只读 GitHub 仓库 151.5 万 Codex、Claude、Cursor 有
Playwright MCP 测试 浏览器控制 ClawHub 市场 136.5 万 OpenClaw 有
完成前的验证 未标注权限 GitHub 仓库 131.9 万 Codex、Claude、Cursor 有
子 Agent 驱动开发 只读 GitHub 仓库 131.2 万 Codex、Claude、Cursor 有
前端设计 执行命令 GitHub 仓库 125.6 万 Codex、Claude、Cursor 有

SKILL.md 全文

6.0 KB
模型实际读到的说明书原文,来自技能仓库

Token Cost Guard

Use this skill to compute agent token costs from the current runtime's own usage records and warn in Chinese reports when spend has increased too much since the previous run.

Quick Start

Run a one-shot check for today:

python3 skills/token-cost-guard/scripts/token_cost_guard.py --threshold-cny 20

Force a source when needed:

python3 skills/token-cost-guard/scripts/token_cost_guard.py --source hermes --threshold-cny 20
python3 skills/token-cost-guard/scripts/token_cost_guard.py --source openclaw --threshold-cny 20

When installed by Hermes and running from the skill directory:

python3 scripts/token_cost_guard.py --threshold-cny 20

Initialize a baseline without alerting:

python3 skills/token-cost-guard/scripts/token_cost_guard.py --init-only

Run every 60 seconds:

python3 skills/token-cost-guard/scripts/token_cost_guard.py --watch-interval 60 --threshold-cny 20

Check the previous hour and stay silent unless the hour exceeds 10 CNY:

python3 skills/token-cost-guard/scripts/token_cost_guard.py \
  --period previous-hour \
  --alert-mode total \
  --threshold-cny 10 \
  --quiet-ok \
  --alert-exit-zero

Send an alert through OpenClaw when the threshold is exceeded:

python3 skills/token-cost-guard/scripts/token_cost_guard.py \
  --threshold-cny 20 \
  --send-openclaw \
  --channel feishu \
  --target <recipient-or-chat-id>

OpenClaw hourly command alert example:

python3 ~/.openclaw/skills/token-cost-guard/scripts/token_cost_guard.py \
  --source openclaw \
  --period previous-hour \
  --alert-mode total \
  --threshold-cny 10 \
  --quiet-ok \
  --alert-exit-zero \
  --send-openclaw \
  --channel feishu \
  --target <feishu-open-id-or-chat-id>

Hermes hourly script alert example:

~/.hermes/scripts/hermes_hourly_alert.sh

Behavior

  • --source auto selects Hermes when running under Hermes (HERMES_* environment or ~/.hermes/skills path), otherwise OpenClaw.
  • OpenClaw source reads ~/.openclaw/agents/*/sessions/*.jsonl and prefers native cost fields such as usage.cost.total, usage.costCny, or usage.costUsd before estimating from token prices.
  • Hermes source reads ~/.hermes/logs/agent.log* API-call usage lines and uses Hermes state.db session costs (actual_cost_usd or estimated_cost_usd) when present, allocated across log calls by token share. It falls back to state.db session aggregates when logs have no matching records.
  • Defaults to today's Asia/Shanghai date.
  • Supports --period day, --period current-hour, and --period previous-hour; use previous-hour for hourly cron alerts.
  • Computes cost by model and by runtime group (Agents for OpenClaw, Hermes Sources such as cron, weixin, or cli for Hermes).
  • Compares current total cost with the previous snapshot in the selected runtime's token-cost-guard/state.json.
  • Alerts when either condition is true:
  • absolute cost delta is greater than --threshold-cny
  • percentage delta is greater than --threshold-percent
  • With --alert-mode total, alerts when the current time window's known cost is greater than --threshold-cny; this is the recommended mode for "last hour exceeded budget" cron jobs.
  • With --quiet-ok, prints nothing when the run is OK; this is useful for Hermes cron --no-agent --script delivery.
  • With --alert-exit-zero, returns exit code 0 even when an alert fires; use it for cron jobs so a successful alert is not marked as a failed run.
  • Writes Chinese Markdown reports to the selected runtime's token-cost-guard/reports/.

Hermes Compatibility

The bundled script is stdlib-only and can run under Codex, OpenClaw, Hermes, cron, or a plain shell.

Environment variables:

  • OPENCLAW_STATE_DIR or OPENCLAW_HOME: override the OpenClaw state directory.
  • HERMES_HOME: override the Hermes home directory; defaults to ~/.hermes.
  • OPENCLAW_TOKEN_COST_GUARD_STATE_DIR: override state/report storage.
  • HERMES_STATE_DIR or HERMES_DATA_DIR: when present and source is Hermes, default state/report storage goes under <that-dir>/token-cost-guard.
  • OPENCLAW_TOKEN_COST_THRESHOLD_CNY: default absolute alert threshold.
  • OPENCLAW_TOKEN_COST_THRESHOLD_PERCENT: default percent alert threshold.
  • TOKEN_COST_GUARD_USD_CNY or TOKEN_REPORT_USD_CNY: USD/CNY conversion for Hermes state.db costs and any OpenClaw native USD cost fields.

Hermes tap metadata lives in skill.json; ClawHub/OpenClaw marketplace metadata lives in clawhub.json.

Pricing

Cost source priority is: runtime-native billing fields first, then the price table after applying any --pricing-file overrides.

The script embeds current DeepSeek official CNY prices per 1M tokens:

  • deepseek-v4-pro: cache hit 0.025, cache miss 3, output 6
  • deepseek-v4-flash: cache hit 0.02, cache miss 1, output 2
  • deepseek-chat and deepseek-reasoner are treated as v4-flash compatibility aliases.

Known local CNY estimates are included for Kimi models. Unknown models are listed as unpriced unless OpenClaw or Hermes recorded a usable native cost.

Use --pricing-file <json> to override or add prices. JSON shape:

{
  "provider/model-or-model-id": {
    "cache_hit_cny_per_million": 0.02,
    "cache_miss_cny_per_million": 1.0,
    "output_cny_per_million": 2.0
  }
}

Output Contract

When reporting results, include:

  • current total known cost
  • previous total and delta when available
  • alert status and threshold
  • top models by cost
  • top agents by cost
  • unpriced models, if any

常见问题

5 问
答案由本站依据条目字段整理
Token Cost Guard怎么安装?

在支持 Skills 的客户端里执行:skillhub install user_15d05850/token-cost-guard。安装方式为ClawHub 市场。装完刷新技能列表或重开客户端。

Token Cost Guard支持哪些客户端?

资料没有标注宿主客户端,但只要客户端支持 Skills(Claude、Codex、Cursor 等),一般都能加载。

Token Cost Guard权限高吗,安全吗?

权限级别为未标注权限。安装前先看它会读取或写入哪些内容。

Token Cost Guard收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于技能本身和所用的模型或客户端,正式使用前按作者说明确认。

Token Cost Guard用什么许可证?

许可证标注为 未说明(许可证不明确)。商用或二次分发前请到仓库确认条款原文。

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 未标注。