CodexLimitsWidget1
A native macOS app with a WidgetKit desktop widget that shows the remaining Codex limits without opening an interactive Codex CLI session.
The widget uses codex app-server and the account/rateLimits/read method, so
it reads the same source of data that backs /status in the Codex CLI.
CodexLimitsWidget is an independent project and is not affiliated with, endorsed by, or sponsored by OpenAI.
Sources/CodexLimitsHost.swift- a small host app that syncs an auth snapshot.Sources/CodexLimitsWidget.swift- the WidgetKit extension that reads and renders limits.Resources-Info.plist, entitlements, and the app/widget icon.codex-limits- a CLI script for printing limits without the interactive TUI.build-widget.sh- builds the.appbundle.install-widget.sh- builds, installs into/Applications, and registers the widget.
- macOS with WidgetKit desktop widget support.
- Apple Silicon target (
arm64-apple-macosx14.0inbuild-widget.sh). - Installed
swiftc/Xcode Command Line Tools. - Installed and authenticated
Codex CLI.
./build-widget.shThe app bundle is created at:
build/Codex Limits.app
./install-widget.shThe script:
- rebuilds the app;
- installs it to
/Applications/Codex Limits.app; - removes the old
/Applications/CodexLimits.appbundle if it is still present; - registers the app through Launch Services;
- opens the host app.
After installation, open the macOS widget gallery and search for Codex Limits.
The app provides two square widgets: Codex Limits, which shows relative reset
times, and Codex Reset Times, which shows the clock time or date when limits
reset.2
The WidgetKit extension runs in a sandbox and does not read the user's
~/.codex/auth.json directly. Instead, the host app copies a short auth snapshot
into the widget extension's Application Support directory on launch and when the
Refresh Widget button is pressed. The container location is resolved at runtime
from the bundled widget extension.
The snapshot stores only:
- access token;
- account id;
- plan type;
- update timestamp.
The refresh token is not copied.
The widget asks WidgetKit to refresh its timeline every 5 minutes. macOS may
delay or throttle widget updates, so this is a requested cadence rather than a
strict timer. Opening the host app and pressing Refresh Widget forces an
earlier timeline reload.
Print limits in the terminal:
./codex-limitsPrint the raw JSON response:
./codex-limits --jsonShow all buckets if the Codex CLI returns more than one:
./codex-limits --allIf the widget appears but does not show limits:
- Open
/Applications/Codex Limits.app. - Press
Refresh Widget. - Make sure the
codexCLI is authenticated and available fromPATH. - Rebuild and reinstall:
./install-widget.shThe source code is licensed under the MIT License. See LICENSE.
This license does not apply to Resources/CodexLimits.icns, which is a
third-party brand asset and is not sublicensed under MIT.
