Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

model-usage — Claude skill: per-model cost breakdowns

Reads CodexBar local cost logs and breaks spending down by model for Codex or Claude. Useful when you want to see where the money goes.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add openclaw/openclaw --skill model-usage -a claude-code
Open on GitHub

What model-usage does

The skill pulls per-model cost from CodexBar's local logs. Two modes: current, which uses the most recent daily entry, and all, which covers every model. Both Codex and Claude are supported.

The work happens in scripts/model_usage.py. By default it runs codexbar cost --format json --provider , but you can hand it an exported JSON file through --input or stdin instead. For current, it takes the latest daily row with modelBreakdowns and picks the model with the highest cost there; if breakdowns are missing it falls back to the last entry in modelsUsed. Pass --model to target one model.

Live reads need codexbar on PATH, and CLI builds ship for macOS and Linux. Everywhere else, use --input with exported JSON — Python is enough. One caveat: CodexBar reports cost only, tokens are not split by model. If you don't track per-model spend, skip this one.

What it helps with

  • see which model cost the most in the latest daily entry
  • compare cost across all models for a period
  • export the breakdown as JSON for a report
  • check spending for one model with --model
  • read CodexBar logs on a machine without the live CLI

Example prompts for the agent

  • Show today's per-model cost: python {baseDir}/scripts/model_usage.py --provider codex --mode current
  • Give me the full Claude breakdown as JSON: python {baseDir}/scripts/model_usage.py --provider claude --mode all --format json --pretty
  • Summarize this log file: python {baseDir}/scripts/model_usage.py --input /tmp/cost.json --mode all

How to install model-usage

1Skills CLI (Vercel)

npx skills add openclaw/openclaw --skill model-usage -a claude-code

2Manually: put the files in place

~/.claude/skills/model-usage/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/model-usage/

From the same set45

The whole set →
summarize openclaw Runs a CLI tool to summarize or transcribe web articles, YouTube videos, podcasts, and local PDF documents directly within your AI assistant. Claude Code CX Codex Cursor +1 26,900installs weather openclaw This skill fetches current conditions and forecasts for a city, region, airport code, or coordinates. Use it to check rain and temperature or plan a trip. Claude Code CX Codex Cursor +1 9,300installs gog openclaw Guides an agent using the gog CLI for Gmail, Calendar, Drive, Contacts, Sheets, and Docs. Use it when Google Workspace tasks need to run from a terminal. Claude Code CX Codex Cursor +1 8,500installs tmux openclaw Lets an agent work with live tmux sessions: read pane output, send keys and text, wait for a prompt line to show up. Claude Code CX Codex Cursor +1 8,400installs openai-whisper openclaw This skill lets your agent call the Whisper CLI to transcribe audio on your own machine. No API key needed. Claude Code CX Codex Cursor +1 7,100installs nano-pdf openclaw Edit PDF pages with plain text instructions through the nano-pdf CLI. Useful when you need to fix a typo or swap a heading without leaving your terminal. Claude Code CX Codex Cursor +1 7,100installs skill-creator openclaw A skill for writing, repairing and reviewing other skills. It splits behaviour into branches, sets the frontmatter and sorts resources into folders. Useful once your skill folder gets crowded. Claude Code CX Codex Cursor +1 6,700installs coding-agent openclaw This skill sends large coding tasks to Codex, Claude Code, or OpenCode as background workers. Use it for refactors, PR reviews, and issue-to-PR work. Claude Code CX Codex Cursor +1 6,500installs

Similar

gemini-api-dev official google-gemini Guides coding agents to write Gemini API code in Python and TypeScript using current SDKs, interaction endpoints, and active models. Claude Code CX Codex Cursor +1 25,100installs hindsight-docs vectorize-io This skill gives AI agents Hindsight documentation for architecture, APIs, configuration, and SDKs. Use it when adding Hindsight memory to an agent. Claude Code CX Codex Cursor +1 9,100installs skill-creator official anthropics Creates and refines skills, then tests them with prompts, evaluations, and performance checks. Claude Code Claude.ai 414,180installs writing-for-agents Matt Pocock Guidance for writing skills and agent-facing documents. Use it when editing AGENTS.md, CLAUDE.md, or reference files reached from them. Claude Code 466,719installs media-use heygen-com Finds or generates media for HyperFrames videos, including voiceovers, music, cutouts, and color grades. Stores files locally in assets. Claude Code CX Codex Cursor +1 1,100,000installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. Claude Code Claude.ai 130,949installs subagent-driven-development Jesse Vincent This skill runs an implementation plan through fresh subagents for independent tasks and reviews each result. Use it for multi-step work in one session. Claude Code CX Codex 237,746installs orchestration stablyai Coordinates supervised Orca workers with task DAGs, decision gates, and threaded messages. Fits workflows that split work across multiple agents. Claude Code CX Codex Cursor +1 349,200installs

Questions about model-usage

How do I install model-usage in Claude?

Run npx skills add openclaw/openclaw --skill model-usage -a claude-code. The skill lands at ~/.claude/skills/model-usage/SKILL.md.

What does model-usage do?

It summarizes CodexBar's local cost logs by model for Codex or Claude. Current mode covers the latest daily entry, all mode covers every model.

What do I need to run it?

For live reads, codexbar on PATH (macOS and Linux). On other platforms, pass exported JSON with --input — Python is all you need.

Source text

SKILL.md · MIT
---
name: model-usage
description: "Summarize CodexBar local cost logs by model for Codex or Claude, including current or full breakdowns."
metadata:
  {
    "openclaw":
      {
        "emoji": "📊",
        "os": ["darwin", "linux"],
        "requires": { "bins": ["codexbar"] },
        "install":
          [
            {
              "id": "brew-cask",
              "kind": "brew",
              "formula": "steipete/tap/codexbar",
              "bins": ["codexbar"],
              "label": "Install CodexBar CLI (Homebrew)",
            },
          ],
      },
  }
---

# Model 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

1. Fetch cost JSON via CodexBar CLI or pass a JSON file.
2. Use the bundled script to summarize by model.

```bash
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 `modelsUsed` when 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](https://aur.archlinux.org/packages/codexbar-cli) or [official release tarballs](https://github.com/steipete/CodexBar/releases).
- Other platforms: use `--input` with exported CodexBar JSON.
- File or stdin:

```bash
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.md` for CLI flags and cost JSON fields.

© openclaw · MIT · openclaw/openclaw

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor