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

omp-token-usage

v1.1.0

Published

Interactive TUI panel for OMP token usage analytics — multi-dimension grouping, cache hit rate, drill-down navigation, mouse support.

Readme

omp-token-usage

English

Oh My Pi 的 Token 用量统计扩展。你可以通过全屏交互面板或 query_token_usage 工具,按模型、时间范围、提供商、会话和文件夹查看 Token 消耗与预估费用。

安装

omp install omp-token-usage

快速开始

在 OMP 中运行:

/token-usage

扩展会在每次查询前将 OMP 会话记录同步到 ~/.omp/stats.db。结果包含已写入磁盘的最新记录。

语言偏好

默认显示语言为英文,扩展内置中文(zh-CN)。

保存默认语言

打开 设置 → 插件 → omp-token-usage,选择 locale;也可以使用 CLI:

omp plugin config set omp-token-usage locale zh-CN
omp plugin config set omp-token-usage locale en
omp plugin config get omp-token-usage locale
omp plugin config delete omp-token-usage locale

保存的偏好会用于后续工具调用和 /token-usage 命令。

临时覆盖单次查询

使用 --locale-l 可以只改变本次命令的语言,不会修改已保存的偏好:

/token-usage --locale zh-CN
/token-usage -l en

调用 query_token_usage 时,在工具参数中传入 locale

{
  "timeRange": "month",
  "groupBy": "model",
  "locale": "zh-CN"
}

优先级

  1. 工具的 locale 参数,或命令的 --locale / -l
  2. .omp/plugin-overrides.json 中的项目级覆盖
  3. 已保存的插件设置
  4. 内置默认值:en

outputFormat: "json" 不会本地化,始终返回原始数据库字段和值。

命令别名

无论当前显示语言是什么,原有中文查询别名都可以继续使用。

| 英文 | 中文别名 | |---|---| | detail | 明细 | | today | 今日 | | yesterday | 昨日 | | week | 本周 | | month | 本月 | | all | 全部 | | model: | 模型: | | provider: | 提供商: | | folder: | 文件夹: |

TUI 操作

界面布局

  • 页签:模型、按天、提供商、会话、文件夹。
  • 摘要:请求数、预估费用、Token 总量和当前时间范围。
  • 时间范围:今日、昨日、近 7 天、近 30 天和全部时间。
  • 表格:分组名称、请求数、总 Token、费用和缓存命中率。

键盘与鼠标

| 输入 | 操作 | |---|---| | Tab / Shift+Tab | 切换维度 | | / | 切换时间范围 | | / / j / k | 选择行 | | Enter | 钻入子维度 | | Space | 查看当前筛选条件的详情 | | Backspace | 返回上一层 | | q / Esc | 关闭面板 | | 鼠标 | 点击页签或行,滚轮滚动表格 |

钻入路径

  • 模型 → 按天(Enter)→ 详情(Space
  • 提供商 → 模型(Enter)→ 按天(Enter)→ 详情(Space
  • 会话 → 模型(Enter)→ 按天(Enter)→ 详情(Space

详情视图

Space 查看当前筛选条件下的请求数、缓存写入/读取 Token、总上下文 Token、缓存命中率、输出 Token、预估费用和耗时。

费用计算

扩展使用固定的每 Token 单价估算费用,实际账单以 API 提供商为准。

| 类型 | 单价 | |---|---| | 输入 Token | 每百万 $1.00 | | 缓存读取 | 每百万 $0.20 | | 输出 Token | 每百万 $3.00 |

缓存命中率 = 缓存读取 /(缓存写入 + 缓存读取)

局限

  • 只读取 ~/.omp/stats.db,不会统计 OMP 外发出的请求。
  • 使用固定费率估算,不同提供商和模型的实际价格可能不同。
  • TUI 和 Markdown 标签会本地化;JSON 有意保持原始格式,不会本地化。

许可证

MIT © CorunLing