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

dsh-token-price

v0.2.0

Published

Live token cost + account balance readouts for the DeepSeek Harness Web UI

Readme

dsh-token-price

English | 汉语

DeepSeek Harness Web 界面提供准确的 Token 成本和账户余额显示。

功能

  • 单轮成本:在每条 AI 回复的统计行后按 hover 显示本轮已完成请求步骤的 ¥... 成本。
  • 会话累计:汇总每一个已上报用量的请求步骤;已取消但已产生用量、却没有最终回复的请求也会计入。
  • 人民币估算:仅以 ¥... 显示按市场 USD/CNY 汇率换算的估算值,界面不显示 USD;它不代表扣款金额,也不是官方单请求 CNY 价格。
  • 账户余额:直接显示官方 GET /user/balance 的返回结果,优先选用返回的 CNY 余额;若接口没有 CNY,则保留接口实际返回的币种。

USD 仅作为内部精确计费主值。没有明确官方价格规则的 provider/model 路由显示为 未定价,不会错误显示为零成本。

安装

一条命令(需要 pnpm):

dsh plugin --profile web add dsh-token-price

包声明了 dsh.bundledsh.client,会同时启用宿主端服务和浏览器端读数。

配置

- id: token-price
  name: dsh-token-price
  config:
    balanceBaseURL: https://api.deepseek.com
    balanceApiKeyEnv: DEEPSEEK_API_KEY
    balanceRefreshIntervalMs: 60000
    referenceRateRefreshIntervalMs: 3600000
    requestTimeoutMs: 5000

balanceApiKeyEnv 指定用于余额查询的 DeepSeek API key 凭据。密钥只保留在宿主端。刷新失败时保留上一次余额样本。

定价与汇率

prices.json 是官方 USD 价格(每百万 Token)的本地、版本化唯一来源。它是追加式历史:每条规则包含 effectiveFrom、北京时间高峰窗口和支持路由的明确单价。官方价格变更时必须新增规则,不能修改历史规则。

tokenCost 投影会在 request/header 时记录请求路由和时间,再按照对应的历史 USD 规则对每个 (turn, step) 计算。因此同一份会话日志重放时会得到相同的 USD 成本。宿主端不会在运行时抓取或解析官方价格网页。

USD/CNY 汇率由宿主端每小时从公开市场汇率源刷新。刷新失败时使用当前价格规则内置的回退汇率。两者都以 ¥ 显示为估算值,且绝不会影响 USD 精确计费。

开发

npm install
npm test

npm test 会构建 lib/、生成类型声明并运行计费测试。重新构建后需要重启 DSH Web 进程,使其加载新的产物。

License

MIT