$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill model-usageUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar
| 1 | # Model usage |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | TODO: add Linux CLI support guidance once CodexBar CLI install path is documented for Linux. |
| 8 | |
| 9 | ## Quick start |
| 10 | |
| 11 | 1. Fetch cost JSON via CodexBar CLI or pass a JSON file. |
| 12 | 2. Use the bundled script to summarize by model. |
| 13 | |
| 14 | ```bash |
| 15 | python {baseDir}/scripts/model_usage.py --provider codex --mode current |
| 16 | python {baseDir}/scripts/model_usage.py --provider codex --mode all |
| 17 | python {baseDir}/scripts/model_usage.py --provider claude --mode all --format json --pretty |
| 18 | ``` |
| 19 | |
| 20 | ## Current model logic |
| 21 | |
| 22 | - Uses the most recent daily row with `modelBreakdowns`. |
| 23 | - Picks the model with the highest cost in that row. |
| 24 | - Falls back to the last entry in `modelsUsed` when breakdowns are missing. |
| 25 | - Override with `--model <name>` when you need a specific model. |
| 26 | |
| 27 | ## Inputs |
| 28 | |
| 29 | - Default: runs `codexbar cost --format json --provider <codex|claude>`. |
| 30 | - File or stdin: |
| 31 | |
| 32 | ```bash |
| 33 | codexbar cost --provider codex --format json > /tmp/cost.json |
| 34 | python {baseDir}/scripts/model_usage.py --input /tmp/cost.json --mode all |
| 35 | cat /tmp/cost.json | python {baseDir}/scripts/model_usage.py --input - --mode current |
| 36 | ``` |
| 37 | |
| 38 | ## Output |
| 39 | |
| 40 | - Text (default) or JSON (`--format json --pretty`). |
| 41 | - Values are cost-only per model; tokens are not split by model in CodexBar output. |
| 42 | |
| 43 | ## References |
| 44 | |
| 45 | - Read `references/codexbar-cli.md` for CLI flags and cost JSON fields. |