model-usage

GitHub

利用CodexBar CLI获取本地成本日志,按模型汇总Codex或Claude的使用情况。支持查询当前最高成本模型或全模型明细,可输出文本或JSON格式,适用于成本分析与监控场景。

skills/model-usage/SKILL.md the-open-agent/openagent

Trigger Scenarios

查询 Codex 或 Claude 的模型级使用成本 需要脚本化解析 CodexBar 成本 JSON 以生成每模型摘要 分析 API 调用费用分布

Install

npx skills add the-open-agent/openagent --skill model-usage -g -y
More Options

Use without installing

npx skills use the-open-agent/openagent@model-usage

指定 Agent (Claude Code)

npx skills add the-open-agent/openagent --skill model-usage -a claude-code -g -y

安装 repo 全部 skill

npx skills add the-open-agent/openagent --all -g -y

预览 repo 内 skill

npx skills add the-open-agent/openagent --list

SKILL.md

Frontmatter
{
    "name": "model-usage",
    "metadata": {
        "openclaw": {
            "os": [
                "darwin"
            ],
            "emoji": "📊",
            "install": [
                {
                    "id": "brew-cask",
                    "bins": [
                        "codexbar"
                    ],
                    "kind": "brew",
                    "label": "Install CodexBar (brew cask)",
                    "formula": "steipete\/tap\/codexbar"
                }
            ],
            "requires": {
                "bins": [
                    "codexbar"
                ]
            }
        }
    },
    "description": "Use 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 cost JSON."
}

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.

TODO: add Linux CLI support guidance once CodexBar CLI install path is documented for Linux.

Quick start

  1. Fetch cost JSON via CodexBar CLI or pass a JSON file.
  2. 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 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>.
  • 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.md for CLI flags and cost JSON fields.

Version History

  • 618631e Current 2026-08-20 18:17

Same Skill Collection

skills/1password/SKILL.md
skills/apple-notes/SKILL.md
skills/apple-reminders/SKILL.md
skills/bear-notes/SKILL.md
skills/blogwatcher/SKILL.md
skills/blucli/SKILL.md
skills/bluebubbles/SKILL.md
skills/clawhub/SKILL.md
skills/discord/SKILL.md
skills/eightctl/SKILL.md
skills/gemini/SKILL.md
skills/gh-issues/SKILL.md
skills/gifgrep/SKILL.md
skills/github/SKILL.md
skills/gog/SKILL.md
skills/goplaces/SKILL.md
skills/healthcheck/SKILL.md
skills/himalaya/SKILL.md
skills/imsg/SKILL.md
skills/mcporter/SKILL.md
skills/nano-pdf/SKILL.md
skills/node-connect/SKILL.md
skills/notion/SKILL.md
skills/obsidian/SKILL.md
skills/openai-whisper-api/SKILL.md
skills/openai-whisper/SKILL.md
skills/openhue/SKILL.md
skills/oracle/SKILL.md
skills/ordercli/SKILL.md
skills/peekaboo/SKILL.md
skills/powerpoint/SKILL.md
skills/session-logs/SKILL.md
skills/sherpa-onnx-tts/SKILL.md
skills/slack/SKILL.md
skills/songsee/SKILL.md
skills/sonoscli/SKILL.md
skills/spotify-player/SKILL.md
skills/summarize/SKILL.md
skills/taskflow-inbox-triage/SKILL.md
skills/taskflow/SKILL.md
skills/things-mac/SKILL.md
skills/tmux/SKILL.md
skills/trello/SKILL.md
skills/video-frames/SKILL.md
skills/voice-call/SKILL.md
skills/wacli/SKILL.md
skills/weather/SKILL.md
skills/xurl/SKILL.md
skills/camsnap/SKILL.md

Metadata

Files
0
Version
5ede160
Hash
dbdd6e60
Indexed
2026-08-20 18:17

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 12:11
浙ICP备14020137号-1 $Carte des visiteurs$