Turn prompts and uploaded data into responsive dashboards, data explorers, visualizations, and interactive web apps.
Coding
Token Stats
Inspect token usage for six AI agents from local data through a menu, direct selection, or live monitoring.
What it does
Choose an AI agent from an interactive menu and inspect its token usage from local records without a network connection. Supports Hermes, Claude Code, CodeX, OpenClaw, Reasonix, and DeepSeek TUI, with direct agent selection and live watch modes. Runs on Python 3.11+ using only the standard library.
When to use it
- Checking token usage after an agent task
- Watching token consumption in real time
- Comparing local records across supported agents
- Adding Hermes token output after each task
The skill document
token-stats — 选个 Agent 看它的消耗
核心原则
- 每次运行都弹菜单 — 你想看哪个 Agent 就选哪个,不预设
- 数据来自本地 — 不联网,纯读你的 Agent 本地数据文件
- 零依赖 — 纯 Python 标准库,装完即用
前置条件
- Python 3.11+
- 至少一种 Agent 有使用记录:Hermes / Claude Code / CodeX / OpenClaw / Reasonix / DeepSeek TUI
- 安装方式:从 clone 或解压目录运行
python3 token-stats.py setup,默认安装到~/.token-stats/ - 更新方式:git clone 用户
cd ~/token-stats && git pull,ClawHub 用户token-stats update
用法速查
# 交互式菜单(默认)
token-stats
# 跳过菜单直接看
token-stats -a hermes
token-stats -a claude-code
token-stats -a codex
# 实时监控
token-stats --watch
token-stats -a hermes --watch
# 查看本机装了哪些 Agent
token-stats --list-backends
# 查看版本
token-stats --version
Hermes 集成
Hermes 的 SKILL.md 里可以这样用:
run: token-stats -a hermes
这样每次任务结束会自动输出 Hermes 的 token 消耗,不弹菜单。
数据源说明
| Agent | 数据读哪里 |
|---|---|
| Hermes | ~/.hermes/state.db → sessions 表 |
| Claude Code | ~/.claude/projects/**/*.jsonl |
| CodeX | ~/.codex/state_*.sqlite + ~/.codex/sessions/**/*.jsonl |
| OpenClaw | ~/.openclaw/agents/main/sessions/ |
Questions people ask
- Which AI agents can I monitor?
- Hermes, Claude Code, CodeX, OpenClaw, Reasonix, and DeepSeek TUI are supported. At least one of them must have local usage records.
- Does it upload usage data or require internet access?
- No. It reads agent data files stored on the local machine and does not connect to the network.
- Can I skip the interactive menu or monitor usage continuously?
- Yes. Use `-a` to select an agent directly, such as `token-stats -a hermes`, and add `--watch` for live monitoring.
Related skills
Install goal-linked tracking, diagnose product behavior, and choose one defensible next growth action.
Set up and operate a self-hosted command center for OpenClaw agents, tasks, sessions, costs, and integrations.
Send messages to configured AI agents and maintain separate multi-turn sessions from the command line.
Install, switch, validate, export, restore, and publish Soul Spec personas from the CLI.
Manage Tencent meetings, attendees, recordings, transcripts, and AI minutes through MCP tools.