Token Usage for Openclaw

A comprehensive diagnostic tool for tracking multi-agent token consumption and estimated API costs across your entire AI infrastructure.

panthrocorp
v0.2.2
Apr 9, 2026
0
855
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install panthrocorp-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 panthrocorp-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 Usage?

The Token Usage skill provides deep visibility into the resource consumption of your AI ecosystem. By dynamically discovering agents and parsing session data, it offers a comprehensive breakdown of input and output tokens, ensuring you stay informed about your operational spend. This tool is a cornerstone of the Openclaw Skills library for users who need to manage multiple agents across various platforms like Discord, Telegram, or automated cron jobs.

It goes beyond simple counting by calculating estimated USD costs and identifying usage patterns. Whether you are running a single assistant or a fleet of autonomous agents, this skill helps you maintain a lean and efficient setup by highlighting exactly where your tokens are being spent and which models are driving costs.

Token Usage Use Cases

  • Monitor total token burn across different communication channels like Discord and Telegram.
  • Identify expensive AI models that are driving up operational costs in real-time.
  • Detect token sinkholes where high volume occurs on free or untracked models without providing clear value.
  • Audit historical usage patterns using the automatically generated NDJSON reports.
  • Perform weekly or monthly cost reviews for complex multi-agent deployments.

How Token Usage Works

  1. The skill scans the local agents directory to identify all registered subdirectories representing active agents.
  2. It parses the sessions.json file for each agent, extracting critical metrics such as token counts, model identifiers, and timestamps.
  3. A time-window filter is applied to the data, defaulting to the current week unless a specific range is requested.
  4. Data is aggregated by agent and category to calculate totals for input, output, and estimated USD spend.
  5. The system automatically flags anomalies, such as Expensive categories (>$5.00) or Sinkholes (>10k tokens with no cost).
  6. Results are presented in a clear tabular format, and a structured record is appended to the long-term history file.

Token Usage Setup

To utilize this within your Openclaw Skills environment, ensure your agents are stored in the standard directory structure. The skill requires no external API keys as it processes local metadata.

# Ensure your agents have session data available in:
~/.openclaw/agents/<agent_name>/sessions/sessions.json

# Run the skill to generate a report. History is stored in:
~/.openclaw/workspace/memory/token-usage-history.ndjson

Token Usage Data Schema & Taxonomy

The skill organizes and persists data using a structured metadata taxonomy to ensure long-term trackability:

Data Point Description
Category Extracted from session keys (e.g., discord, telegram, cron, main).
Token Metrics Tracks totalTokens, inputTokens, and outputTokens per session.
Financials Calculates estimatedCostUsd based on model-specific metadata.
History Records are stored in NDJSON format for easy parsing by external tools.

Each history record includes a UTC date, the time window used, a run timestamp, and detailed nested objects for both individual agent totals and combined global metrics.

Token Usage Advanced Features

  • Automated anomaly detection that flags high-spend categories or inefficient token usage.
  • Multi-agent discovery that automatically scales as you register new agents to your system.
  • Persistent NDJSON logging designed for integration with data visualization and dashboarding tools.
  • Support for custom time-window filters ranging from 24-hour snapshots to all-time historical audits.
  • Optional Markdown report generation for human-readable summaries that can be shared with teams.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*