Community编程与开发github.com

模型用量统计

汇总 CodexBar 本地的成本日志,按模型分组(Codex 或 Claude),支持当前模型或完整模型的费用明细。

模型用量统计 是什么?

该技能用于从 CodexBar 的本地成本日志中获取每个模型的使用费用。支持查询“当前模型”(即最近一天的记录)或“所有模型”的汇总信息,适用于 Codex 和 Claude 两种提供商。技能核心是一个 Python 脚本,它可以直接调用 CodexBar CLI 获取实时数据,也可以通过 `--input` 参数接受导出的 CodexBar JSON 文件。脚本会根据传入的提供商类型(`--provider`)和模式(`--mode`)生成按模型分组的成本分析报告。输出格式支持纯文本和 JSON,便于与其他工具集成。当前模型的判定逻辑为:选取最近且包含模型细分的每日记录行,从中选择成本最高的模型;若缺少细分数据则回退到 `modelsUsed` 列表的最后一项,也可通过 `--model` 参数手动指定。该技能在 macOS 和 Linux 上通过 Homebrew 安装的 CodexBar CLI 直接运行,其他平台可借助导出的 JSON 文件使用。

兼容平台✓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 <名称> 覆盖。

输入

  • 默认:运行 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 输出中令牌未按模型拆分。

参考

  • 阅读 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, 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 when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

相关技能