AI Token消耗监控

v1.0.2

AI Token消耗监控。读取会话日志,统计Token消耗,检测异常并提供优化建议。 帮助用户了解AI使用成本,避免意外超支。 当用户说"Token"、"消耗多少"、"Token统计"、"费用"、"超支"时触发。 Keywords: Token, 消耗, 费用, 统计, 监控, 成本.

0· 89·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for freedompixels/ai-token-usage.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "AI Token消耗监控" (freedompixels/ai-token-usage) from ClawHub.
Skill page: https://clawhub.ai/freedompixels/ai-token-usage
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install ai-token-usage

ClawHub CLI

Package manager switcher

npx clawhub@latest install ai-token-usage
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description say it will read session logs and count tokens. The SKILL.md and scripts/token_stats.py both reference the same session path (~/.qclaw/agents/main/sessions) and a local memory path (~/.qclaw/workspace/memory). No unrelated credentials, binaries, or external services are requested.
Instruction Scope
Runtime instructions and the script only read local session JSONL files, compute aggregates, print reports, detect anomalies, and save aggregated JSON files. The script does not read unrelated system config, access network endpoints, or exfiltrate data. Note: it does read message-level session files (which may contain sensitive message text) but only stores aggregated token counts.
Install Mechanism
No install spec (instruction-only) and included Python script; no download or third-party installers. Risk from install mechanism is low. Running requires a local Python runtime.
Credentials
The skill requires no environment variables or credentials. It reads only session logs under the agent workspace and writes aggregated stats to the workspace memory directory — proportional to the stated purpose.
Persistence & Privilege
always:false and user-invocable:true. The skill writes files only under ~/.qclaw/workspace/memory and does not change other skills or system settings. Autonomous invocation (model invocation enabled) is the platform default but is not combined here with other concerning privileges.
Assessment
This skill appears to do what it claims: analyze local session logs and save aggregated token-usage JSON files. Before installing, consider: (1) the script will read your session files (~/.qclaw/agents/main/sessions) which may contain message contents—if those messages include sensitive data you may prefer not to run it or to inspect the script first; (2) it writes aggregated stats under ~/.qclaw/workspace/memory; ensure you are comfortable with that storage location; (3) it requires a local Python runtime to execute; (4) although no network calls are present, review the code if you want extra assurance. If you do not want the skill invoked autonomously, disable autonomous invocation in your agent settings.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

📊 Clawdis
latestvk972cge2bhnr87158qcf6hrnen84t6tk
89downloads
0stars
2versions
Updated 1w ago
v1.0.2
MIT-0

Token Monitor - AI Token 消耗监控

监控 AI Token 消耗,检测异常,提供优化建议。

功能

  • 📊 读取 session 日志统计 Token 消耗
  • 🚨 检测异常消耗(短时激增、重复失败等)
  • 💡 给出优化建议
  • 📈 生成消耗趋势报告

使用

检查今日消耗

python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --today

检查指定日期

python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --date 2026-04-13

检查异常模式

python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --check-anomaly

生成优化报告

python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --report

异常检测规则

规则阈值说明
单日总量>1000万严重超标
单小时>200万需要检查
重复失败>3次死循环风险
浏览器快照单次>5000字未压缩

历史数据参考

日期InputOutputTotal状态
4/113.46M117K28.8M🚨 超标
4/125.57M127K37.0M🚨 严重超标
4/131.80M22K9.5M⚠️ 偏高
4/14430K20K3.7M✅ 正常

4/12是Token浪费最严重的一天:3700万token,根因是Chrome CDP崩溃重试+ClawHub限速重试

优化建议库

  • 浏览器快照用 compact=true
  • 同一操作失败3次立即换方案
  • 限速不硬等,跳转做其他事
  • 后台进程不轮询

数据存储

  • 日志:~/.qclaw/agents/main/sessions/*.jsonl
  • 统计:memory/token-usage-YYYY-MM-DD.json

Comments

Loading comments...