Usage Tracker for Openclaw

A comprehensive token monitoring and budget management system designed to track AI agent consumption and operational costs.

xhmqq616
v1.0.0
Apr 6, 2026
0
810
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install token-usage-tracker

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 token-usage-tracker 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 Usage Tracker?

Usage Tracker is a critical utility within the Openclaw Skills ecosystem that provides developers and users with full transparency regarding their LLM resource consumption. It records input and output tokens for every conversation turn, calculates cumulative statistics, and offers real-time budget control to prevent unexpected API costs. By integrating this skill, you can ensure your AI-driven workflows remain cost-effective and efficient through detailed usage analytics and automated limit warnings.

Usage Tracker Use Cases

  • Monitoring real-time token consumption during complex AI agent development cycles.
  • Estimating API costs for models like Claude 3.5 Sonnet or Opus in Openclaw Skills.
  • Setting automated budget alerts to notify users when token limits are approaching a warning threshold.
  • Analyzing conversation turn efficiency to optimize long-context prompts.
  • Managing resource allocation for multi-user AI environments or shared API keys.

How Usage Tracker Works

  1. Initialize the UsageTracker class with your specific budget constraints and warning thresholds.
  2. Capture token metadata (input, output, and cache info) after each interaction with the AI model.
  3. The system records the turn usage including a timestamp and the associated prompt context.
  4. Cumulative statistics are updated to track totals, averages per turn, and percentage of budget used.
  5. The tracker performs a budget check to identify if thresholds have been exceeded and can trigger custom callbacks for limit management.

Usage Tracker Setup

To integrate this into your environment, ensure you have the core script in your local directory:

# Check the file structure
ls usage-tracker/scripts/usage-tracker.mjs

Initialize the tracker in your JavaScript or Node.js environment:

const { UsageTracker } = require('./scripts/usage-tracker.mjs');

const tracker = new UsageTracker({
  maxTotalTokens: 50000,
  warningThreshold: 0.8
});

Usage Tracker Data Schema & Taxonomy

The skill organizes usage data using the following taxonomy to ensure clarity within Openclaw Skills:

Property Description
input_tokens The number of tokens sent to the model
output_tokens The number of tokens generated by the model
cache_read_input_tokens Tokens saved through context caching mechanisms
total_tokens Combined count of all tokens used in a session
budgetUsedPercent Percentage of the defined token limit currently consumed
estimatedCost Projected cost based on active model pricing tiers

Usage Tracker Advanced Features

  • Local token estimation algorithm for Chinese and English characters that works without external API calls.
  • Support for tracking cache creation and cache reads to optimize performance for high-context tasks.
  • Customizable onBudgetExceeded hooks for automated process termination or user alerts.
  • Historical tracking of conversation rounds to audit AI behavior and efficiency trends.
  • Multi-model pricing support to estimate costs across different Claude versions within Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*