GuoFengyu110429/dsh-high-fee-alert ↗★ 2

dsh-high-fee-alert

在高峰时段弹出资费提醒窗口 适合需要实时监控DeepSeek API最新定价并避免在高峰期产生高额资费的用户。

包名
dsh-high-fee-alert
兼容性
待验证
版本
0.1.0
许可证
MIT
最近更新
2026年8月25日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:GuoFengyu110429/dsh-high-fee-alert

建议使用npm安装

dsh plugin add --profile web dsh-high-fee-alert

或使用github仓库安装

dsh plugin --profile web add "file:D:/Deepseek Harness/chajian/dsh-high-fee-alert"


安装后**重启 DSH** 生效(profile 在启动时扫描 bundle 层)。

卸载:

```powershell
dsh plugin --profile web remove dsh-high-fee-alert

配置

全部配置项均可在 profile 的 cordis.patch.yml 中按行 id 覆盖 (dsh-high-fee-alert),均有内置默认值:

配置项默认值说明
pricingUrlhttps://api-docs.deepseek.com/quick_start/pricing定价文档地址
ntpHostntp.ntsc.ac.cnNTP 服务器
ntpPort123NTP 端口
ntpTimeoutMs2500NTP 超时
fetchTimeoutMs8000定价文档抓取超时
pricingRefetchMs21600000定价刷新间隔(6h)
exitCode0「好的」退出码
peakWindows[]显式高峰窗口(北京时间 HH:mm-HH:mm 数组,覆盖文档解析)
weekdaysOnlynull高峰是否仅限周一至周五(布尔;缺省跟随文档/回退)
offPeakStart''旧语义:每日低谷开始(北京时间 HH:mm,反推高峰)
offPeakEnd''旧语义:每日低谷结束(北京时间 HH:mm)

示例(固定工作日 09:00–18:00 为高峰):

- id: dsh-high-fee-alert
  config:
    peakWindows:
      - '09:00-12:00'
      - '14:00-18:00'
    weekdaysOnly: true

HTTP 接口(同源)

方法路径说明
GET/dsh-high-fee-alert/status当前时间、是否高峰、高峰窗口、下一非峰时刻、数据来源
POST/dsh-high-fee-alert/exit关闭前后端;仅接受同源 POST(Origin == Host)

结构

dsh-high-fee-alert/
├── package.json          # dsh.bundle + dsh.client 声明
├── cordis.patch.yml      # bundle patch:插入宿主行(inject: [webServer])
├── index.js              # 宿主端入口:路由、退出、缓存
├── lib/
│   ├── ntp.js            # NTPv4 客户端与报文解析
│   ├── pricing.js        # 定价文档抓取/解析(新旧两种格式)/回退
│   └── schedule.js       # 高峰窗口纯逻辑(多段窗口 + 工作日限定)
├── client/client.js      # 浏览器端 bundle(__ModuleLoader__ 工厂格式)
├── demo/popup-demo.html  # 弹窗视觉规格静态演示页(npm 打包不含此目录)
└── test/logic.test.mjs   # node --test 单元测试
    test/client.test.mjs  # jsdom 弹窗渲染测试(缺依赖时自动跳过)

开发验证

node --test test/

test/client.test.mjs(jsdom 弹窗渲染测试)需要 react、react-dom、 jsdom:优先从当前 DSH 的 profile node_modules($DSH_HOME/profiles/web) 解析,也可安装到插件旁的 .test-deps 目录;三者均不可用时该测试自动跳过:

npm install --prefix .test-deps --no-save jsdom react react-dom

配置

全部配置项均可在 profile 的 cordis.patch.yml 中按行 id 覆盖 (dsh-high-fee-alert),均有内置默认值:

配置项默认值说明
pricingUrlhttps://api-docs.deepseek.com/quick_start/pricing定价文档地址
ntpHostntp.ntsc.ac.cnNTP 服务器
ntpPort123NTP 端口
ntpTimeoutMs2500NTP 超时
fetchTimeoutMs8000定价文档抓取超时
pricingRefetchMs21600000定价刷新间隔(6h)
exitCode0「好的」退出码
peakWindows[]显式高峰窗口(北京时间 HH:mm-HH:mm 数组,覆盖文档解析)
weekdaysOnlynull高峰是否仅限周一至周五(布尔;缺省跟随文档/回退)
offPeakStart''旧语义:每日低谷开始(北京时间 HH:mm,反推高峰)
offPeakEnd''旧语义:每日低谷结束(北京时间 HH:mm)

示例(固定工作日 09:00–18:00 为高峰):

- id: dsh-high-fee-alert
  config:
    peakWindows:
      - '09:00-12:00'
      - '14:00-18:00'
    weekdaysOnly: true