← 返回
效率工具 中文

Token Usage Tracker

Token usage logging, alerting, and context-compression utilities for OpenClaw. Use when you want to track per-call token usage, normalize timestamps, and red...
OpenClaw 的 Token 用量日志记录、告警及上下文压缩工具。用于追踪单次调用的 Token 用量、标准化时间戳以及删减...
gerhardvr26
效率工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 549
下载
💾 9
安装
1
版本
#latest#monitoring#tokens#tooling

概述

token-usage-tracker

Quick start

  1. Configure defaults in skill-config.json (timezone, log_folder).
  2. Install scripts (examples provided) into your workspace and wire the interceptor into your message pipeline.
  3. Use scripts/context_summarizer.py before sending large contexts to reduce token usage.

What this skill provides

  • Logging: token_tracker.py writes per-call token usage to a JSONL log. Includes timestamp normalization.
  • Interceptor: token_interceptor.py example that normalizes timestamps and forwards sanitized messages to the tracker.
  • Alerts: token_alerts.py example for threshold-based alerts (no external posting by default).
  • Compression: context_summarizer.py produces short summaries to reduce token payloads.
  • Utilities: migration and cleanup scripts (convert timestamps, dedupe log entries).

When to use

  • Use this skill when you want transparent per-call token accounting, to keep token usage low, or to protect sensitive/verbose contexts by summarizing before sending to the model.

Files

  • scripts/
  • token_interceptor.py — example interceptor (normalizes timestamps)
  • token_tracker.py — logging helper
  • token_alerts.py — alert examples
  • context_summarizer.py — compression helper
  • migrate_timestamps.py — migration utility
  • dedupe_log.py — dedupe utility
  • references/
  • examples/systemd/ — example unit files (install manually)
  • skill-config.json — configurable defaults
  • README.md — usage and install notes

Configuration

See skill-config.json for defaults. The skill exposes:

  • timezone: default UTC
  • log_folder: default ./skills/logs (relative to OpenClaw workspace)
  • compression settings: summary_target_tokens, max_context_tokens

Security and installation

  • The scripts are examples and safe by default. They do not change system state or install services automatically.
  • Example systemd/unit files are provided in references/systemd/ — apply them manually after review.

License: MIT (adapt as you prefer)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 06:53 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 445 📥 226,292
productivity

Obsidian

steipete
操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。
★ 432 📥 103,783
productivity

Nano Pdf

steipete
使用nano-pdf CLI通过自然语言指令编辑PDF
★ 275 📥 114,836