360 Secure SkillHub
360 安全技能中心

OpenClaw Model Usage

这是本地优先的OpenClaw模型用量统计工具,无需依赖外部服务,直接读取本地会话日志。可满足查看当前/近期模型、用量明细、成本、代理/会话用量、每日统计等需求,支持生成可读摘要、JSON数据或HTML仪表盘,适合用户排查模型使用情况、统计成本等场景。

ranasalalali
ranasalalali
热度 48.17
最近更新 2026-05-11 17:37:23
分类:数据依赖:代码执行 / 读写文件应用场景:数据处理 / 报告撰写

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add openclaw-model-usage
Metadata
name
openclaw-model-usage
description
Inspect local OpenClaw model usage directly from session logs. Use when asked for the current model, recent model usage, usage breakdown by model, token totals, cost summaries, per-agent usage, or daily model usage summaries.

OpenClaw Model Usage

Use this skill to inspect local OpenClaw model usage directly from session JSONL files.

When to use

Use this skill when the user asks for:

  • the current / most recent model in use
  • recent model usage
  • usage summaries by provider/model
  • token totals by model
  • cost summaries by model when available
  • per-agent or per-session usage
  • session/subagent rollups
  • daily model usage summaries
  • a compact summary plus an optional HTML dashboard

What it does

This skill provides a local-first replacement for external model-usage workflows.

It reads OpenClaw session logs directly and does not depend on CodexBar.

Preferred usage

Start with a short human-readable summary:

python {baseDir}/scripts/model_usage.py
python {baseDir}/scripts/model_usage.py overview
python {baseDir}/scripts/model_usage.py top-agents
python {baseDir}/scripts/model_usage.py top-sessions

Generate the HTML dashboard from real local logs when the user wants a richer artifact:

python {baseDir}/scripts/model_usage.py dashboard --root ~/.openclaw/agents --out dist/dashboard.html --title "OpenClaw Usage Dashboard"

Recommended response pattern:

  • return a short human-readable summary first
  • optionally generate and attach the HTML dashboard for richer inspection on phone/desktop

JSON output

python {baseDir}/scripts/model_usage.py overview --json --pretty
python {baseDir}/scripts/model_usage.py sessions --json --pretty
python {baseDir}/scripts/model_usage.py subagents --json --pretty
python {baseDir}/scripts/model_usage.py rows --limit 20 --json --pretty

Inputs

Default real source:

~/.openclaw/agents

Important:

  • use the real local OpenClaw log root for user-facing summaries and dashboards
  • do not use tests/fixtures_root unless you are intentionally running development tests
  • fixture roots generate sample/test output, not the user's real usage report

References

If you need field-level sourcing details, read:

  • references/discovery.md