@illiadotdev/codex-usage-plugin
v0.2.17
Published
OpenCode plugin for viewing Codex ChatGPT usage limits and credits.
Maintainers
Readme
Codex Usage Plugin for OpenCode
OpenCode plugin that exposes a /codex-usage TUI command and <leader>i shortcut for viewing Codex ChatGPT usage limits and credits. It also keeps a codex_usage tool for manual/debug agent use.
Usage
Install the package globally:
npm install -g @illiadotdev/codex-usage-pluginRegister the plugin in OpenCode:
codex-usage-plugin --installThis builds
dist/and registers the generated plugin path in~/.config/opencode/opencode.jsonc.Restart OpenCode.
Run
/codex-usagein the OpenCode TUI, or press the leader key theni(ctrl+xtheniby default).
The installer asks which usage dialog design to use. The compact v1 design remains the default. To change it later, run:
codex-usage-plugin --settingsFor non-interactive use, pass --settings=v1 or --settings=v2.
To remove the plugin registration:
codex-usage-plugin --uninstallTo remove the npm package too:
npm uninstall -g @illiadotdev/codex-usage-pluginTo upgrade the installed package:
codex-usage-plugin --upgrade
codex-usage-plugin --upgrade 0.2.9This checks the resolved npm version first, then runs npm install -g @illiadotdev/codex-usage-plugin@latest by default, or installs the version you pass. Installation is skipped when that version is already installed.
What It Reads
The plugin reads auth from:
OPENCODE_AUTH_PATH, when set~/.local/share/opencode/auth.json~/Library/Application Support/opencode/auth.jsonon macOS~/.opencode/auth.json%LOCALAPPDATA%\\OpenCode\\auth.jsonas a fallback$CODEX_HOME/auth.json, whenCODEX_HOMEis set~/.codex/auth.json, otherwise
It calls the same ChatGPT backend usage surfaces Codex uses:
https://chatgpt.com/backend-api/wham/usagehttps://chatgpt.com/backend-api/wham/profiles/me
Limitations
Plugin supports file-backed OpenCode/Codex auth only. If your client stores tokens in the OS keyring, the plugin will report that auth.json is unavailable. Keyring support can be added later.
The plugin never prints access tokens, refresh tokens, or ID tokens.
