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

@lucasortis/opencode-chatgpt-usage-plugin

v0.0.10

Published

OpenCode TUI plugin that shows ChatGPT usage limits.

Readme

OpenCode ChatGPT Usage Plugin

OpenCode TUI plugin that adds /gpt-usage with /usage alias to show ChatGPT plan usage limits from https://chatgpt.com/backend-api/wham/usage.

Install

npx @lucasortis/opencode-chatgpt-usage-plugin install

The installer updates ~/.config/opencode/tui.json, preserves existing plugins, avoids duplicate entries, and uses the public npm package. Restart or reload OpenCode after installing.

To refresh the configured package spec after upgrading the npm package:

npx @lucasortis/opencode-chatgpt-usage-plugin update

To use a custom config path:

npx @lucasortis/opencode-chatgpt-usage-plugin install --config ~/.config/opencode/tui.json

Commands

  • /gpt-usage
  • /usage

Features

  • shows cached usage immediately when available
  • refreshes usage in the background
  • replaces the dialog with fresh data when the refresh completes
  • stores the last successful snapshot in OpenCode KV
  • supports primary, secondary, credits, and additional usage buckets
  • uses your existing OpenCode OpenAI/ChatGPT login by default

Authentication

By default, the plugin reads your existing OpenCode openai OAuth session and refreshes it when needed.

Optional overrides:

  • GPT_USAGE_TOKEN: required ChatGPT bearer token
  • GPT_USAGE_ACCOUNT_ID: optional ChatGPT account id

These overrides are only needed if you want to bypass the stored OpenCode login.

This uses ChatGPT web auth, not a standard OpenAI API key.

Manual Configuration

If you prefer not to run the installer, add the package spec to ~/.config/opencode/tui.json:

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

If you only want it enabled for one repo, add the same plugin entry to that repo's .opencode/tui.json instead.

Remove

npx @lucasortis/opencode-chatgpt-usage-plugin uninstall

With a custom config path:

npx @lucasortis/opencode-chatgpt-usage-plugin uninstall --config ~/.config/opencode/tui.json

You can also remove @lucasortis/opencode-chatgpt-usage-plugin manually from the plugin array in tui.json.

Development

Install dependencies:

npm install

Type-check:

npm run typecheck

Run tests:

npm test

Build the distributable package:

npm run build

Load the local source plugin while developing:

npm run opencode:plugin:local

Switch back to the published package spec:

npm run opencode:plugin:package

Release

Validate package contents before publishing:

npm run typecheck
npm test
npm run build
npm run pack:check

Prepare a version bump and local tag:

npm run release:package -- patch
git push origin main --tags

Publishing is handled by the Publish package GitHub Actions workflow when a GitHub Release is published. Configure npm Trusted Publishing for this repository instead of storing an npm token in GitHub secrets.

Manual publishing is also available:

npm run publish:package

Troubleshooting

Check whether the plugin is configured:

npx @lucasortis/opencode-chatgpt-usage-plugin doctor

Run an installer smoke test with a temporary config file:

npm run smoke:install

If OpenCode does not show /gpt-usage, restart or reload OpenCode and confirm that tui.json contains the package spec.

Contributing

Issues are welcome for bug reports, usage questions, and feature suggestions.

External pull requests are closed automatically. Valid pull requests are limited to lucasortis and dependabot[bot].

Notes

  • this is ChatGPT plan usage, not OpenAI API billing usage
  • expired or disconnected OpenCode OpenAI sessions return a clear error in the dialog
  • optional override token values are never logged by the plugin