Community程式設計與開發github.com

模型用量分析

彙整 CodexBar 本地費用日誌,按模型分類摘要,支援目前模型或完整明細。

模型用量分析 是什麼?

此技能用於分析 CodexBar 的本地費用日誌,根據不同 AI 提供者(如 Codex 或 Claude)提供按模型分類的費用摘要。它能擷取最新日誌中的「目前模型」費用,或列出所有模型的完整費用明細。技能依賴 CodexBar CLI 來取得即時資料,若 CLI 無法使用,也可透過 `--input` 參數匯入 CodexBar 匯出的 JSON 檔案。支援 macOS 與 Linux 平台,並可透過 Homebrew 或 AUR 套件安裝 CodexBar。輸出格式預設為純文字,也可指定 JSON 格式以利程式處理。此技能對於掌握 API 花費分佈、辨識高成本模型、以及最佳化 LLM 使用策略非常有幫助。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/model-usage

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

模型用量分析 是做什麼的?

概述

從 CodexBar 的本地費用日誌中取得每個模型的用量費用。支援「目前模型」(最新日誌項目)或「所有模型」的摘要,適用於 Codex 或 Claude。

CodexBar 提供 macOS 和 Linux 的 CLI 版本。當 codexbar 在 PATH 環境變數中時,技能可直接讀取本地用量;內建的 Python 摘要工具也可透過 --input 接受匯出的 CodexBar JSON 檔案,在任何可執行 Python 的環境中使用。

快速開始

  1. 透過 CodexBar CLI 取得費用 JSON,或傳入 JSON 檔案。
  2. 使用內建腳本按模型進行摘要。
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

目前模型邏輯

  • 使用最近一筆包含 modelBreakdowns 的日記帳列。
  • 選取該列中成本最高的模型。
  • 若缺少明細,則使用 modelsUsed 中的最後一個項目。
  • 當你需要指定特定模型時,可使用 --model <name> 覆寫。

輸入方式

  • 預設:執行 codexbar cost --format json --provider <codex|claude>。
  • macOS 和 Linux:使用上述內建的 Homebrew 安裝方式進行即時本地用量讀取。Linux 使用者也可使用 CodexBar 的 AUR 套件 或官方發行版壓縮檔。
  • 其他平台:使用 --input 並提供匯出的 CodexBar JSON。
  • 檔案或標準輸入:
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

輸出

  • 文字(預設)或 JSON(使用 --format json --pretty)。
  • 數值僅為每個模型的費用;CodexBar 輸出中未按模型拆分 Token 數量。

參考資料

  • 請參閱 references/codexbar-cli.md 了解 CLI 旗標與費用 JSON 欄位。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相關技能