{"id":51156099,"url":"https://github.com/channingyuan/usagebar","last_synced_at":"2026-06-26T11:00:26.994Z","repository":{"id":362510602,"uuid":"1257142330","full_name":"ChanningYuan/usageBar","owner":"ChanningYuan","description":"macOS 菜单栏工具，聚合显示多个 AI 编程/Agent工具（Claude Code / Codex / Cursor / Qoder / 悟空/ Workbuddy 等）的 token 用量，全本地直读零配置","archived":false,"fork":false,"pushed_at":"2026-06-25T03:30:13.000Z","size":14473,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-25T05:12:20.336Z","etag":null,"topics":["ai-coding","claude-code","codex","cursor","macos","menubar","openclaw","qoder","swift","token","token-usage","workbuddy","wukong"],"latest_commit_sha":null,"homepage":"https://github.com/ChanningYuan/usageBar","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChanningYuan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-02T12:02:06.000Z","updated_at":"2026-06-25T03:30:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ChanningYuan/usageBar","commit_stats":null,"previous_names":["channingyuan/usagebar"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ChanningYuan/usageBar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanningYuan%2FusageBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanningYuan%2FusageBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanningYuan%2FusageBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanningYuan%2FusageBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChanningYuan","download_url":"https://codeload.github.com/ChanningYuan/usageBar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanningYuan%2FusageBar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34813782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-coding","claude-code","codex","cursor","macos","menubar","openclaw","qoder","swift","token","token-usage","workbuddy","wukong"],"created_at":"2026-06-26T11:00:18.450Z","updated_at":"2026-06-26T11:00:26.979Z","avatar_url":"https://github.com/ChanningYuan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# usageBar\n\n\u003e macOS 菜单栏工具，聚合显示多个 AI 编程工具（Claude Code / Codex / Qoder / 悟空 等）的 token 用量，全本地直读、零配置。\n\n**Swift 6 · macOS 14+ · Apple Silicon**\n\n在 macOS 状态栏一眼看到你今天 / 近 7 天 / 近 30 天 / 累计在各个 AI 编程工具上烧了多少 token。除 Cursor 外，所有数据都从各工具落在本地的会话记录（jsonl / SQLite）直接读取，**不联网、不抓包、装上即用**。\n\n\u003e 🥇 **GitHub 上唯一一个把 Qoder 全家桶（CLI / Work / IDE）token 全部打通可计量的项目。** 三条产品线各自落盘的格式完全不同（npm transcript jsonl / 应用日志 mirror / SQLite），usageBar 把它们统一读出来，一个菜单栏就能看全。\n\n\u003cimg src=\"assets/screenshot.png\" alt=\"usageBar 效果图\" width=\"420\"\u003e\n\n## 支持的 Provider\n\n| Provider | 数据源 | 说明 |\n|---|---|---|\n| Claude Code（订阅） | `~/.claude/projects/**/*.jsonl` | 按 `message.id` 前缀 `msg_01` 识别 Anthropic 直连 |\n| Claude Code（API） | 同上 | `msg_vrtx_` / `msg_bdrk_` 前缀（Vertex / Bedrock 代理） |\n| **Qoder（CLI）** 🥇 | `~/.qoder/projects/**/*.jsonl` | npm `qodercli` 1.0.x+ transcript，完整 4 列 |\n| **Qoder（Work）** 🥇 | `~/Library/Application Support/QoderWork/logs/\u003cts\u003e/main.log` | 增量 mirror 到本地 jsonl，精确 input/output 两列 |\n| **Qoder（IDE）** 🥇 | `~/Library/Application Support/Qoder/SharedClientCache/.../local.db` | 直读 SQLite `chat_message.token_info` |\n| Codex（OpenAI） | rollout jsonl | **累计值**，跨窗口做差分 |\n| 悟空 | 本地 jsonl | flat 结构，毫秒时间戳 |\n| WorkBuddy | `~/.workbuddy/projects/**/*.jsonl` | Claude Code 风格会话记录 |\n| Cursor | Cursor 服务端 API | ⚠️ **唯一联网** provider（本地无真实 token，必须联网拉取） |\n| OpenClaw | 本地（mtime 增量） | 社区个人 AI Agent |\n| Hermes | `~/.hermes/state.db` | Hermes Agent（NousResearch），SQLite |\n\n\u003e 🥇 标记的三行 = **Qoder 全家桶**：CLI、Work、IDE 三条线全部覆盖，目前 GitHub 上仅此一家做到全部可计量。\n\u003e\n\u003e 各工具的 \"token\" 口径不完全一致（有的含 cache 拆分、有的只有 input/output），所以条形图长度是**量级参考**，不是严格同口径对比。\n\n状态栏右键 → 偏好设置，可自定义每个 provider 的可见性。\n\n## 技术亮点\n\n- **Codex 跨窗口差分**：Codex 的 rollout 是 session 累计值，按相邻事件差分归到日期桶，避免跨天 session 被重复计算（否则会虚报十几倍）。\n- **持久账本**：会话文件被删 / 轮转后，其历史 token 仍计入累计——消耗发生过就保留，不会因源文件消失而丢失。\n- **mtime/size 增量缓存**：只重读发生变化的文件，刷新快、CPU 占用低。\n\n## 安装\n\n### 给人类：下载即用\n\n\u003e 仅支持 **Apple Silicon（M1/M2/M3/M4）**，暂无 Intel 版本。\n\n1. 到 [Releases](../../releases) 下载 **`usageBar.dmg`**\n2. 双击打开，把 `usageBar.app` **拖进 Applications 文件夹**\n\n\u003e ✅ 已做 Apple **Developer ID 签名 + 公证**，双击即开，无需任何额外放行步骤。\n\u003e （也提供 `usageBar.zip`：解压出 `.app` 拖进 `/Applications`，效果相同。）\n\n### 给 AI Agent：让它帮你装\n\n1. 到 [Releases](../../releases) 下载 `install-usagebar.zip`\n2. 解压到 AI Agent 的 skill 目录，例如 Claude Code：`~/.claude/skills/install-usagebar/`\n3. 跟 AI 说\"装一下 usageBar\"，它会自动跑 `scripts/install.sh`（解压 .app → 清 Gatekeeper 隔离 → 拷到 `/Applications` → 启动）\n\n诊断 / 卸载等更多用法见 [`install-usagebar/README.md`](install-usagebar/README.md)。\n\n\u003e 🔄 **自动更新**：0.2.0 起内置 Sparkle——装好后会自动检查新版并提示一键升级，右键菜单也有\"检查更新…\"。\n\n## 工程结构\n\n```\nusageBar/\n├── app/                       SwiftPM 工程\n│   ├── Package.swift\n│   ├── Sources/\n│   │   ├── usageBar/          主 App：NSStatusItem + SwiftUI popover\n│   │   ├── usageBarCore/      协议层：Provider 协议 + 数据模型 + 增量缓存\n│   │   └── usageBarProviders/ 各 provider 实现\n│   └── Scripts/               打包脚本\n├── icon/                      App 图标资源\n└── install-usagebar/          安装 / 诊断 / 卸载 skill\n```\n\n## 自己构建 / 审计代码\n\nusageBar 会读取你本地 AI 工具的会话数据。虽然发布版已做 Developer ID 签名 + 公证，但如果你想彻底放心，可以自己 clone 下来构建、审计源码：`cd app \u0026\u0026 swift build`，详见 [`app/SETUP.md`](app/SETUP.md)。\n\n## 反馈 \u0026 支持\n\n- 有 bug、想法或想要的功能，欢迎提 [Issue](../../issues)。\n- 如果 usageBar 帮到了你，**点个 Star ⭐ 就是最好的支持**。\n\n## License\n\n[MIT](LICENSE) © ChanningYuan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanningyuan%2Fusagebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchanningyuan%2Fusagebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanningyuan%2Fusagebar/lists"}