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

@ericality/dsh-balance

v0.1.0

Published

Balance and cost dashboards for DSH: /balance, /balance-detail and /cost commands with live DeepSeek balance, usage deltas and banner output.

Downloads

17

Readme

@ericality/dsh-balance

Balance and cost dashboards for DSH — 斜杠命令 /balance /balance-detail /cost: 实时 DeepSeek 余额、间隔差值预估、累计用量与当前会话费用, 以结构化横幅展示 (零 token)。

安装

npm i @ericality/dsh-balance

需 dsh (DeepSeek Harness) 宿主环境;作为宿主插件加载 (server 插件, 无 client bundle)。

功能

  • /balance — 简洁版: 实时余额 / 间隔 (时间范围+时段) / 本次差值预估 / 官方扣费 (kind=balance 横幅, mode=overview)。
  • /balance-detail — 详细版: token 差值明细 + 运算过程 + 定价来源 + 累计 (mode=detail)。
  • /cost — 当前会话费用预估 (纯本地, 不打官方 API; mode=session); 树口径: 有 subagent 后代时聚合自身 + 全部后代 (dsh-cost-tree 缺失自动降级单会话)。
  • 横幅为非 surface 会话事件: 不进模型历史、不消耗模型 token。
  • 定价: 官方定价页解析 → 缓存 (<30min) → 内置常量; 时段按北京高峰/低谷分类。
  • 快照状态文件用于计算与上次运行之间的差值。

密钥与数据路径

API 密钥解析顺序: DEEPSEEK_API_KEY 环境变量 → 凭证 YAML 文件。凭证文件默认指向宿主数据目录下的 .credentials.yaml, 可用环境变量覆盖:

| 用途 | 默认 | 覆盖环境变量 | |---|---|---| | 凭证 YAML (含 DEEPSEEK_API_KEY: 字段) | /data/dsh/.credentials.yaml | DSH_BALANCE_CREDENTIALS_FILE | | 会话 projcache | /data/dsh/storages/session_projcache.json | DSH_BALANCE_PROJCACHE_FILE | | 快照/定价缓存 | /data/dsh/balance-state.json | DSH_BALANCE_STATE_FILE |

建议优先用 DEEPSEEK_API_KEY 环境变量注入密钥; 凭证文件路径亦可用 DSH_BALANCE_CREDENTIALS_FILE 指向自定义位置。

依赖

  • peer (宿主提供): @deepseek-ai/dsh-session。
  • optionalDependencies: @ericality/dsh-cost-tree (/cost 树口径; 缺失自动降级)。
  • 横幅渲染依赖同仓插件 @ericality/dsh-notice-banner。

许可

MIT