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

@diwu507/pi-dusage

v0.2.0

Published

Pi extension package for provider quota checks across Codex, z.ai Coding CN, and MiniMax CN.

Readme

pi-dusage

pi-dusage 是一个最小的 Pi extension(扩展)包,用来查看订阅 / 套餐 provider(提供方)的 quota(配额)使用情况。

第一版范围

当前只接入 3 个已验证路径:

  • openai-codex
  • zai-coding-cn
  • minimax-cn

不包含:

  • volcengine-ark-coding
  • footer(页脚)常驻显示
  • 自定义登录流程
  • 服务状态页告警

命令

只注册一个 slash command(斜杠命令):

/dusage

行为:

  • 在 TUI(终端交互界面)模式下,使用 overlay(覆盖层)面板显示结果,样式接近传统 usage 卡片,并提供:
    • r 刷新
    • Esc 退出
  • pi -p 等非 TUI 模式下输出纯文本,便于快速验证。

数据来源

openai-codex

  • 认证:~/.pi/agent/auth.jsonopenai-codex
  • 接口:https://chatgpt.com/backend-api/wham/usage

zai-coding-cn

  • 认证:~/.pi/agent/auth.jsonzai-coding-cn
  • 接口:https://bigmodel.cn/api/monitor/usage/quota/limit

minimax-cn

  • 认证:~/.pi/agent/auth.jsonminimax-cn
  • 接口:https://api.minimaxi.com/v1/api/openplatform/coding_plan/remains

输出原则

  • 不显示明文 token(令牌)或 key(密钥)
  • 只显示可理解的窗口、百分比、重置时间
  • openai-codex 除通用额度外,也展示服务端 additional_rate_limits 返回的独立额度卡片;卡片标题使用 API 返回的名称,不硬编码模型版本
  • zai-coding-cn 保留 provider 原始字段语义,不强行假设所有窗口都等价于“5h + 周”
  • minimax-cn 只展示服务端 general 类别的 5 小时与周窗口;不将 video 等多模态分类误导为独立套餐额度
  • 窗口排序:统一按重置时间升序,短窗口(如 5h)在上、长窗口(week / month)在下,不依赖各 provider API 的返回顺序
  • 用量条语义:进度条表示「剩余配额」——剩余越多填充越满且越绿,将耗尽时变红;右侧仍显示可使用量百分比
  • 单个 provider 请求超时或失败时,只在该 provider 卡片内显示错误,不中断其余 provider 的结果展示

国际化

所有可见文案通过 pi-di18n 的 pi-i18n/requestApi 事件接入多语言,内置 enzh-CN 两套文案:

  • 已安装 pi-di18n:注册 dusage namespace bundle,文案跟随 /lang 选择的语言;locale 切换后 overlay 自动重渲染。
  • 未安装 pi-di18n:回退到内置查表,按 LANG / LC_ALL 环境变量选择 zh-CNen,不抛错。

安装

通过 npm 安装(推荐)

pi install npm:@diwu507/pi-dusage

安装后在 Pi 中执行:

/reload

也可以直接把包名加入 ~/.pi/agent/settings.jsonpackages

"npm:@diwu507/pi-dusage"

本地开发安装

把本仓库路径加入 ~/.pi/agent/settings.jsonpackages

"/Users/diwu/Workspace/Codes/Githubs/pi-dusage"

然后在 Pi 中执行:

/reload

开发验证

需先将本仓库按「本地开发安装」加入 ~/.pi/agent/settings.jsonpackages(本地路径直接读源码 index.ts,改完即时生效,无需重新安装):

PI_SKIP_VERSION_CHECK=1 pi --no-session -p "/dusage"