← 返回 Skills 市场
huyiling1111

Token Stats

作者 huyiling1111 · GitHub ↗ · v2.6.1 · MIT-0
cross-platform ⚠ suspicious
58
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ai-agent-usage-stats
功能描述
选择要监控的 AI 助手 → 查看 token 消耗。支持 Hermes / Claude Code / CodeX / OpenClaw,每次都让你选
使用说明 (SKILL.md)

agent-usage-stats — 选个 Agent 看它的消耗

核心原则

  1. 每次运行都弹菜单 — 你想看哪个 Agent 就选哪个,不预设
  2. 数据来自本地 — 不联网,纯读你的 Agent 本地数据文件
  3. 零依赖 — 纯 Python 标准库,装完即用

前置条件

  • Python 3.11+
  • 至少一种 Agent 有使用记录:Hermes / Claude Code / CodeX / OpenClaw
  • 安装方式:clawhub install ai-agent-usage-stats,然后 python3 ~/skills/ai-agent-usage-stats/agent-usage-stats.py setup

用法速查

# 交互式菜单(默认)
agent-usage-stats

# 跳过菜单直接看
agent-usage-stats -a hermes
agent-usage-stats -a claude-code
agent-usage-stats -a codex

# 实时监控
agent-usage-stats --watch
agent-usage-stats -a hermes --watch

# 查看本机装了哪些 Agent
agent-usage-stats --list-backends

# 查看版本
agent-usage-stats --version

Hermes 集成

Hermes 的 SKILL.md 里可以这样用:

run: agent-usage-stats -a hermes

这样每次任务结束会自动输出 Hermes 的 token 消耗,不弹菜单。

数据源说明

Agent 数据读哪里
Hermes ~/.hermes/state.db → sessions 表
Claude Code ~/.claude/projects/**/*.jsonl
CodeX ~/.codex/state_*.sqlite → threads 表
OpenClaw ~/.openclaw/agents/main/sessions/
安全使用建议
Install only if you are comfortable with a local tool reading your AI assistant usage/history files and changing PATH/wrapper/config files during setup or uninstall. Be especially cautious on Windows+WSL, avoid editing its saved paths.json to untrusted paths, and prefer manual ClawHub updates over the built-in update command until the WSL subprocess construction and setup/update confirmations are improved.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The core function of reading local AI-agent usage logs is coherent with the stated purpose, and the main README discloses the local data sources. However, the executable also includes setup, uninstall, and self-update flows beyond simple viewing.
Instruction Scope
Normal stats commands are user-directed and mostly scoped to selected agents, but '--all' and the menu can read multiple local agent history stores. The short SKILL.md lists fewer supported agents than the fuller README/code.
Install Mechanism
The setup flow creates wrappers and modifies PATH through shell rc files or the Windows user PATH; the update flow invokes ClawHub commands and copies updated files into the skill directory. These actions are disclosed but broad for a stats utility and lack strong confirmation/dry-run controls.
Credentials
Reading local SQLite/JSONL usage files is proportionate, but the WSL fallback dynamically builds a python3 -c script with path data, creating avoidable code-injection risk if path/config data is maliciously shaped.
Persistence & Privilege
The skill persists a wrapper in ~/.local/bin, edits user PATH configuration, stores discovered agent paths under ~/.config/agent-usage-stats, and uninstall removes those config directories. These are user-commanded, not hidden, but they materially change the local environment.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ai-agent-usage-stats
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ai-agent-usage-stats 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.6.1
Initial release as ai-agent-usage-stats
元数据
Slug ai-agent-usage-stats
版本 2.6.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Token Stats 是什么?

选择要监控的 AI 助手 → 查看 token 消耗。支持 Hermes / Claude Code / CodeX / OpenClaw,每次都让你选. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 58 次。

如何安装 Token Stats?

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

Token Stats 是免费的吗?

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

Token Stats 支持哪些平台?

Token Stats 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Token Stats?

由 huyiling1111(@huyiling1111)开发并维护,当前版本 v2.6.1。

💬 留言讨论