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-glm-status

v1.0.0

Published

OpenCode v2 TUI plugin: GLM / Zhipu Coding Plan quota next to the prompt (5h token window, reset time).

Readme

opencode-glm-status

OpenCode v2 TUI 插件:在输入框 footer 状态区显示智谱 GLM Coding Plan 配额

Show your Zhipu / GLM / Z.ai Coding Plan quota right next to the prompt input bar.

需要 OpenCode v2.0+(V2 插件 API)。v1 用户请用 0.4.0。

效果预览 / Preview

> 请输入你的问题…                                 GLM 69% ↻14:00
  • 5h token:5 小时滚动 token 窗口剩余比例(低额度变黄/红)
  • ↻14:00:下一次配额重置时间

每 30 秒自动刷新,并在每次回复完成时立即刷新。

安装 / Installation

在 ~/.config/opencode/cli.json(无则新建)的 plugins 数组添加一行:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["opencode-glm-status"]
}

重启 opencode 即生效(opencode 会用 Bun 自动安装 npm 包,无需手动装依赖)。

前置条件 / Prerequisites

  • opencode ≥ 2.0(V2 插件 API)
  • 已配置智谱 GLM Coding Plan 账号,凭据存放在以下任一位置:
    • ~/.local/share/opencode/auth.json(推荐,opencode auth 添加)
    • opencode provider 配置(options.apiKey)
  • 支持平台自动识别:
    • 智谱开放平台(国内):open.bigmodel.cn
    • Z.ai(国际):api.z.ai

工作原理 / How it works

  1. 从 opencode 认证信息中发现智谱 provider 及 API key(不读取环境变量,仅本机凭据)
  2. 直接请求智谱官方监控接口 /api/monitor/usage/quota/limit
  3. 渲染到 TUI prompt.footer.status 插槽(输入框 footer 状态区)

你的 API key 仅用于请求智谱官方接口,不会被上传到任何第三方服务。

常见问题 / FAQ

Q: 什么都不显示? 检查 cli.json 配置是否正确,并确认已通过 opencode auth 添加智谱 Coding Plan 账号(provider id 含 zhipu / zai / bigmodel,或 baseURL 指向 open.bigmodel.cn / api.z.ai)。

Q: 显示 GLM ?? 插件未能在本机找到智谱凭据或请求失败,查看 opencode 日志(~/.local/share/opencode/log/)定位。

Q: 用的是国内站还是国际站? 自动识别。若你的 key 来自 Z.ai,插件会请求 api.z.ai;来自智谱开放平台则请求 open.bigmodel.cn。

卸载 / Uninstall

从 cli.json 移除 "opencode-glm-status" 并重启 opencode 即可。

从源码构建 / Build from source

npm install
bun run build   # 产出 dist/tui.js + dist/index.js(需 bun ≥ 1.3)

注意:npm 包入口是编译后的 dist/*.js(solid 编译产物),不要把 exports 改指向 src/*.tsx——opencode 的 Bun 运行时不转译 node_modules 内的 TSX,直接发布源码会导致插件静默加载失败。

License

MIT