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-go-quota

v0.1.2

Published

OpenCode TUI plugin: /quota dialog showing OpenCode Go rolling/weekly/monthly usage via the official usage API (curl, no browser cookies)

Readme

opencode-go-quota

English | 中文

OpenCode TUI plugin that manages multiple OpenCode Go plans from a dialog — per-plan remaining quota (5h / weekly / monthly, aligned single-line columns) and one-key switching.

→ [/quota]
Go 套餐剩余量 · 支持管理多个 opencode go 套餐 · 回车切换(重启后生效)
  [email protected]             月 82% 周 78% 5h 40%
  [email protected]     ⚠月  0% 周 80% 5h 51%

Run /quota in the OpenCode TUI. Select a plan and press Enter to switch — takes effect after restarting OpenCode; the active plan is marked ●.

How it works

  • Plans live in ~/.config/opencode/go-keys.json:

    {
      "active": 1,
      "plans": [
        { "name": "[email protected]", "key": "sk-…" },
        { "name": "[email protected]", "key": "sk-…" }
      ]
    }
  • Selecting a plan rewrites the opencode-go key in ~/.local/share/opencode/auth.json (previous key backed up to auth.json.bak) and updates active. Restart OpenCode for it to take effect.

  • Usage comes from the official endpoint GET https://opencode.ai/zen/go/v1/usage via curl (falls back to fetch). Read-only, consumes no quota, no browser cookies.

Note: the API returns usage percentages per window (limits: 5h $12 / week $30 / month $60). Exact dollar amounts are visible in the console.

Install

Add the plugin to your tui.json (global: ~/.config/opencode/tui.json):

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["opencode-go-quota"]
}

OpenCode installs npm TUI plugins automatically on startup. Then run /quota inside the TUI.

Alternatively, register a local checkout by absolute path:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": ["/absolute/path/to/opencode-go-quota"]
}

Troubleshooting

  • "未找到 go-keys.json" / empty panel — create ~/.config/opencode/go-keys.json with your plans (see the JSON above; each key is the Go API key from that account's console).
  • Error dialog on fetch — check network access to opencode.ai; the plugin falls back from curl to fetch automatically.
  • Switch didn't take effect — restart OpenCode; the provider key is cached per process.

中文

OpenCode TUI 插件:在弹窗里管理多个 OpenCode Go 套餐——每个套餐的单行剩余额度(5 小时 / 每周 / 每月,定宽对齐)与一键切换。

在 TUI 中运行 /quota,选中套餐回车即切换(重启 OpenCode 后生效,当前套餐有 ● 标记)。

原理

  • 套餐存在 ~/.config/opencode/go-keys.json(格式见上方英文版 JSON)。
  • 切换 = 改写 ~/.local/share/opencode/auth.json 的 opencode-go key(原 key 备份为 auth.json.bak)并更新 active,重启 OpenCode 生效。
  • 用量来自官方接口 GET https://opencode.ai/zen/go/v1/usage(curl,缺省退回 fetch)。纯状态读取,不消耗额度,无需浏览器 cookie。

接口只返回各窗口使用百分比(限额:5 小时 $12 / 每周 $30 / 每月 $60);精确美元金额需在控制台查看。

安装:在 ~/.config/opencode/tui.json 中加入 "plugin": ["opencode-go-quota"],重启 TUI 即可。

License

MIT