openusage README

The project's README from github.com/robinebers/openusage. As one markdown file: README.md.

OpenUsage

Track your AI coding subscriptions from the macOS menu bar — native Swift edition.

OpenUsage shows how much of your AI coding plans you've used: session and weekly limits, credits, and spend, all in one popover. Pin your most important metrics straight into the menu bar.

OpenUsage menu bar tracker showing Claude and Codex session, weekly, and spend usage

Installation

Homebrew:

brew install --cask openusage

Direct download: grab the latest universal DMG from the releases page, open it, and drag OpenUsage to your Applications folder.

Either way, the app updates itself in place via signed, notarized Sparkle updates. Requires macOS 15 (Sequoia) or later.

Supported Providers

Most providers read the credentials already on your machine (keychain, auth files, app state) — no extra login. OpenRouter and Z.ai are the exceptions: they have no local credential to reuse, so you supply an API key (see OpenRouter setup or Z.ai setup). Credentials are used only for the corresponding provider requests. OpenUsage's separate anonymous summaries and public pricing downloads are documented under Privacy & usage data.

Features

Documentation

Behavior docs live in docs/: the dashboard, menu bar pins, settings, refresh & caching, the CLI, the local HTTP API, the proxy, and one page per provider.

For working on the code, see the developer docs: architecture, adding a provider, and debugging & capturing logs.

Requirements

The Today / Yesterday / Last 30 Days spend tiles are computed natively from local CLI logs (Claude, Codex, and Grok) or Cursor's usage export — no Node.js or other runtime needed. Dollars are estimated with dynamically refreshed model pricing.

Building

swift build            # debug build
swift test             # run the test suite
./script/build_and_run.sh   # build and launch the dev app from dist/ (no install)

Architecture

SwiftPM package, SwiftUI content hosted in an AppKit-owned NSStatusItem + custom key-capable NSPanel, Swift 6 strict concurrency. The app and CLI share one module: providers implement a small ProviderRuntime protocol (auth store → usage client → mapper → ProviderSnapshot), and both surfaces read the same normalized data — see the architecture overview for how the pieces fit together and AGENTS.md for engineering conventions.

Releasing

Releases are automated: pushing a v* tag on main builds, signs, notarizes, and publishes a new version. A plain tag (v0.7.1) ships to everyone; a pre-release suffix (v0.7.1-beta.1) ships to the beta channel. The pipeline lives in .github/workflows/release.yml, and the step-by-step is in the release-swift skill.

Release setup (one-time)

The release workflow needs these repository secrets (Settings → Secrets and variables → Actions):

Secret What it is
APPLE_CERTIFICATE base64 of your Developer ID Application .p12
APPLE_CERTIFICATE_PASSWORD the password set when exporting that .p12
APPLE_ID the Apple ID email used for notarization
APPLE_PASSWORD an app-specific password for that Apple ID
APPLE_TEAM_ID your Apple Developer team ID
APPLE_DEVELOPER_ID_ICLOUD_PROFILE base64 Developer ID provisioning profile for the production iCloud container
SPARKLE_PUBLIC_KEY base64 EdDSA public key, baked into the build as SUPublicEDKey
SPARKLE_PRIVATE_KEY base64 EdDSA private key used to sign the DMG
POSTHOG_CLI_API_KEY PostHog personal API key used to upload dSYMs for crash symbolication
POSTHOG_CLI_PROJECT_ID numeric PostHog project ID the dSYMs upload to

Export the Developer ID Application cert (with its private key) from Keychain Access as a .p12, then base64 -i DeveloperID.p12 | pbcopy. App-specific passwords come from appleid.apple.com → Sign-In and Security → App-Specific Passwords. Generate the Sparkle EdDSA key pair once with Sparkle's generate_keys tool; the public and private values must be a matching pair or signing is silently skipped.

For iCloud Sync, store the original development and Developer ID provisioning profiles in 1Password as secure documents. Install the development profile on each registered Mac; base64-encode the Developer ID profile and store it only in the APPLE_DEVELOPER_ID_ICLOUD_PROFILE Actions secret. See iCloud Sync for the container identifiers, build command, and file-inspection command.

The two POSTHOG_CLI_* secrets are only used to upload debug symbols (dSYMs) so PostHog can symbolicate crash reports: POSTHOG_CLI_API_KEY is a PostHog personal API key (PostHog → Settings → Personal API keys) and POSTHOG_CLI_PROJECT_ID is the numeric ID from your project URL. The upload host is hardcoded in the workflow (https://us.i.posthog.com), so there is no POSTHOG_CLI_HOST secret. Unlike the secrets above these don't block a release — if POSTHOG_CLI_API_KEY is unset the workflow skips the upload with a warning and the release still ships, but crash reports for that version show raw addresses instead of symbolicated stack traces.

The repository must be public (Sparkle fetches the DMG and appcast anonymously), and the appcast is served from GitHub Pages — confirm Settings → Pages points at the gh-pages branch after the first release.

Contributing

Issues are welcome. Pull requests are strict and issue-first: comment on an issue, wait for a maintainer to add the approved label and assign it to you, then reference it in your PR with Fixes #123. Automation closes external PRs without an approved issue assigned to their author, and warns when an accepted PR adds more than 1,000 lines. Read CONTRIBUTING.md before opening one. Report security issues privately per SECURITY.md. The OpenUsage name and logo are covered by the trademark policy.

License

MIT

openusage (robinebers/openusage)

Searching Database…

这是什么?OpenUsage 是一款用 Swift 编写的免费开源 macOS 原生菜单栏应用,可在一个弹窗中集中显示你 AI 编程订阅(Claude、Codex、Copilot、Cursor 等)的使用情况——包括会话和每周限额、额度以及消费金额。
我需要什么 macOS 版本?macOS 15(Sequoia)或更高版本;OpenUsage 以通用二进制形式发布,可在 Apple Silicon 和 Intel Mac 上原生运行。
我需要为每个提供商分别登录吗?大多数提供商不需要——OpenUsage 会读取你电脑上已有的凭据(钥匙串、认证文件、应用状态);只有 OpenRouter 和 Z.ai 需要你手动提供 API 密钥,因为它们没有可复用的本地凭据。
我的使用数据或凭据会被暴露到任何地方吗?本地 HTTP API 只监听 127.0.0.1,且从不提供凭据,但 README 指出,在浏览器中打开的页面同样可以读取该回环端点。
不开应用也能在终端里查看用量吗?可以——单次执行的 CLI(openusage)能以 JSON 格式读取同一份缓存的限额数据,openusage --force 可绕过 5 分钟缓存;此功能无需菜单栏应用正在运行。
其他应用能读取我的使用数据吗?可以,通过 127.0.0.1:6736/v1/limits 这个仅限回环访问、从不提供凭据的本地 HTTP API。
我可以让对提供商的请求走代理吗?可以,OpenUsage 支持把对提供商的请求路由到 ~/.openusage/config.json 中配置的 SOCKS5 或 HTTP(S) 代理。
OpenUsage 如何计算美元消费?消费卡片(Today/Yesterday/Last 30 Days)针对 Claude、Codex 和 Grok 直接从本地 CLI 日志计算,或来自 Cursor 的用量导出,美元金额通过动态刷新的模型价格估算——无需 Node.js 或其他运行时。
Creator
robinebers
Size
45.6 MB
Stars
4.4K
Age
8mo
Commits · 90 Days