Skip to content
dsh.fish
Bundle

dsh_deepseekapi_quota

DeepSeek API 余额与价格时段(高峰/闲时)侧边栏底部显示插件,用于 DeepSeek Harness WebUI

Source
JRNitre
License
MIT
Updated
Updated 12 hours ago

Readme

# dsh_deepseekapi_quota

DeepSeek API 余额与价格时段(高峰/闲时)插件,用于 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) WebUI(`dsh web`)。

在左侧边栏底部(设置按钮上方)显示:

![](image/image_1.png)

- **账户余额**:来自 `GET https://api.deepseek.com/user/balance`。API Key 通过 DSH 凭证机制解析(默认引用 `DEEPSEEK_API_KEY`)
- **价格时段**:高峰 = 北京时间 09:00–12:00 / 14:00–18:00;闲时 = 其余时段(半价)。数据源:<https://api-docs.deepseek.com/zh-cn/quick_start/pricing>
- 每分钟自动刷新;点击单元立即刷新;悬浮显示余额明细与时段说明
- 仅在侧边栏宽栏时显示(56px 窄栏隐藏)

## 前提

- 已安装 DeepSeek Harness 并可用 `dsh web`
- 机器上可用 `git` 与 `pnpm`(`dsh plugin` 是 pnpm 转发器)

## 安装(从 GitHub)

```sh
# 安装默认分支最新提交
dsh plugin --profile web add github:jrnitre/dsh_deepseekapi_quota

# 或固定到某个版本标签(推荐给生产使用)
dsh plugin --profile web add github:jrnitre/dsh_deepseekapi_quota#v0.1.0
```

安装完成后**重启 `dsh web`** 生效。

`dsh plugin` 安装时会自动完成两件事:

1. pnpm 把该包写入 profile(`%DSH_HOME%/profiles/web`)的 `package.json` `dependencies`
2. 因包声明了 `dsh.bundle.patch`,DSH 会把它追加到 `dsh.profile.bundles` 层列表并应用其 `cordis.patch.yml`

可用 `dsh --dump-config`(组合后的配置树应出现 `id: deepseek-status` 行)核对是否加载。

> 本包不包含任何构建脚本(`lib/` 为发布产物),因此 git 安装不会被 pnpm 的 build-script 审批(`allowBuilds`)拦住。

## 配置(可选)

默认无需配置。如需覆盖 API 地址,编辑 `%DSH_HOME%/profiles/web/cordis.patch.yml`:

```yaml
- insert:
    - id: deepseek-status
      name: 'dsh_deepseekapi_quota'
      inject: [webServer]
      config:
        baseUrl: 'https://api.deepseek.com'
```

API Key 的配置方式:在 DSH 设置/凭证中配置 `DEEPSEEK_API_KEY`,或设置同名环境变量。

## 更新

```sh
dsh plugin --profile web update dsh_deepseekapi_quota
# git 依赖若未拉取新提交,可 remove 后重新 add
```

## 卸载

```sh
dsh plugin --profile web remove dsh_deepseekapi_quota
```

之后重启 `dsh web`。

## 本地安装 / 开发

```sh
# 在仓库目录内执行,作为本地依赖链接安装
dsh plugin --profile web add .
```

## 结构

- `cordis.patch.yml` — bundle patch:插入插件行(`inject: [webServer]`)
- `lib/index.js` — 宿主半部:注册 `GET /dsh-deepseek-status` 路由(余额 + 时段计算)
- `lib/client.js` — 浏览器半部:`sidebar.footer.action` 状态单元

## 许可

MIT License,版权归原作者所有。详见 [LICENSE](LICENSE)。

Install

dsh plugin --profile web add github:JRNitre/dsh_deepseekapi_quota

Profile: web

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