← 返回
未分类

token用量实时监控

Monitor and analyze OpenClaw token usage across sessions. Shows models used, token counts (input/output/cache), daily trends, and hourly breakdowns. Use when the user asks about token usage, API consumption, cost tracking, model usage stats, token trends, or how many tokens have been used. Triggers: token usage, 用量, token统计, 消耗, cost, 花费, model usage, API usage.
Monitor and analyze OpenClaw token usage across sessions. Shows models used, token counts (input/output/cache), daily trends, and hourly breakdowns. Use when the user asks about token usage, API consumption, cost tracking, model usage stats, token trends, or how many tokens have been used. Triggers: token usage, 用量, token统计, 消耗, cost, 花费, model usage, API usage.
Mike
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 164
下载
💾 1
安装
1
版本
#latest

概述

Token Usage Monitor

Analyze OpenClaw session token usage from JSONL session files.

Quick Usage

Run the analysis script:

python3 ~/.openclaw/workspace/skills/token-usage-monitor/scripts/analyze_tokens.py

Options

FlagDefaultDescription
----------------------------
--days N7Include last N days (0 = all time)
--jsonfalseOutput as JSON for programmatic use
--top N10Show top N models
--base-dir PATH~/.openclaw/agentsCustom agents directory

Examples

# Last 7 days (default)
python3 scripts/analyze_tokens.py

# Last 30 days
python3 scripts/analyze_tokens.py --days 30

# All time, JSON output
python3 scripts/analyze_tokens.py --days 0 --json

# Top 5 models
python3 scripts/analyze_tokens.py --top 5

What It Shows

  1. Overview — Total API calls, input/output/cache tokens, average per call
  2. By Model — Token breakdown per model with percentage share
  3. Daily Trend — Day-by-day token consumption with visual bars
  4. Hourly Breakdown — Usage distribution for the latest active day

Data Source

Reads from ~/.openclaw/agents//sessions/.jsonl — all agent session files. Each assistant message includes a usage object with input, output, cacheRead, cacheWrite, totalTokens, and cost fields.

Notes

  • Cost is $0.00 if the provider doesn't return pricing (e.g., some local/custom providers)
  • The script aggregates across ALL agents (main, sub-agents, etc.)
  • Timestamps are in UTC; daily grouping uses UTC dates

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-04-24 13:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Tavily 搜索

jacky1n7
通过 Tavily API 进行网页搜索(Brave 替代方案)。当用户要求搜索网页、查找来源或链接,且 Brave 网页搜索不可用时使用。
★ 276 📥 101,305
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 214 📥 71,082
design-media

拍照姿势

user_acdf755c
Recommend photography poses and composition tips for different scenarios. Use when the user asks about拍照姿势、怎么摆姿势、拍照动作、po
★ 1 📥 164