Model Usage (Linux) for Openclaw

A specialized Linux utility for parsing session data to provide granular insights into AI model token usage and expenditures.

aiyouwolegequ
v1.1.0
Apr 15, 2026
0
794
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install openclaw-model-usage-linux

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 openclaw-model-usage-linux 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 Model Usage (Linux)?

Model Usage (Linux) is a performance and cost-tracking utility designed specifically for the Linux environment. It serves as a robust alternative to macOS-only tracking tools, allowing developers to maintain transparency over their AI workflows. By analyzing local session files, it provides a clear financial and technical overview of how different LLMs are utilized within an agent's lifecycle.

This skill is an essential part of the Openclaw Skills ecosystem for users who need to manage API budgets and optimize model selection based on actual consumption data. It ensures that every assistant reply and token exchange is accounted for, helping to prevent unexpected billing surprises during intensive development cycles.

Model Usage (Linux) Use Cases

  • Tracking total API expenditure across multiple AI models to stay within project budgets.
  • Analyzing token efficiency by comparing input/output ratios and cache performance.
  • Auditing session history to identify which models are the most cost-effective for specific tasks.
  • Generating structured usage reports for billing or resource allocation within a team.

How Model Usage (Linux) Works

  1. The skill identifies the session storage directory, typically located in the local Openclaw agent path.
  2. It scans the directory for JSONL files containing raw interaction data and token metadata.
  3. The script parses each entry to extract specific metrics including assistant turns, input/output tokens, and cache hits.
  4. It applies current pricing logic to calculate the total cost in USD per model.
  5. The data is aggregated and displayed in a human-readable summary or exported as a structured JSON object.

Model Usage (Linux) Setup

To start tracking your usage with this entry in your Openclaw Skills collection, run the following commands in your Linux terminal:

# Standard summary output
python3 {baseDir}/scripts/usage.py

# Output in JSON format for external processing
python3 {baseDir}/scripts/usage.py --format json

# Point to a specific sessions directory
python3 {baseDir}/scripts/usage.py --sessions-dir ~/.openclaw/agents/main/sessions

Model Usage (Linux) Data Schema & Taxonomy

The skill processes data stored in the standard Openclaw session format. Below is the organization of the parsed metadata:

Metric Description
Turns Number of successful assistant replies generated
Input Tokens Total tokens sent to the model provider
Output Tokens Total tokens received from the model provider
Cache Read/Write Performance metrics for optimized token caching
Cost (USD) Calculated financial impact based on model-specific pricing

File Source: ~/.openclaw/agents/main/sessions/*.jsonl

Model Usage (Linux) Advanced Features

  • Multi-format support allowing for either CLI tables or JSON exports for integration with other Openclaw Skills.
  • Custom directory targeting to analyze specific agent workspaces or archived session logs.
  • Comprehensive cache tracking to monitor the efficiency of prompt caching and its impact on cost reduction.
  • Headless operation capability, making it suitable for automated cron jobs or CI/CD monitoring.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*