Skip to content
dsh.fish
Bundle

dsh-balance-peak

DeepSeek Harness 简洁余额 + 高峰时段指示:在输入框模型名(如 DeepSeek-V4-Flash)左侧显示 [红/绿圆点 + ¥余额],圆点红=高峰(09-12/14-18) 绿=空闲(半价)。余额来自官方 GET /user/balance。

Source
3yi2u34yu32
License
MIT
Updated
Updated 20 days ago

Readme

# dsh-balance-peak

DeepSeek Harness 简洁余额 + 高峰时段指示插件。

在输入框模型名(如 `DeepSeek-V4-Flash`)**左侧**显示一个简洁小板块:

```
[●] ¥123.45  DeepSeek-V4-Flash
```

- **圆点颜色**:红色 = 高峰时段(北京时间 09:00-12:00、14:00-18:00,全价 ×1.0);绿色 = 空闲时段(半价 ×0.5)。按 `Asia/Shanghai` 时区计算,并在时段边界(09:00/12:00/14:00/18:00)**整点精确变色**。
- **余额数字**:来自 DeepSeek 官方接口 `GET /user/balance`(免费、不消耗额度),每 60 秒自动刷新。
- **悬停提示**:鼠标悬停小板块,**向上弹出**高峰时段规则说明(当前时段 + 高峰/空闲时间表)。

## 用处

- 一眼看到当前账户余额,不用开网页查;
- 一眼看到现在是计费高峰还是空闲(空闲半价),决定要不要现在调模型。

## 效果展示

![效果展示 1](docs/screenshot-1.png)

![效果展示 2](docs/screenshot-2-v2.png)

![效果展示 3](docs/screenshot-3.png)

## 特性

- 无 UI 配置,装好即用(余额走 DSH 的 `credentials` 服务取 `DEEPSEEK_API_KEY`);
- 零 token 消耗(不调用模型);
- 轻量:页面脚本仅在需要时扫描定位模型名元素;
- 不依赖任何外部前端库。

## 安装

```sh
# 桌面版(DSH Desktop)
node "D:\Program Files\DSH Desktop\resources\app.asar.unpacked\node_modules\@deepseek-ai\dsh\lib\bin.js" plugin --profile desktop add link:<本目录绝对路径>

# 或 dsh web
dsh plugin --profile web add link:<本目录绝对路径>
```

重启后生效。

## 环境要求

- `DEEPSEEK_API_KEY`(Settings → Models,或 `~/.dsh/.credentials.yaml`)
- `curl`(Windows 10+ 自带)

## 技术实现

- Host(`lib/index.js`):注册 `/balance-peak/balance`(curl 调官方余额接口)与 `/balance-peak/script.js`,并通过 `webServer.tapIndex` 注入页面脚本。
- 页面脚本(`lib/script.js`):定位输入框模型名元素 → 插入小板块 → 轮询余额、边界定时切换圆点、hover 提示。
- 余额获取逻辑参照 MIT 协议的 [dsh-whale-balance](https://github.com/enchangcui340-cloud/dsh-whale-balance)。

## License

MIT

Install

dsh plugin --profile web add github:3yi2u34yu32/dsh-balance-peak

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source