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

v0.3.8

Published

OpenCode TUI plugin: real-time AI plan quota in the sidebar (GLM Coding Plan / Kimi Code / DeepSeek balance)

Readme

opencode-quota-usage

opencode TUI 插件:在侧栏实时显示 AI 套餐用量 —— 智谱 GLM Coding Plan / Kimi Code / DeepSeek 余额。

opencode

安装

~/.config/opencode/tui.json(建议固定精确版本号):

{
  "plugin": ["[email protected]"]
}

⚠️ 不要用 @latest:opencode 会把 npm 插件缓存在 ~/.cache/opencode/packages/<spec>/,且不会自动更新——@latest 将永远加载首次安装时的旧版本,即使发布了新版。升级方式:把版本号改成新版本即可(新 spec = 全新安装)。

升级后需要重启 opencode。若怀疑加载的不是新版本,删除 ~/.cache/opencode/packages/opencode-quota-usage@<旧版本>/ 后重启。

国内用户注意:若本机 npm registry 配的是 npmmirror,新版本发布后镜像有同步延迟(实证:官方源已是新版、镜像仍拉旧版)。可主动触发同步:curl -X PUT https://registry.npmmirror.com/-/package/opencode-quota-usage/syncs,几秒后生效。

重启 opencode 即生效。

前置条件

插件运行时从 opencode 的 provider 配置读取凭据,需要在 ~/.config/opencode/opencode.jsonc 里配置对应 provider(含 apiKey/baseURL):

| 厂商 | 识别方式 | 说明 | |---|---|---| | GLM Coding Plan | baseURL 含 open.bigmodel.cn/api.z.ai,或 id/name 含 zhipu/bigmodel | 多个智谱 provider 时优先取 baseURL 含 /coding/ 的 | | Kimi Code | baseURL 含 api.kimi.com/coding 或 id 为 kimi | | | DeepSeek | baseURL 含 api.deepseek.com 或 id 为 deepseek | |

配置项

tui.json 中以元组形式传入:

{
  "plugin": [
    ["opencode-quota-usage", { "intervalMs": 30000, "deepseek": false }]
  ]
}

| 选项 | 默认 | 说明 | |---|---|---| | glm | true | 显示 GLM Coding Plan(5h 窗口 / 周窗口 / MCP 月度) | | kimi | true | 显示 Kimi Code(周限额 / 5h 窗口 / Booster 月消费) | | deepseek | true | 显示 DeepSeek 余额 | | intervalMs | 60000 | 轮询间隔(下限 15000);每次会话回复结束也会立即刷新 | | title | "套餐用量" | 卡片标题 |

数据源

  • 智谱:GET /api/monitor/usage/quota/limit(裸 key,无 Bearer;兼容新套餐 CREDIT_LIMIT 与老套餐 TOKENS_LIMIT)
  • Kimi:GET /coding/v1/usages(Bearer;数值字符串与 used/remaining 双拼写兼容)
  • DeepSeek:GET /user/balance(Bearer)

License

MIT