npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-chatgpt-codex-usage

v0.3.1

Published

OpenCode TUI sidebar plugin for ChatGPT Codex usage limits

Readme

OpenCode ChatGPT Codex Usage

An OpenCode TUI plugin that shows ChatGPT Codex usage limits in the right sidebar.

The panel displays the current ChatGPT plan, whether Codex requests are allowed, used and remaining percentages, the duration of each usage window, and local reset times. By default, it refreshes every 30 seconds.

Requirements

  • OpenCode 1.18.18 or newer
  • A ChatGPT account connected to OpenCode with OAuth
  • The OpenCode TUI right sidebar enabled

Install

Add the package to the TUI plugin list in ~/.config/opencode/tui.jsonc:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["opencode-chatgpt-codex-usage"]
}

Preserve any existing entries in the plugin array. Quit and restart OpenCode after changing the configuration; config-time plugins are not hot-reloaded.

If ChatGPT is not connected yet, run /connect in OpenCode and select OpenAI/ChatGPT.

Refresh Interval

Set refreshInterval with a duration ending in s (seconds), m (minutes), h (hours), or d (days):

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": [
    ["opencode-chatgpt-codex-usage", { "refreshInterval": "5m" }]
  ]
}

The default is "30s". Valid durations shorter than 10 seconds are clamped to "10s"; invalid values fall back to the default. Quit and restart OpenCode after changing the interval.

Authentication

Credentials are checked in this order:

  1. CHATGPT_ACCESS_TOKEN, with optional CHATGPT_ACCOUNT_ID.
  2. OPENCODE_AUTH_CONTENT, containing OpenCode auth JSON.
  3. OpenCode's auth file at $XDG_DATA_HOME/opencode/auth.json, or ~/.local/share/opencode/auth.json when XDG_DATA_HOME is unset.

The plugin reads the openai OAuth entry. When the account ID is absent, it attempts to derive it from JWT claims in the access token.

The token is used only as an authorization header for the usage request. It is not rendered, logged, written, or sent to model prompts.

Displayed Values

  • Plan: the plan reported by ChatGPT, such as plus.
  • Allowed: whether Codex requests are currently accepted.
  • Primary: the primary usage window.
  • Secondary: the longer usage window, when returned.
  • used and left: consumed and calculated remaining percentages.
  • window: duration from limit_window_seconds.
  • reset: the reset time in the machine's locale.

Security And Stability

This plugin calls the undocumented internal endpoint:

https://chatgpt.com/backend-api/wham/usage

The endpoint and response schema may change without notice. OAuth access tokens are sensitive; install plugins only from sources you trust. A 401 or 403 response normally means the ChatGPT session must be reconnected with /connect.

Development

npm install
npm run typecheck
npm test
npm pack --dry-run

The npm package exposes both . and ./tui; OpenCode loads the TUI entrypoint from exports["./tui"].

Publishing

Confirm that the npm package name is still available, authenticate with npm login, and publish:

npm publish

License

MIT