Agent Token Usage
Track Daily LLM Token Consumption per Agent in OpenClaw
Install & Use
Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:
Help me install this AI Skill: Agent Token Usage. It is used for: Track Daily LLM Token Consumption per Agent in OpenClaw Full Skill content: https://321skill.com/skills/agent-token-usage/raw/index.md Read that page and install it.
The prompt includes a link to the full Skill content. You can also view the full content.
This Skill addresses the inability to accurately track LLM Token consumption per Agent in the OpenClaw multi-agent system. In practice, the totalTokens returned by sessions_list only reflects the size of the last context window, not the cumulative consumption. For long-running sessions, actual consumption can be over 100 times higher. This Skill parses session logs, incrementally sums the usage data from each LLM call, and provides precise Token consumption rankings, including input, output, KV cache read/write, total, and billable Token estimates.
Usage is straightforward: simply run the CLI script. By default, it tracks consumption for the current UTC date. It supports specifying a date, using the local timezone, outputting JSON format, and estimating billable Tokens. Additionally, running the apply-ui.sh script injects a 📊 button into the Control UI header. Clicking it opens a modal displaying the daily Agent Token leaderboard. Data is automatically refreshed every 5 minutes via a launchd scheduled task, requiring no additional daemon.
It is ideal for teams or individuals managing Token consumption in OpenClaw multi-agent systems, especially developers and operators who have deployed multiple Agents and wish to optimize costs and monitor resource usage. Product and project managers can also use this tool to track Token consumption trends and support budgeting decisions. For teams developing AI applications with OpenClaw, this Skill is an essential cost-monitoring tool.
We recommend running this tool at the end of each day or periodically to stay informed about Token consumption trends. Note that it only tracks session logs from the OpenClaw platform and is not applicable to other runtimes. It provides Token counts only, not USD costs; for cost estimation, please use the codexbar/model-usage Skill. The UI button requires re-running apply-ui.sh after openclaw update overwrites the console.
Key Features
Unlike the `totalTokens` field from `sessions_list`, which only returns the size of the last context window, this Skill accumulates the actual `usage` from each LLM call, avoiding underestimation due to context window size. The actual consumption can differ by over 100 times.
Limitations
Only supports the OpenClaw platform. Requires parsing log files in the `~/.openclaw/agents/*/sessions/<id>.jsonl` format and depends on a Python 3.6+ environment.
FAQ
How do I view the cost in USD?
This Skill only tracks Token counts and does not provide USD costs. Please use the `codexbar/model-usage` Skill.
Does it support custom dates?
Yes, use the `--date` parameter to specify a date, e.g., `--date 2026-05-20`.
Installation guide for AI assistants
If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:
Visit https://321skill.com/skills/agent-token-usage/raw/index.md to read the original Skill definition (Markdown format) for Agent Token Usage, and install it according to the instructions.
Raw Markdown URL for AI: /skills/agent-token-usage/raw/index.md