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

@mynameistito/opencode-usage-limits

v1.0.14

Published

OpenCode TUI plugin that shows Codex, OpenCode GO, ZAI, Synthetic, MiniMax Token Plan, and Qwen usage limits in the sidebar and prompt footer.

Downloads

855

Readme

@mynameistito/opencode-usage-limits

OpenCode TUI plugin that shows Codex, OpenCode GO, ZAI, Synthetic, MiniMax Token Plan, and Qwen usage limits in the sidebar and prompt footer.

Features

  • Adds a Usage Limits block under the sidebar Context section.
  • Shows current Codex usage windows from OpenAI/Codex auth.
  • Shows current ZAI quota windows from ZAI Coding Plan auth.
  • Shows current Synthetic rolling 5-hour and weekly windows.
  • Shows current MiniMax Token Plan rolling 5-hour and weekly windows.
  • Shows current Qwen Token Plan windows from the local qwencloud CLI.
  • Shows current OpenCode GO rolling, weekly, and monthly windows.
  • Adds compact prompt-footer usage when the current session uses an OpenAI, OpenCode GO, ZAI Coding Plan, Synthetic, MiniMax Token Plan, or Qwen Token Plan model.
  • Providers are toggled from ~/.config/opencode/usage-limits.jsonc.
  • Reads OpenCode-connected credentials first, then falls back to explicit config/env credentials.

Install

This package contains the OpenCode v2 TUI plugin and is published from the monorepo main branch using npm's latest dist-tag. Install it globally with:

opencode2 plugin add @mynameistito/opencode-usage-limits@latest -g
  • -g / --global installs to ~/.config/opencode/cli.json.
  • Without -g, installs locally to <project>/.opencode/cli.json (requires a git worktree).
  • --force replaces an existing pinned version.

The CLI installs the latest package and updates the TUI plugin config for you. The package entrypoint is @mynameistito/opencode-usage-limits/tui.

To configure it manually instead, add the plugin to ~/.config/opencode/cli.json:

{
  "$schema": "https://opencode.ai/v2/cli.json",
  "plugins": ["@mynameistito/opencode-usage-limits"],
}

OpenCode CLI/TUI plugins are configured in cli.json.

Restart OpenCode after changing TUI plugin config.

Published package contents

  • @mynameistito/opencode-usage-limits/tui is the TUI plugin entrypoint.
  • @mynameistito/opencode-usage-limits/schema is the JSON schema for the usage-limits configuration.
  • examples/usage-limits.jsonc is an annotated configuration example.

Troubleshooting

Reinstall or refresh the cached plugin

If the plugin is stale, broken, or needs a clean reinstall, quit OpenCode and remove the cache for the lane you installed. OpenCode caches immutable package versions, so clearing the cache is required when a cli.json entry still resolves to an older version.

For standard OpenCode (@latest):

PowerShell:

Remove-Item -LiteralPath "$HOME\.cache\opencode\packages\@mynameistito\opencode-usage-limits@latest" -Recurse -Force

macOS/Linux:

rm -rf ~/.cache/opencode/packages/@mynameistito/opencode-usage-limits@latest

Start OpenCode again and it will reinstall the plugin from the existing cli.json entry. If the plugin is no longer configured, run the install command again:

opencode2 plugin add @mynameistito/opencode-usage-limits -g
  • Dependency conflicts involving @opencode-ai/plugin usually mean OpenCode's package cache contains an older plugin API package. Update OpenCode, clear the cached plugin as above, then retry the install. This package does not publish OpenCode runtime packages as peer dependencies.
  • No versions available right after a release means a supply-chain cooldown policy (e.g. min-release-age) is blocking the fresh version. Wait for the cooldown window to pass, or install a previously vetted version instead.

Releases

Both packages release from the monorepo main branch using normal root Changesets and npm's latest dist-tag. The package entrypoint is @mynameistito/opencode-usage-limits/tui.

Usage Config

Create ~/.config/opencode/usage-limits.jsonc. The same file lives at examples/usage-limits.jsonc and can be copied verbatim:

{
  "$schema": "https://raw.githubusercontent.com/mynameistito/opencode-plugins/main/packages/opencode-usage-limits/usage-limits.schema.json",
  "enabled": true,
  "refreshIntervalSeconds": 60,
  "requestTimeoutMs": 10000,
  "showErrors": true,
  "providers": {
    "codex": {
      "enabled": true,
      "label": "Codex",
      "showSidebarBar": true,
      "showFooterBar": true,
      "sidebarWindow": "all",
      "footerWindow": "auto",
    },
    "zai": {
      "enabled": true,
      "label": "ZAI",
      "apiKey": "{env:OC_ZAI_API_KEY}", // Optional fallback when OpenCode auth has no ZAI key
      "authorizationScheme": "raw",
    },
    "synthetic": {
      "enabled": true,
      "label": "Synthetic",
      "apiKey": "{env:OC_SYNTHETIC_API_KEY}", // Optional fallback when OpenCode auth has no Synthetic key
    },
    "minimax": {
      "enabled": true,
      "label": "MiniMax",
      "apiKey": "{env:OC_MINIMAX_TOKEN_PLAN_KEY}", // Optional fallback when OpenCode auth has no MiniMax key
    },
  },
}

Minimal config

If you only need Codex and ZAI with auto-discovered credentials:

