Token Audit for Openclaw

A free, zero-dependency token consumption and cost analyzer that scans OpenClaw agent workspaces across 6 major language models.

justincredible-tech
v0.2.0
Feb 27, 2026
1
715
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install token-audit

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-audit 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 Audit?

The Token Audit skill is a powerful, open-source utility designed specifically for OpenClaw developers and operators who need to gain clear visibility into their LLM token usage. It scans workspace files and provides accurate token estimations across six major model families: GPT-4, Claude 3, Gemini, Llama 3, Mistral, and Qwen. By surfacing critical data regarding hidden cost drivers, this skill helps developers pinpoint bloated context, redundant files, and massive optimization opportunities.

Operating with zero external dependencies and requiring no API keys, this skill functions as a privacy-centric, standalone script. It ensures that you understand exactly how your data footprints map to token metrics and commercial hosting costs before sending payloads to LLM providers, effectively extending the lifetime and budget of your automated workflows.

Token Audit Use Cases

  • Optimizing Agent Budgets: Identifying high-cost files within an agent workspace before launching large-scale automated tasks.
  • Context Window Management: Preventing context overflow errors by auditing token counts across different LLM backends prior to execution.
  • Workspace Clean-up: Discovering redundant or disproportionately large files that consume massive token counts relative to their developmental utility.
  • CI/CD Quality Gates: Integrating token and cost estimation checks into local repository hooks to maintain lean codebases.

How Token Audit Works

  1. Workspace Scanning: The script targets either the default OpenClaw workspace directory or a user-defined custom path.
  2. Token Estimation: It processes every valid file in the workspace, evaluating token lengths tailored to tokenization characteristics across six major LLM providers.
  3. Cost Projection: The script applies current pricing models to the estimated token counts, generating clear financial projections per model.
  4. Report Generation: It surfaces recommendations, identifying files that are disproportionately large, and outputs the final metrics in human-readable terminal format or machine-readable JSON.

Token Audit Setup

To start using the Token Audit skill within your environment, run the script from your terminal. No external packages or API keys are required.

Scan the Default Workspace

python3 scripts/token-audit.py

Scan a Target Path

python3 scripts/token-audit.py --workspace /path/to/workspace

Export Data as JSON

python3 scripts/token-audit.py --json

Token Audit Data Schema & Taxonomy

The skill processes your local file layout and generates analytical metrics structured around the following categories:

Data Point Description
Total Token Count Consolidated token count across all scanned files, customized per model family.
Per-File Breakdown An ordered list of files, sorted descending by token size, to quickly locate content bloat.
Cost Estimation Projected financial cost metrics computed for GPT-4, Claude 3, Gemini, Llama 3, Mistral, and Qwen.
Optimization Flags Actionable recommendations pointing out files that have unusually high token costs vs expected value.

Token Audit Advanced Features

  • Multi-Model Parity: Provides concurrent token calculations across six distinct provider specifications in a single execution sweep.
  • Structured JSON Engine: Emits fully structured JSON payloads using the --json flag, making it seamless to integrate into automated developer dashboards, CI/CD pipelines, or custom scripting pipelines.
  • Caelguard Ecosystem Compatibility: Operates natively alongside other Openclaw Skills and security tools like shellguard-scanner to establish comprehensive local safety gates.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*