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

@masonchow/pi-hud

v0.1.0

Published

Pi extension: Claude Code style HUD statusline — model, context usage, cost, cache hit rate, subagents

Readme

@masonchow/pi-hud

给 Pi 输入框下方加一条 Claude Code statusline 风格的 HUD:当前模型、上下文水位、额度/花费、缓存命中率、subagent 消耗,一眼看完。

快速开始

pi install npm:@masonchow/pi-hud

重启 Pi 后 HUD 自动渲染在输入框下方,会话内用 /hud 开关。

λ anthropic/claude-opus-5 │ 订阅 5h 剩 78% (重置 2h14m)
⊡ ██████░░░░ 62.4% 124.8k/200k │ ⏱ 4m18s │ ⚡ 43 tok/s │ ⛁ cache 78% │ ↑312.5k ↓18.2k
↳ scout claude-sonnet-5 ↑42.1k ↓3.8k $0.031 ×2

第 3 行只在本会话跑过 subagent 时出现。

适用范围

✅ 主模型 provider/model + 认证形态(订阅 / API key) ✅ 上下文水位进度条(来自 ctx.getContextUsage(),≥70% 转黄、≥85% 转红) ✅ 累计活跃时长、流式 token 输出速度(message_end 后用真实 usage 校准) ✅ 缓存命中率 cacheRead / (input + cacheRead + cacheWrite) ✅ subagent 逐个列出模型 / tokens / 成本,按 runId 去重 ✅ 订阅额度:openai-codex(含剩余百分比与重置倒计时) ✅ API key 余额:deepseek / kimi / stepfun(其余供应商无查询 API,只显示本次花费)

❌ 自定义布局、字段开关、主题配置(只有 /hud 一个开关) ❌ 跨会话历史统计、成本报表导出 ❌ 未提供余额 / 额度查询 API 的供应商

工作方式

sequenceDiagram
  participant Pi as Pi 事件流
  participant HUD as hud 扩展
  participant Prov as 供应商额度接口
  participant UI as 输入框下方 widget

  Pi->>HUD: session_start / model_select
  HUD->>Prov: 按认证形态查余额或订阅额度
  Prov-->>HUD: 余额 / 剩余百分比
  loop 每轮对话
    Pi->>HUD: message_update 流式增量
    HUD->>UI: 重绘(运行中每秒刷新)
    Pi->>HUD: message_end 真实 usage
    HUD->>UI: 校准速度与缓存命中率后重绘
  end

只读事件流做 UI 渲染,不注入 system prompt、不回写对话历史,因此对 prompt cache 完全中性。

隐私与成本

  • 额度查询只发往当前登录供应商自己的接口,凭据经 Pi 的 AuthStorage 读取,不落日志。
  • HUD 不增加任何模型调用,不产生 token 费用。
  • 是 input + cacheRead + cacheWrite 之和,用于估算真实计费量,不等于新增 input。

许可

MIT