{
  "$schema": "https://raw.githubusercontent.com/mynameistito/opencode-plugins/main/packages/opencode-usage-limits/usage-limits.schema.json",
  "providers": {
    "codex": { "enabled": true },
    "zai": { "enabled": true, "authorizationScheme": "raw" },
  },
}

Disabled providers are hidden:

"providers": {
  "codex": { "enabled": true },
  "zai": { "enabled": false }
}

Top-level enabled is the plugin master switch, and showErrors controls error text globally. Each provider's enabled controls fetching. Provider showSidebarBar and showFooterBar independently control its sidebar and footer displays without stopping refreshes; both default to true.

Each provider's sidebarWindow can be all, rolling, daily, weekly, monthly, credits, or other. Rolling includes legacy 5h labels. Each provider accepts footerWindow with auto (the provider's normal selection), or one of the same window kinds. An unavailable requested footer window falls back to the provider's automatic selection and then its first available window.

Providers

| Provider ID | Service | Env var | Auth header | Default base URL | | --- | --- | --- | --- | --- | | codex | ChatGPT Codex usage | — | Bearer | https://chatgpt.com/backend-api | | zai | Z.AI Coding Plan quota | OC_ZAI_API_KEY | raw / Bearer | https://api.z.ai | | synthetic | Synthetic quotas | OC_SYNTHETIC_API_KEY | Bearer | https://api.synthetic.new | | minimax | MiniMax Token Plan | OC_MINIMAX_TOKEN_PLAN_KEY | Bearer | https://www.minimax.io | | qwen | Qwen Token Plan | qwencloud CLI | CLI | — | | opencode-go | OpenCode GO usage | OPENCODE_API_KEY | Bearer | https://opencode.ai/zen/go/v1 |

Qwen usage requires the local qwencloud CLI to be installed and authenticated because the plugin calls its authentication-status and usage commands; an unauthenticated CLI state appears as missing credentials.

Synthetic always uses Bearer auth and ignores authorizationScheme.

Set baseUrl on minimax to https://api.minimaxi.com when using the mainland-China region. MiniMax always uses Bearer auth and ignores authorizationScheme.

Credential Lookup

authPath and apiKey are optional overrides. Typical OpenCode users only need enabled: true; label is an optional display override. Credentials are discovered automatically from OpenCode auth and provider defaults. Set apiKey (or authPath to a standalone key file) only when auto-discovery is not enough.

Codex lookup order:

  1. OpenCode auth at ~/.local/share/opencode/auth.json, provider openai.
  2. Codex auth file from authPath, default ~/.codex/auth.json.

If an official-host request rejects the OpenCode credentials, the plugin retries with the configured or default Codex auth file.

ZAI lookup order:

  1. Config authPath, which can point at OpenCode auth JSON or a simple { "key": "..." } / { "apiKey": "..." } JSON file.
  2. OpenCode auth at ~/.local/share/opencode/auth.json, provider zai-coding-plan.
  3. OpenCode auth provider zai.
  4. Config apiKey, including {env:OC_ZAI_API_KEY} references.

Synthetic lookup order:

  1. Config authPath JSON file ({ "key": "..." } / { "apiKey": "..." } / { "synthetic": { "key": "..." } }).
  2. OpenCode auth at ~/.local/share/opencode/auth.json, provider synthetic.
  3. Config apiKey, including {env:OC_SYNTHETIC_API_KEY} references.

MiniMax Token Plan lookup order:

  1. Config authPath JSON file ({ "key": "..." } / { "apiKey": "..." } / { "minimax-coding-plan": { "key": "..." } }).
  2. OpenCode auth at ~/.local/share/opencode/auth.json, provider minimax-coding-plan, minimax, or minimax-token-plan.
  3. Config apiKey, including {env:OC_MINIMAX_TOKEN_PLAN_KEY} references.

Display

Sidebar rows look like:

Usage Limits
codex
  5h: 42% used resets 1h 2m
  weekly: 12% used resets 3d 4h
ZAI
  tokens: 18% used resets 2h
  MCP: 6% used
Synthetic
  5h: 0% used resets 11m
  weekly: 11% used resets 7m
MiniMax
  5h: 10% used resets 2h 56m

Prompt footer shows compact usage when the current session model belongs to a supported provider:

5h: 42% used resets 1h 2m

Provider mapping:

  • OpenCode provider openai -> Codex usage.
  • OpenCode provider zai-coding-plan -> ZAI token usage.
  • OpenCode provider synthetic -> Synthetic usage.
  • OpenCode provider minimax-coding-plan -> MiniMax Token Plan usage (prompt footer); minimax is also accepted as an alias.
  • OpenCode provider qwen -> Qwen Token Plan usage.
  • OpenCode provider opencode-go -> OpenCode GO usage.

Development

bun install
bun run typecheck
bun run test
bun run check
bun run build

The package exposes a TUI entrypoint at @mynameistito/opencode-usage-limits/tui for OpenCode's package plugin loader.

Notes

  • The refresh interval defaults to 60 seconds.
  • The effective minimum refresh interval is 15 seconds.
  • Provider work starts in a scoped coordinator after both TUI slots are registered. Disposal interrupts the coordinator and its active provider work.
  • Errors are intentionally short and do not include auth tokens or response bodies.
  • MiniMax Token Plan returns { model_remains, base_resp }; the per-model current_interval_status and current_weekly_status are treated as 1 = in plan and 3 = not in plan, and a window is hidden when its status is 3 (the API otherwise reports a meaningless 100% remaining for a non-existent bucket).