← 返回 Skills 市场
chengkezhou

Cost Monitor

作者 chengkezhou · GitHub ↗ · v1.1.0 · MIT-0
linuxdarwinwin32 ⚠ suspicious
37
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install cost-monitor
功能描述
Real-time token usage and cost tracking for OpenClaw agents. Supports MiMo Token Plan (Credits) and DeepSeek pay-as-you-go (RMB). Shows per-turn consumption...
使用说明 (SKILL.md)

When to Use

This skill activates automatically on every assistant reply. No user trigger needed.

  • After each API response, calculate token consumption and cost
  • Append a one-line summary to the reply showing balance and usage
  • Support both MiMo (Token Plan Credits) and DeepSeek (RMB) billing models

Quick Start

Install:

clawhub install cost-monitor

Zero configuration. Works out of the box with default settings.

First-time setup (optional):

# Set your MiMo balance (copy from backend: consumed / total)
set-balance mimo 4,250,108,284 / 11,000,000,000

# Set your DeepSeek balance (RMB)
set-balance deepseek 18.00

Display Format

MiMo (Token Plan):

MiMo:61.4% | 603.5k · in 333+264.9kcached(99%) · out 202

DeepSeek (Pay-as-you-go):

DeepSeek:¥18.00 | ¥0.0045 · in 111+198.0kcached(99%) · out 192

What Each Field Means

Field Description
61.4% / ¥18.00 Remaining balance (percentage for MiMo, RMB for DeepSeek)
603.5k / ¥0.0045 Cost of this turn (Credits or RMB)
in X+Ycached(Z%) New input tokens + cached tokens (cache hit rate)
out X Output tokens generated

Supported Models

Model Billing Auto-detected
xiaomi/mimo-v2.5 Token Plan Credits
xiaomi/mimo-v2.5-pro Token Plan Credits
deepseek/deepseek-v4-flash RMB (pay-as-you-go)
deepseek/deepseek-v4-pro RMB (pay-as-you-go)
moonshot/kimi-k2.6 RMB (pay-as-you-go)

Calibration

MiMo: Copy consumed / total from the backend:

校准 mimo 4,250,108,284 / 11,000,000,000

DeepSeek: Automatic via API:

校准 deepseek

Both automatically deduct the current turn's consumption.

File Structure

cost-monitor/
├── SKILL.md              # This file
├── pricing.json          # Official pricing (auto-updated)
├── balance.json          # Balance tracking (auto-updated)
├── scripts/
│   ├── cost.py           # Core calculation engine
│   ├── calibrate.py      # Balance calibration
│   └── set-balance.sh    # Quick balance setter
└── references/
    └── detailed-guide.md # Full documentation

Nighttime Discount

MiMo Token Plan includes a 0.8× coefficient during off-peak hours (Beijing Time 00:00-08:00). This is automatically applied.

Troubleshooting

Balance not updating?

  • Ensure balance.json exists in the skill directory
  • Run calibration to sync with backend

Wrong model pricing?

  • Update pricing.json with official rates from provider websites
  • The _source field in pricing.json tracks the data origin

Display not appearing?

  • Check that the skill is installed: clawhub list
  • Verify AGENTS.md or SOUL.md contains the cost monitoring rule
安全使用建议
Install only if you want an always-on cost monitor that reads transcript usage metadata and keeps a local running balance file. Review the scripts before enabling DeepSeek calibration, because that path can read your OpenClaw DeepSeek API key and send it to DeepSeek’s balance endpoint. Keep the skill directory private and delete or reset balance.json if you do not want usage-derived state retained.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
Per-turn transcript usage reading, local cost calculation, and balance updates fit the stated cost-monitoring purpose. DeepSeek balance calibration also fits the purpose, but uses a sensitive API credential.
Instruction Scope
The always-on after-reply behavior is disclosed, but the documentation does not clearly foreground that every run reads session transcript metadata and writes balance state, and it under-discloses that DeepSeek calibration can read ~/.openclaw/openclaw.json and referenced secret files.
Install Mechanism
Metadata declares python3 and a config path, while the artifact includes executable Python and shell scripts that write local state and one manual calibration path that performs a network request with an API key.
Credentials
Access is mostly limited to the skill directory, transcript path provided at runtime, and DeepSeek balance API during calibration; no unrelated file scanning, destructive action, or unrelated exfiltration was found.
Persistence & Privilege
balance.json is designed to be updated after use, and set-balance.sh writes to ~/.openclaw/skills/cost-monitor/balance.json. This persistence is purpose-aligned but not presented as a clear install-time permission or first-use choice.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cost-monitor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cost-monitor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
重构 SKILL.md 符合 ClawHub 规范,新增校准功能和详细文档
v1.0.0
支持 DeepSeek/MiMo 双计费模式,实时显示每轮消耗和余额
元数据
Slug cost-monitor
版本 1.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Cost Monitor 是什么?

Real-time token usage and cost tracking for OpenClaw agents. Supports MiMo Token Plan (Credits) and DeepSeek pay-as-you-go (RMB). Shows per-turn consumption... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 37 次。

如何安装 Cost Monitor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cost-monitor」即可一键安装,无需额外配置。

Cost Monitor 是免费的吗?

是的,Cost Monitor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Cost Monitor 支持哪些平台?

Cost Monitor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 Cost Monitor?

由 chengkezhou(@chengkezhou)开发并维护,当前版本 v1.1.0。

💬 留言讨论