1
561
近 7 天 21
39.0
生态多维模型
12 天前
2026-09-23
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-codex-usage-tui@1.4.2"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-codex-usage-tui@1.4.2"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-codex-usage-tuiOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode TUI plugin that shows remaining ChatGPT Codex usage limits in the sidebar.
It reads the same internal Codex usage data shown by the ChatGPT Codex usage dashboard and renders remaining limit percentages, reset timers, credits, and banked reset credits.
Features
- Shows remaining Codex limits, not used percentage
- Displays the shortest window first, typically the shared 5-hour Plus limit
- Displays reset timers below each usage row and aligned to the right
- Shows the ChatGPT plan in uppercase, for example
PLUS - Supports collapsed and expanded sidebar display
- Automatically reads trusted Codex CLI auth from
~/.codex/auth.json - Continuously refreshes usage in the background
- Updates reset countdowns in realtime between API refreshes
- Supports disabling requests with
OPENCODE_CODEX_USAGE_DISABLED=true
Install
Add the published package to OpenCode's TUI configuration:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": ["opencode-codex-usage-tui@1.4.1"]
}
OpenCode resolves the npm package and loads its ./tui entry point directly. No files are copied into the OpenCode configuration directory. Pin the version for reproducible setups, or omit the version when you want OpenCode to resolve the latest release.
For local development, build and pack the project:
npm install
npm run check
npm pack
Then reference the generated tarball in tui.json using the local package spec supported by your OpenCode installation. Restart OpenCode after editing tui.json; TUI plugins are loaded at startup.
For example, a local file URL can be used when supported:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": ["file:///absolute/path/to/opencode-codex-usage-tui-1.4.1.tgz"]
}
Configure Auth
Default flow:
codex login
The plugin reads the Codex CLI token from:
~/.codex/auth.json
The file must be the regular, non-linked file created by the Codex CLI. The plugin does not support environment-token overrides, custom Codex homes, or a separate OpenCode credential file.
To disable the usage request entirely for a shell session:
$env:OPENCODE_CODEX_USAGE_DISABLED = "true"
The section starts collapsed but begins fetching immediately. Reset countdowns render live, while usage data refreshes at most once per minute to avoid rate limits.
Getting A Codex Token
After logging in with Codex CLI, credentials are normally stored in:
~/.codex/auth.json
The plugin reads tokens.access_token (or tokens.accessToken) and an optional account ID from the token object. If the token expires, run codex login again and restart OpenCode if needed.
Do not commit or share auth.json or access tokens.
Endpoint
This plugin calls an internal ChatGPT endpoint:
https://chatgpt.com/backend-api/wham/usage
Because this endpoint is not a public stable API, the plugin is defensive and falls back to a short error plus the official dashboard URL if the payload changes:
https://chatgpt.com/codex/settings/usage
License
MIT
同类生态推荐
Tui Quota Usage
opencode-tui-quota-usage
OpenCode quota usage sidebar tracker for OpenCode V2 CLI/TUI
Oc Codex Multi Auth
oc-codex-multi-auth
OpenCode plugin for ChatGPT Plus/Pro OAuth with Codex/GPT-5 routing, multi-account rotation, account switching, health checks, diagnostics, and recovery tools
Codex Usage
opencode-plugin-codex-usage
OpenCode TUI plugin that shows live Codex usage limits in the session sidebar.