CodexUsage is a local macOS menu bar app for viewing Codex token usage and estimated cost.
CodexUsage 是一个本地 macOS 菜单栏应用,用来查看 Codex token 用量和估算成本。
- Reads only local Codex logs from
CODEX_HOMEor~/.codex. 仅读取CODEX_HOME或~/.codex中的本地 Codex 日志。 - Lets you choose a custom Codex path in Preferences. 可在偏好设置中指定自定义 Codex 路径。
- Shows today's usage and current-hour usage. 展示今日用量和当前小时用量。
- Skips Codex subagent session logs by default, keeping trend totals focused on user-facing Codex conversations. 默认跳过 Codex 子代理 session 日志,让趋势统计聚焦用户直接使用的 Codex 会话。
- Breaks totals down into input, cached input, output, and reasoning tokens when present. 按输入、缓存输入、输出和思考 token 拆分用量。
- Optionally shows 24-hour and 7-day trend tables, sorted from newest to oldest. 可选显示 24 小时和 7 天趋势表,并按最新到最早排序。
- Estimates known model costs locally, including standard, fast, and auto speed pricing modes. 本地估算已知模型成本,支持标准、快速和自动速度计价模式。
- Uses a titleless translucent panel that follows the system light or dark appearance. 使用无标题半透明面板,并自动适配系统亮色或暗色主题。
- Lets you adjust panel opacity in Preferences. 可在偏好设置中调整面板透明度。
- Supports English and Simplified Chinese based on system language. 根据系统语言自动显示英文或简体中文。
Download the latest CodexUsage-macOS.zip from GitHub Releases, unzip it, then open CodexUsage.app.
从 GitHub Releases 下载最新的 CodexUsage-macOS.zip,解压后打开 CodexUsage.app。
The CI build is unsigned. macOS may require you to allow the app in System Settings after first launch.
CI 构建产物未签名。首次启动时,macOS 可能需要你在系统设置中允许打开。
swift test
swift run CodexUsage./scripts/package-app.sh
open build/CodexUsage.appThe packaging script builds the release executable, generates the app icon programmatically, writes Info.plist, and produces build/CodexUsage.app.
打包脚本会构建 release 可执行文件,程序化生成 app 图标,写入 Info.plist,并输出 build/CodexUsage.app。
This repository includes .github/workflows/build.yml.
本仓库包含 .github/workflows/build.yml。
The workflow runs on GitHub-hosted macOS runners and performs:
工作流使用 GitHub 托管的 macOS runner,并执行:
swift test./scripts/package-app.sh- Zip
build/CodexUsage.app - Upload the zip as a workflow artifact
- Publish a GitHub Release with the app zip and SHA-256 checksum when a
v*tag is pushed
It runs on pushes to main, pull requests targeting main, manual workflow_dispatch runs, and v* tag pushes. Push a version tag such as v0.1.1 to publish a release automatically.
它会在推送到 main、向 main 发起 Pull Request、手动触发 workflow_dispatch、以及推送 v* 版本 tag 时运行。推送类似 v0.1.1 的版本 tag 会自动发布 GitHub Release。
CodexUsage reads local JSONL logs and does not upload usage data.
CodexUsage 只读取本地 JSONL 日志,不上传用量数据。
CodexUsage is released under the MIT License. See LICENSE.
CodexUsage 使用 MIT License 开源,详见 LICENSE。
This project is independently implemented in Swift for macOS. It is not affiliated with OpenAI or the ccusage project.
本项目是面向 macOS 的 Swift 独立实现,与 OpenAI 或 ccusage 项目没有隶属关系。
Thanks to the original ccusage project and its documentation for the local-log usage analysis model, Codex data-source behavior, token breakdown ideas, and cost-estimation references.
感谢原始 ccusage 项目及其文档提供的本地日志用量分析模型、Codex 数据源行为、token 拆分思路和成本估算参考。