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

@plusl/usage-cost

v0.1.0

Published

Cost estimation for dsh usage figures: a /cost command and a Web cost card with per-model CNY pricing, over the official usage projections

Downloads

144

Readme

@plusl/usage-cost

/cost 命令与 Web 费用卡片:基于官方 usage 投影(tokenUsage / contextPressure) 与可配置的按模型单价表(CNY / 百万 token),估算当前会话的计费成本。官方 /usage 回答"用了多少",/cost 回答"大概花了多少钱"。

安装

# npm(推荐)
dsh plugin --profile web add @plusl/usage-cost

# tarball
dsh plugin --profile web add ./plusl-usage-cost-<version>.tgz

# git(仓库自带预构建 lib/ 产物,无需 allowBuilds 构建脚本)
dsh plugin --profile web add github:<owner>/dsh-plus

依赖 dsh ≥ 0.1.0-rc.6(官方 /usage 全家桶所在版本)。在任何挂载 dsh-base 的 profile 上可用;无 Web 表面时浏览器半边不激活,命令文本仍是全部表现。

行与 id

| id | 包 | 说明 | |---|---|---| | usage-cost | @plusl/usage-cost | 双面行:host 半边注册 /cost 命令;browser 半边(dsh.client)注册 keyed conversation.chat.commandviewcost 渲染器 |

配置

prices:按模型 id 索引的单价行(CNY / 1M token):

- id: usage-cost
  config:
    prices:
      default:            # 无精确匹配模型的回退
        uncachedInputCny: 2
        cacheReadCny: 0.2
        cacheWriteCny: 8
        outputCny: 8
      deepseek-chat: { ... }   # 精确模型 id 覆盖
  • 精确模型 id 优先;未命中用 default 行并在输出里注明。
  • 默认值即 DeepSeek 官方牌价(deepseek-chat:2 / 0.2 / 8 输入,8 输出)。
  • 覆盖本行时须重述完整 config(patch 层按行整体替换)。

依赖的官方能力

  • ctx.commands(dsh-commands):命令注册面
  • ctx.sessionProjections(dsh-session-projection)+ tokenUsage / contextPressure(dsh-token-meter)
  • Web:conversation.chat.commandview keyed slot(ui-conversation)与 locale 注册面

构建

pnpm --filter @plusl/usage-cost build   # lib/index.js + lib/client.js + lib/types

估算值仅供参考;实际账单以提供方计费为准。