360 Secure SkillHub
360 安全技能中心

Skill Cost

核心功能是扫描本地OpenClaw会话文件,统计各技能的token用量与成本,支持按时间生成报表、成本排名、单技能详情及技能对比,输出可选文本或JSON。适用于用户询问技能花费、高成本技能、按技能拆分成本等场景,需通过bash命令调用,无需API密钥,依赖python3与bash,可跨多系统使用。

dzwalker
dzwalker
热度 73.58
最近更新 2026-05-11 17:29:37
分类:数据依赖:代码执行应用场景:数据处理 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add skill-cost
Metadata
name
skill-cost
version
0.1.0
author
dzwalker
description
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.
triggers
["skill cost","skill spending","skill usage","which skill costs","per-skill cost","skill token","cost by skill","token by skill","skill breakdown","cost breakdown by skill"]
repository
https://github.com/dzwalker/skill-cost
license
MIT
dependencies
[]
tools
["skill_cost_report","skill_cost_detail","skill_cost_compare"]
metadata
{"clawdbot":{"emoji":"💰","requires":{"anyBins":["python3","bash"]},"os":["linux","darwin","win32"]}}

Skill Cost — USE BASH TOOL

You MUST use the bash or shell tool to run these commands. No other method works.

Commands

Per-skill cost report:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh report

Last 7 days:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh report --days 7

Since a specific date:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh report --since 2026-03-01

JSON output:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh report --format json

Top skills by cost:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh ranking

Detail for a specific skill:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh detail poe-connector

Compare two skills:

bash ~/.openclaw/workspace/skills/skill-cost/skill-cost.sh compare poe-connector web-search

DO NOT

  • Do NOT use sessions_spawn — it will fail
  • Do NOT use browser — it will fail
  • Do NOT use any approach other than bash tool — only bash works

How It Works

  1. Scans OpenClaw session JSONL files at ~/.openclaw/agents/*/sessions/
  2. Parses assistant messages for tool calls and token usage
  3. Attributes token usage to skills by matching bash command paths and tool names
  4. Aggregates and reports per-skill costs with model and daily breakdowns

Notes

  • No API keys required — reads directly from local session files
  • No external Python dependencies (stdlib only)
  • Skill attribution uses bash command paths and SKILL.md tool mappings
  • Tokens for multi-skill messages are proportionally split across skills
  • Usage not attributable to any skill is categorized as (built-in) or (conversation)