LLM Usage Aggregator for Openclaw

A Python-based CLI tool to aggregate LLM execution logs, distinguish internal/external users, and compute detailed multi-dimensional costs.

no7dw
v0.1.0
Jun 23, 2026
0
355
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install llm-usage-aggregator

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 llm-usage-aggregator 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 LLM Usage Aggregator?

The LLM Usage Aggregator is a robust utility designed to consolidate scattered LLM call logs from raw CSV files into structured, multi-dimensional Excel reports. By mapping model identifiers against a unified configuration schema (pricing_config.json), it accurately computes execution costs across diverse modalities including text, image, and video models.

This utility is a vital component of the Openclaw Skills ecosystem, offering teams transparent visibility into token consumption, image counts, and video generation times. It enables precise accounting of internal development versus external client usage to optimize API spend.

LLM Usage Aggregator Use Cases

  • Aggregating messy raw CSV logs containing LLM invocation streams into clean, report-ready formats.
  • Distinguishing between internal developer usage and client/external customer queries based on email domains.
  • Tracking and auditing specific LLM performance and consumption metrics like prompt tokens, completion tokens, image generations, and video processing duration.
  • Computing complex pricing rules for text tokens, static images, and variable-length audio/video outputs using unified model aliases.

How LLM Usage Aggregator Works

  1. Log Parsing: The tool accepts a CSV path and loads the usage logs, instantly resolving user identities using emails (falling back to phone numbers when emails are missing).
  2. User Segmentation: It scans email patterns to classify users as internal (matching domains like footprint, maybe, or fastest) or external.
  3. Pricing Calibration: It references pricing_config.json to map raw model names to simplified aliases and identify their pricing type (per-million tokens, per-image, or per-second video rates).
  4. Data Validation: Running pre-checks ensures no unconfigured models, invalid pricing schemas, or missing media dimensions slip through.
  5. Aggregation & Calculation: The engine aggregates totals and calculates exact USD costs across four major dimensions: user groups, platforms, specific models, and individual users.
  6. Excel Export: The system writes a single-sheet Excel report with four vertically stacked tables, each complete with automated totals.

LLM Usage Aggregator Setup

Ensure you have Python 3.x and pandas/openpyxl installed. Execute the command below using Openclaw Skills environment pathways:

python scripts/aggregate_llm_usage.py <csv_path> [output_path] [pricing_config_path]

LLM Usage Aggregator Data Schema & Taxonomy

Expected CSV Input Fields

Field Name Status Description
email or phone Required Unique user identifier
llm_provider Required Hosting provider of the model
llm_model Required Raw model identifier (e.g., z-ai/glm-5v-turbo)
prompt_tokens Optional Number of input tokens
completion_tokens Optional Number of output tokens
generated_image_count Optional Number of images generated
duration_seconds Optional Duration of video generation in seconds
generation_type Optional Class of output (image, video, or empty)
generate_audio Optional Boolean flag for video audio generation

Output Sheet Structure

The resulting Excel sheet contains four distinct tables structured sequentially:

  1. By User Type: Totals segmenting Internal vs. External usage.
  2. By Provider: Aggregations for each llm_provider.
  3. By Model: Usage broken down per llm_model alias.
  4. By User: Detailed consumption per individual email/phone index.

LLM Usage Aggregator Advanced Features

  • Multi-Modal Pricing Models: Handles complex video pricing, auto-detecting audio streams to differentiate higher-priced with-audio generation versus basic video rendering.
  • Model Aliasing: Automatically normalizes diverse model names (e.g., OpenRouter, Tokenhot, or Fal.ai endpoints) to streamlined, unified keys for aggregate accuracy.
  • Comprehensive Pre-Flight Validation: Instantly logs anomalies such as unconfigured models, pricing mismatches, and text execution rows calculating to 0 USD cost to the console before finalizing output.
  • Extensible Configuration: Seamlessly integrates with shared configurations within the Openclaw Skills suite, supporting newly added cutting-edge models like Kling v3, GLM 5V Turbo, and Doubao.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*