DeepSeek Harness 插件

dsh-session-cost-ljcscp

DeepSeek account balance and session-cost readout for the DeepSeek Harness Web GUI: official balance endpoint, auto-fetched official pricing with peak/off-peak hours, per-model costing (flash/pro).(英文原文)

跳到安装方式

来源信息

GitHub 仓库
ljcscp/dsh-session-cost
最近更新
2026年8月14日
分类
记忆
GitHub stars
1
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/ljcscp/dsh-session-cost
插件名:dsh-session-cost-ljcscp
作者:ljcscp

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-session-cost

DeepSeek account balance and session-cost readout for the DeepSeek Harness (DSH) Web GUI.

  • Account balance — queries the official GET /user/balance endpoint (the API key stays on the host, resolved per refresh through the DSH credentials seam)
  • Session spend — token usage × official DeepSeek prices, auto-fetched from the official pricing page every 6h, so price changes never require a plugin update
  • Peak/off-peak pricing — the 2026-08-17 rollout is applied automatically: peak hours 09:00-12:00 / 14:00-18:00 (Beijing), off-peak at half price
  • Per-model costing — the session's actual model (deepseek-v4-flash / deepseek-v4-pro) is read from the newest assistant message's provenance and priced at its own bucket

The composer dock shows one readout under the shipped stats line:

本会话 ¥0.90 · 余额 ¥30.82

Hover for the breakdown (input / cache read / output, model, pricing source) and the balance split (granted + topped up).

Requirements

  • DeepSeek Harness 0.1.0-rc.5 or newer (web profile)
  • A DeepSeek API key stored through the DSH credentials seam (DEEPSEEK_API_KEY — the web Models page writes it)

Installation

From a git URL (no npm account needed):

dsh plugin --profile web add https://github.com/ljcscp/dsh-session-cost

From npm:

dsh plugin --profile web add @ljcscp/dsh-session-cost

From a local checkout (development):

git clone https://github.com/ljcscp/dsh-session-cost.git
dsh plugin --profile web add link:$(pwd)/dsh-session-cost

Restart dsh web, then refresh the page. The readout appears in the composer dock below the conversation stats line.

Configuration

Zero-config by default. Optional composition settings:

- insert:
    - id: session-cost
      name: '@ljcscp/dsh-session-cost'
      config:
        refreshMs: 60000          # balance cache lifetime (ms)
        pricingRefreshHours: 6    # official-pricing page refresh cadence
        apiKeyEnv: DEEPSEEK_API_KEY
        baseURL: https://api.deepseek.com
KeyTypeDefaultMeaning
refreshMsnumber60000Balance cache lifetime in ms (failures retry after 10s)
pricingRefreshHoursnumber6Hours between official-pricing page refreshes
apiKeyEnvstringDEEPSEEK_API_KEYCredential ref storing the DeepSeek API key
baseURLstringhttps://api.deepseek.comEndpoint base; /user/balance is appended
trustedHostsstring[][]Non-loopback authorities served beyond the trust fence

How it works

  • Host half (src/index.ts): registers one trusted webserver route /session-cost that serves the balance snapshot (cached refreshMs) and the effective pricing snapshot (official page parsed per pricingRefreshHours, peak/off-peak band applied by the current Beijing hour once the rollout is live). The API key never leaves the host.
  • Browser half (src/client/): a conversation.composer.dock entry that reads the tokenUsage projection, detects the session's model from the newest assistant provenance, applies the effective bucket, and renders the readout — refreshed every minute.

Cost formula (matches the official billing rule 扣减费用 = token 消耗量 × 模型单价):

spend = uncachedInput × inputPerMillion + cacheRead × cacheReadPerMillion + output × outputPerMillion   (per 1M tokens)

Cache writes bill at the uncached input rate (DeepSeek reports only hit/miss buckets). The readout is an estimate at official rates; the official bill on platform.deepseek.com/usage lags by a few minutes of settlement.

License

MIT. The browser-bundle build preset (shared/) is adapted from dsh-balance-meter (BSD-3-Clause), which adapted it from deepseek-harness (MIT).