Model Usage for Openclaw

A Python-based utility to parse CodexBar CLI data and summarize costs by specific AI models for granular budget tracking.

steipete
v1.0.0
Jan 6, 2026
114
38.2k
1.6k

Install & Download

1. ClawHub CLI

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

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

The model-usage skill is a specialized utility designed to bridge the gap between raw CodexBar cost logs and actionable per-model financial insights. By leveraging the Openclaw Skills framework, developers can programmatically extract daily usage or cumulative model breakdowns for providers like Codex and Claude, enabling tighter budget management and resource allocation. This skill ensures that users of Openclaw Skills have full visibility into which models are driving their development costs.

Model Usage Use Cases

  • Tracking daily spend for specific LLM models like GPT-4 or Claude 3.5 Sonnet.
  • Identifying the most expensive model in a multi-model development workflow.
  • Exporting cost data as JSON for integration into custom reporting dashboards.
  • Auditing AI usage via scriptable CLI commands within the Openclaw Skills ecosystem.

How Model Usage Works

  1. The skill triggers a call to the CodexBar CLI to fetch local cost logs in a structured JSON format.
  2. It executes a bundled Python script to parse the modelBreakdowns or modelsUsed fields from the input.
  3. The logic identifies the most recent daily entry or iterates through all historical data depending on the selected mode.
  4. It calculates the total cost per model, prioritizing specific breakdowns where available and falling back to model lists when necessary.
  5. The final summary is presented in either a human-readable text format or a machine-parseable JSON object for further Openclaw Skills automation.

Model Usage Setup

First, ensure CodexBar is installed on your system. Currently, this skill supports macOS via Homebrew:

brew tap steipete/tap
brew install --cask codexbar

Once installed, you can run the model usage script from your Openclaw Skills directory:

# Example: Get a full breakdown for Claude
python scripts/model_usage.py --provider claude --mode all --format json --pretty

Model Usage Data Schema & Taxonomy

The skill processes JSON data generated by CodexBar. The primary data structure includes:

Field Description
provider The AI provider being tracked (codex or claude).
modelBreakdowns An object containing specific cost data mapped to model names.
modelsUsed A fallback list of models used when granular breakdowns are missing.
cost The numerical financial value representing the total spend for that entry.

Model Usage Advanced Features

  • Smart fallback logic that automatically detects the current model based on the highest cost in the latest daily row.
  • Support for piped input via stdin, allowing complex shell pipelines within Openclaw Skills workflows.
  • Configurable output formats including raw text and pretty-printed JSON for developer convenience.
  • Multi-provider support covering both Codex and Claude usage data seamlessly.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*