Skip to content
dsh.fish
Bundle

@pinkbanana/dsh-balance

DeepSeek Harness plugin for API balances, models, and multidimensional usage billing

Source
crazywoola
stars
27 stars
License
MIT
Updated
Updated 2 days ago

Readme

# dsh-balance

[简体中文](./README.md) | [English](./README_EN.md)

DeepSeek Harness 插件,用于查询 API 余额、当前可用模型和多维消费统计。API Key 仅由本机 Host 使用,不会发送到浏览器。

![DeepSeek 余额设置面板](./docs/dsh-balance-settings-v040.png)

![聊天框下方的 DeepSeek 余额](./docs/dsh-balance-composer-v040.png)

## 功能

- 查看总余额、充值余额和赠送余额
- 在聊天框下方持续显示余额摘要
- 查看当前 API Key 可用的模型
- 在设置页按模型、会话和日期查看实际 usage 消费,并在当前会话的“消费”Tab 查看请求明细
- 缺少 provider usage、未知 provider 或未知模型时标记为“未计费”,不进行 token 估算
- 日期按浏览器 IANA 时区分组;DeepSeek 峰谷价格始终按北京时间计算
- 默认显示 USD;配置 `usdToCny` 后额外显示固定汇率换算的 CNY
- 缓存查询结果并支持手动刷新
- 依据 DeepSeek 峰谷定价,在高峰时段(北京时间 9:00–12:00、14:00–18:00)将聊天框下方的余额指示灯变为橙色
- 原生支持简体中文和英文,并跟随 Harness 系统语言切换
- 支持 Harness 已保存的 `DEEPSEEK_API_KEY`

## 安装

```bash
dsh plugin --profile web add @pinkbanana/dsh-balance@latest
dsh --profile web
```

打开 <http://127.0.0.1:3080/>,进入“设置 → DeepSeek 余额”。该入口位于“Agent 预设”下方,余额摘要也会显示在已有会话的聊天框下方。API Key 可在“设置 → 模型”中保存,或通过 `DEEPSEEK_API_KEY` 环境变量提供。

消费统计从已保存会话和当前运行中的 live session 读取,不展示 prompt 内容。可在插件配置中增加固定汇率,例如:

```yaml
usdToCny: 7.2
```

## 开发

```bash
pnpm install
pnpm check
```

## License

[MIT](./LICENSE)

<a href="https://www.buymeacoffee.com/pinkbanana"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Crazywoola a coffee" width="199" height="55" /></a>

Install

dsh plugin --profile web add github:crazywoola/dsh-balance

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source