skill-cost
Track per-skill token usage and costs from OpenClaw session logs. Use when user asks about skill-level spending, which skill costs the most, or wants a per-skill cost breakdown. IMPORTANT: This is a bash-tool skill. You MUST use the bash/shell tool to execute commands.
Why use this skill?
Learn how to monitor, audit, and optimize token usage for your OpenClaw agent skills using the skill-cost utility. Get detailed breakdowns and ranking reports.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/dzwalker/skill-costWhat This Skill Does
The skill-cost utility is a specialized diagnostic tool designed for OpenClaw agents to monitor and audit token expenditure at the granular level of individual skills. Unlike global usage trackers that provide aggregate totals, this skill parses local OpenClaw session logs to identify exactly which skills are consuming the most compute and token resources. By correlating assistant message logs with tool usage data and command paths, it provides a transparent view of your automation overhead. It effectively answers the 'who, what, and how much' regarding your token consumption, allowing for cost optimization and identifying inefficient workflow patterns.
Installation
To integrate this utility into your OpenClaw environment, execute the following installation command in your terminal:
clawhub install openclaw/skills/skills/dzwalker/skill-cost
Once installed, ensure your environment has permissions to access the local ~/.openclaw/agents/ directory, as the skill relies on direct file system reads to parse JSONL session history.
Use Cases
This skill is indispensable for power users and developers managing complex agent workflows. Use it to:
- Audit which agent skills are the most expensive.
- Perform cost-benefit analysis on automated task sequences.
- Debug high token-usage anomalies during complex multi-step automations.
- Provide detailed reports for internal billing or resource allocation within team-managed agent clusters.
- Compare the efficiency of different tools (e.g., comparing a web-search vs. specific connector throughput).
Example Prompts
- "Which of my installed skills has cost the most tokens over the last week?"
- "Generate a JSON breakdown of token usage for the poe-connector skill compared to the web-search skill."
- "Show me a report of my total spending since March 1st so I can reconcile my current project budget."
Tips & Limitations
- Tool Requirement: You must use the
bashtool for all executions. Attempting to run this via other interfaces will result in failures. - Attribution Logic: Tokens are proportionally split for multi-skill interactions. If an interaction cannot be mapped to a specific skill, it will appear under '(built-in)' or '(conversation)'.
- No API Keys: Because it reads local logs, there is zero risk of data transmission to third-party endpoints. It is a strictly local tool.
- Performance: For massive session histories, the first report generation may take a few seconds as it parses local files; consider filtering by date (e.g.,
--days 7) for faster results on mature installations.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-dzwalker-skill-cost": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read, code-execution