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

@goodandready/dsh-cost-meter

v0.8.8

Published

DeepSeek Harness plugin: a session cost chip in the conversation header - live token usage by bucket, peak/off-peak tariff, and a countdown to the next tariff switch.

Readme

📦 @goodandready/dsh-cost-meter


⚡ 概述与核心痛点

在使用智能体与大语言模型编程时,模型推理、长上下文以及缓存读写会产生大量 Token 消耗。如果缺乏实时的财务监控,开发者容易错过官方 50% 闲时折扣窗口,或因死循环导致账单超出预算。

@goodandready/dsh-cost-meter 在 DeepSeek Harness 会话顶部工具栏(conversation.session.header.utilities)无缝嵌入高精度花费微件芯片:

● ≈ ¥0.85  0:17     ← 会话顶部实时花费芯片与换价倒计时

点击芯片可展开交互式详情面板:按每 1M Token 展示峰谷两档费率表格(高亮显示当前激活档位)、UTC 优惠时间段状态以及各模型在当前会话中的累计消费明细。


🏛️ 架构设计

graph TD
    subgraph StreamTelemetry ["DSH 流式遥测运行时"]
        Req["LLM 请求 / 报头<br/>(provider, model)"]
        StreamHook["增量流式分片 Hook"]
        Proj["costByModel 会话投影<br/>(半小时 UTC 时隙)"]
    end

    subgraph PricingCatalog ["费率解析引擎"]
        Manual["自定义费率配置<br/>(settings.yaml: prices)"]
        DeepSeekTier["DeepSeek 官方费率<br/>(高峰 / 闲时 50% 折扣)"]
        OpenRouterTier["OpenRouter 公开目录<br/>(每日自动缓存)"]
    end

    subgraph UI ["用户交互界面"]
        Chip["顶部花费芯片<br/>(实时计费 + 换价倒计时)"]
        Modal["消费明细抽屉面板<br/>(1M 单价表, UTC 时段, 模型清单)"]
        Settings["设置卡片<br/>(币种符号, 汇率, 时区)"]
    end

    Req --> Proj
    StreamHook --> Proj
    Proj --> Chip
    PricingCatalog --> Proj
    Manual --> PricingCatalog
    DeepSeekTier --> PricingCatalog
    OpenRouterTier --> PricingCatalog
    Chip --> Modal

✨ 核心特性

  1. 增量流式实时计算:在模型打字生成过程中毫秒级更新 Prompt、Completion 和 Cache 费用,无轮询无卡顿。
  2. 两级阶梯电价引擎:支持 DeepSeek 官方高峰时段(UTC 01:00–04:00 与 06:00–10:00)及闲时 50% 优惠折扣自动匹配。
  3. UTC 半小时时隙不可变性:历史消费严格锁定在消耗发生时刻的时隙费率,切换费率不溯及既往。
  4. 服务商智能路由:精准区分直连 DeepSeek 服务商与 OpenRouter 等代理网关。
  5. 多币种与本地化:支持自定义货币符号(¥, $, , )、汇率换算与显示时区。

📦 快速安装

dsh plugin --profile web add @goodandready/dsh-cost-meter

重启 DeepSeek Harness 实例并刷新浏览器页面。


⚙️ 配置项说明 (settings.yaml)

dsh-cost-meter:
  currency: "¥"
  usdRate: 7.2
  displayTimeZone: "Asia/Shanghai"
  useOpenRouter: true
  prices: {}
  modelMap: {}

配置参数列表

| 参数项 | 类型 | 默认值 | 说明 | |:---|:---|:---|:---| | currency | string | "¥" | 显示的货币符号或代码 | | usdRate | number | 7.2 | 美元到目标货币的换算汇率 | | displayTimeZone | string | "Asia/Shanghai" | 界面中优惠时间段显示的参考时区 | | useOpenRouter | boolean | true | 是否加载 OpenRouter 价格表作为备用 | | prices | object | {} | 自定义每 1M Token 的费率覆盖 | | modelMap | object | {} | 模型别名映射表 |


🧪 自动化测试

运行单元测试套件:

npm test

📄 许可证

MIT © GooDAnDReaDY