← Back to PRs

#10973: docs: add model-level usage summary via CodexBar CLI

by rohansachinpatil open 2026-02-07 07:33 View on GitHub →
scripts stale
### Summary Adds a small utility script and documentation support for summarizing per-model usage costs using CodexBar’s local cost logs. This helps users understand: - which models are used most - per-model cost distribution - quick CLI-based usage summaries ### What’s included - New script: `scripts/model_usage.py` - Summarizes per-model costs for Codex or Claude - Uses CodexBar CLI JSON output - Designed to be simple, scriptable, and beginner-friendly - macOS-only for now (CodexBar limitation) ### Why OpenClaw users often want visibility into model usage and cost. CodexBar already exposes this data, but there was no documented or scriptable way to summarize it per model within the OpenClaw repo. ### Related issue Closes #10964 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Tweaks README onboarding blurb by splitting it into two sentences/lines for readability. - Adds `scripts/model_usage.py`, a small CLI helper that shells out to `codexbar cost --format json` and aggregates spend by model. - Intended to help OpenClaw users get a quick per-model cost breakdown using CodexBar’s local cost logs (macOS-oriented). <h3>Confidence Score: 4/5</h3> - This PR is close to mergeable, but the new script needs basic failure-mode handling to avoid crashing in common environments. - Changes are small and isolated (README wording + a standalone utility script). The main merge risk is the Python script’s current behavior of raising raw exceptions when CodexBar is missing/returns unexpected JSON types, which will frustrate users and conflicts with the stated macOS limitation. - scripts/model_usage.py <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs