
Model Usage
FreeSummarize Codex and Claude model costs efficiently.
Free · Opens the source repo
What Model Usage does
The Model Usage skill provides developers and data analysts with a streamlined way to summarize usage costs from CodexBar's local cost logs. This skill supports both the most recent daily entry and comprehensive summaries for the Codex and Claude models. By leveraging the CodexBar CLI, users can easily fetch cost data and analyze it without needing to manually parse logs. The bundled Python script simplifies the process of extracting and summarizing this data, making it accessible to users on macOS and Linux systems.
To get started, users can fetch the cost JSON via the CodexBar CLI or directly pass a JSON file to the provided script. The skill allows for flexible input options, including reading directly from CodexBar's output or using exported JSON files. The output can be formatted as plain text or JSON, catering to different user preferences and workflows. This versatility ensures that users can integrate the skill into their existing processes seamlessly.
This skill is particularly beneficial for teams and individuals who rely heavily on Codex or Claude for development tasks and need to monitor their usage costs effectively. By providing insights into which models incur the highest costs, users can make informed decisions about resource allocation and optimize their usage of these AI models. The skill's straightforward command-line interface makes it easy to implement, even for those who may not be deeply familiar with scripting or data analysis.
Overall, the Model Usage skill is a practical tool for anyone looking to gain insights into their AI model usage costs, helping to enhance productivity and cost management in development environments.
When to use it
Use this skill when you need to summarize and analyze model usage costs from CodexBar logs.
When not to use it
This skill may not be suitable if you require detailed token-level breakdowns or support for platforms outside macOS and Linux.
What you can build with it
Daily Cost Summary
Quickly summarize the daily usage costs for the most recent model entry using the provided script.
Comprehensive Cost Analysis
Generate a full breakdown of costs across all models to identify usage patterns and optimize resource allocation.
Integration with CI/CD
Incorporate the skill into your CI/CD pipeline to automatically monitor and report on AI model costs.
How to install Model Usage
View source1. Install with the skills CLI
npx skills add openclaw/openclaw/model-usage --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by openclawModel usage
Overview
Get per-model usage cost from CodexBar's local cost logs. Supports "current model" (most recent daily entry) or "all models" summaries for Codex or Claude.
CodexBar ships CLI builds for macOS and Linux. When codexbar is on PATH, the skill reads local usage directly; the bundled Python summarizer also accepts exported CodexBar JSON through --input anywhere Python is available.
Quick start
- Fetch cost JSON via CodexBar CLI or pass a JSON file.
- Use the bundled script to summarize by model.
python {baseDir}/scripts/model_usage.py --provider codex --mode current
python {baseDir}/scripts/model_usage.py --provider codex --mode all
python {baseDir}/scripts/model_usage.py --provider claude --mode all --format json --pretty
Current model logic
- Uses the most recent daily row with
modelBreakdowns. - Picks the model with the highest cost in that row.
- Falls back to the last entry in
modelsUsedwhen breakdowns are missing. - Override with
--model <name>when you need a specific model.
Inputs
- Default: runs
codexbar cost --format json --provider <codex|claude>. - macOS and Linux: use the bundled Homebrew formula installer above for live local usage reads. Linux users can also use CodexBar's AUR package or official release tarballs.
- Other platforms: use
--inputwith exported CodexBar JSON. - File or stdin:
codexbar cost --provider codex --format json > /tmp/cost.json
python {baseDir}/scripts/model_usage.py --input /tmp/cost.json --mode all
cat /tmp/cost.json | python {baseDir}/scripts/model_usage.py --input - --mode current
Output
- Text (default) or JSON (
--format json --pretty). - Values are cost-only per model; tokens are not split by model in CodexBar output.
References
- Read
references/codexbar-cli.mdfor CLI flags and cost JSON fields.
Frequently asked questions about Model Usage
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
