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-deepseek-balance-cn

v0.1.0

Published

DeepSeek balance and session cost widget for the dsh web GUI, pinned to the sidebar foot.

Readme

dsh-deepseek-balance-cn

DeepSeek Harness(dsh)Web GUI 插件:在**侧边栏底部(设置入口上方)**显示 DeepSeek API 余额,点击展开详情。

npm 包名 dsh-deepseek-balance-cn(原名 dsh-deepseek-balance 已被占用)。

基于 DeepSeek Harness 的插件架构(一切皆插件)编写,纯 JavaScript、零构建步骤。

截图

screenshot

功能

  • 左下角入口:$ 图标 + “余额”标签,风格与“设置”入口对齐(间距、高度、圆角一致)
  • 点击展开详情:总余额、可用状态、赠送余额、当前对话费用
  • 当前对话费用:Host 侧按官方价格表对每条消息实时计价,并回放持久化日志(重启后历史费用不丢失)
  • 手动 + 自动刷新:详情面板内置 ↻ 刷新按钮;余额每 60s、对话费用每 5s 自动刷新
  • 响应式:详情面板宽度跟随侧边栏拉伸;窄栏(56px rail)下只显示 $ 图标
  • 明暗主题:全部使用 --dsw-* 设计 token,自动跟随浅色/深色模式
  • 安全:API key 只在 Host 侧解析,浏览器拿不到明文

安装

方式一:从 npm(发布后)

dsh plugin --profile web add dsh-deepseek-balance-cn

方式二:本地安装

git clone https://github.com/angus-guo/dsh-deepseek-balance.git
cd dsh-deepseek-balance
dsh plugin --profile web add .

安装后重启并刷新页面:

dsh web

浏览器侧 bundle 在 dsh web 重启时重新生成,请硬刷新页面(Cmd + Shift + R)。

前置条件

  • 已在 设置 → 模型 中配置 DeepSeek API Key(存储在 ~/.dsh/.credentials.yaml,或通过环境变量 DEEPSEEK_API_KEY 提供)。

使用

  • 侧边栏底部会多出一行 $ 余额(位于“设置”上方),右侧显示当前总余额。
  • 点击该行展开详情面板,再次点击收起。
  • 详情面板字段:

| 字段 | 含义 | 来源 | |---|---|---| | 余额(大字) | 总余额 | /user/balance | | 可用 / 不可用 | 账户是否可调用 API | /user/balance 的 is_available | | 赠送 | 赠送(赠金)余额 | /user/balance 的 granted_balance | | 当前对话 | 当前会话累计费用 + token 数 | 本地按价格表计价 |

数据来源

  • 余额:DeepSeek 公开接口 GET /user/balance。
  • 当前对话费用:订阅 session/event,对每条 assistant/message 按 TokenUsage × 单价 / 1M 计价,并回放持久化日志补齐重启前的历史。

价格表

价格数据维护在 src/pricing.js,整理自 DeepSeek 官方定价页。含峰谷定价(北京时间 9:00–12:00、14:00–18:00 为高峰)。官方调价时更新 RATES 即可。

目录结构

src/
├── index.js      # Host 半:/api/quota(余额)+ /api/quota/session(会话费用)
├── pricing.js    # 价格表 + 峰谷判定 + 计价
└── client.js     # 浏览器半:侧边栏底部入口 + 详情面板
cordis.patch.yml  # bundle patch 层

已知限制

  • 计价仅按 CNY 单价;USD 账户的余额按 currency 显示符号,费用仍按 CNY 计。
  • 价格表只维护当前价格(不含历史调价),用于“当前对话费用”的近似计算。
  • 会话费用只统计本机 dsh 会话的消费,不含 platform 网页或其他工具的消费。

License

MIT