Token Monitor for Openclaw

An AI token tracking and optimization tool that monitors session logs to prevent unexpected costs and agent inefficiencies.

freedompixels
v1.0.2
Apr 15, 2026
0
853
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install ai-token-usage

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install ai-token-usage using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Token Monitor?

Token Monitor is a specialized diagnostic tool designed to provide full visibility into LLM token consumption patterns. By parsing session logs, it allows developers to understand exactly how their AI agents are utilizing resources, making it a critical component within the Openclaw Skills library for cost management.

The skill goes beyond simple counting by analyzing the root causes of token spikes, such as browser snapshot inefficiencies or repeated failure loops. It empowers users to maintain budget control while ensuring their AI agents operate at peak performance without wasting expensive context window space.

Token Monitor Use Cases

  • Tracking real-time AI operational costs to prevent budget overruns.
  • Identifying infinite loops or repeated execution failures that drain tokens.
  • Auditing browser snapshot usage to optimize data compression strategies.
  • Generating daily and hourly trend reports for long-term project resource planning.

How Token Monitor Works

  1. The skill monitors session log files stored in the agent's session directory in real-time.
  2. It parses the JSONL log entries to extract input and output token metrics for every LLM call.
  3. The data is compared against predefined anomaly thresholds to flag excessive usage or potential bugs.
  4. It evaluates specific triggers like Chrome CDP crashes or rate-limiting events to identify the source of waste.
  5. Actionable optimization suggestions are generated based on the detected usage patterns.
  6. Summarized statistics are saved to structured JSON files for historical comparison and reporting.

Token Monitor Setup

To begin monitoring your AI usage with this specific implementation of Openclaw Skills, use the following commands:

# Check today's token consumption
python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --today

# Check for anomalies in recent sessions
python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --check-anomaly

# Generate a full optimization report
python3 ~/.qclaw/skills/token-monitor/scripts/token_stats.py --report

Token Monitor Data Schema & Taxonomy

The skill organizes its monitoring data and findings using the following structure:

Data Type Storage Path Description
Raw Session Logs ~/.qclaw/agents/main/sessions/*.jsonl The source input files containing raw token data
Daily Statistics memory/token-usage-YYYY-MM-DD.json Processed daily totals and status flags
Anomaly Rules Internal Configuration Thresholds for daily (10M+), hourly (2M+), and retry limits

Token Monitor Advanced Features

  • Intelligent anomaly detection that identifies severe over-limit usage and repeated failures.
  • Optimization library providing specific advice such as using compact=true for browser snapshots.
  • Detailed historical tracking to pinpoint specific days of high waste and their root causes.
  • Automated reporting capabilities to summarize input/output ratios and total token costs.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*