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-tide

v0.1.2

Published

DeepSeek Harness (DSH) 插件:在侧栏显示 DeepSeek API 余额,在聊天输入框下方显示峰谷(高峰/空闲)时段并提供官方定价入口。

Downloads

566

Readme

dsh-deepseek-balance-tide

一个 DeepSeek Harness (DSH) 的 Web 插件,用来随时看到两件事:

  1. 你的 DeepSeek API 余额(左下角、设置按钮旁边);
  2. 当前是「高峰期」还是「空闲时段」(聊天输入框正下方),并提供一个跳转官方定价页的入口。

余额通过 DSH 自身配置的 DEEPSEEK_API_KEY 实时查询官方 GET /user/balance 接口;Key 只在 Host 进程内使用,不会回传给浏览器。


效果

  • 左下角(设置正下方):一行 🪙 余额 ¥xx.xx,样式和「设置」按钮一致,点击可手动刷新,每 60 秒自动刷新一次。
  • 聊天输入框正下方:一张卡片 ⚡ 高峰期 · 原价 | 距切换 X 小时 Y 分钟 | 定价 ↗ 或 🌙 空闲时段 · 半价 …,每 30 秒刷新一次倒计时。
  • 定价 ↗ 点击后在新标签页打开官方定价页: https://api-docs.deepseek.com/zh-cn/quick_start/pricing/ alt text

说明:插件会顺带把聊天输入框下方那条系统统计行(7 轮 · 58 步 | LLM… | 输出…)改为自动换行、左右贴边,避免它被截断成 ...。如果你不想要这个附带效果,删除 lib/client.js 里 .FJxK0a_root{...} 这一行 CSS 后重新安装即可。


前置条件

  • 已安装并运行 DeepSeek Harness(Web 版)。
  • 在 DSH 的 设置 → 模型 中已配置 DEEPSEEK_API_KEY(provider 为 DeepSeek 官方)。

插件会直接复用这个 Key,无需额外配置。如果你的 DSH 用的是别的模型 provider、没有 DeepSeek 的 Key,余额处会显示「未配置 Key」。


安装

方式一:从 npm 安装(推荐,发布后)

dsh plugin --profile web add dsh-deepseek-balance-tide --ignore-scripts

安装后重启 DSH 让插件生效。

方式二:从 GitHub 安装

# 或直接用仓库地址
dsh plugin --profile web add git+https://github.com/YaoJunhaoya/dsh-deepseek-balance-tide.git --ignore-scripts

方式三:本地打包安装

# 在仓库目录打包
npm pack
# 安装生成的 tarball
dsh plugin --profile web add ./dsh-deepseek-balance-tide-0.1.0.tgz --ignore-scripts

--profile web 是默认 Web 配置文件;如果你的 profile 名不同,替换成实际的名字。


峰谷时段规则(北京时间 UTC+8)

| 时段 | 时间 | 价格 | | --- | --- | --- | | ⚡ 高峰期 | 周一至周五 09:00–12:00、14:00–18:00 | 原价 | | 🌙 空闲时段 | 其余所有时间(含午休、夜间)以及周末全天 | 半价 |

规则依据官方定价页(自 2026-08-17 起生效,周末全天空闲价自 2026-08-23 起生效)。


目录结构

dsh-deepseek-balance-tide/
├── package.json          # 包清单(dsh.client + dsh.bundle.patch)
├── cordis.patch.yml      # 宿主侧插件行声明(insert)
├── lib/
│   ├── index.js          # Host 半部:注册本地 /api/.../balance 路由,查余额
│   └── client.js         # Client 半部:classic-script bundle,渲染 UI
├── README.md
└── LICENSE

lib/ 已经是预构建产物,无需再跑构建步骤(本机没有 tsdown 也照样能用)。如果你后续想改成 TypeScript + tsdown 的源码工程,参考官方插件 dsh-liquid-glass-balance-card 的工程结构即可。


发布到 npm / GitHub

发布到 npm

npm login
npm publish --access public

发布前建议把 package.json 里的 repository 字段补成你的 GitHub 地址(可选,但推荐)。

上传到 GitHub

git init
git add .
git commit -m "feat: dsh-deepseek-balance-tide"
git remote add origin https://github.com/<你的用户名>/dsh-deepseek-balance-tide.git
git push -u origin main

推送前在 GitHub 仓库页面创建仓库,并补一个 .gitignore(忽略 node_modules/、*.tgz)。


常见问题

Q:左下角没有余额,显示「未配置 Key」? A:DSH 设置 → 模型里没配 DEEPSEEK_API_KEY。配置后重启 DSH 即可。

Q:显示「余额查询失败」? A:通常是网络问题或 Key 失效。检查网络,或确认该 Key 能访问 https://api.deepseek.com/user/balance。

Q:装了之后没看到 UI? A:DSH 插件改动需要重启 DSH 才生效。重启后若仍无,用 dsh plugin --profile web list 确认插件已启用。

Q:峰谷时间判断不准? A:本插件按北京时间(UTC+8)硬编码官方峰谷窗口。若 DeepSeek 官方改规则,需要更新 lib/client.js 里的 BOUNDS 与判定逻辑。


License

MIT