DeepSeek Harness plugin

dsh-usage-cost-fflow202

Very lightweight DeepSeek Harness plugin: per-session + global API cost stats with peak/off-peak pricing (DeepSeek V4 Flash / V4 Pro)

Jump to install

Source facts

Repository
fflow2023/dsh-usage-cost
Latest update
Aug 14, 2026
Category
Memory
GitHub stars
1
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/fflow2023/dsh-usage-cost
Plugin: dsh-usage-cost-fflow202
Author: fflow2023

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-usage-cost

一个轻量的 DeepSeek Harness 插件:会话级 + 全局的 API 费用统计

它是什么

一个只读的费用估算器,把「当前会话累计花了多少钱」并进底部那行 token 统计,再给设置页加一个「全局累计费用」面板。

核心实现只有一件事:一个 session projection 单元,在既有的 session/event 回放驱动上做 O(1) 折叠。所有数字都从持久会话日志重放得出——重启、冷读都能恢复,每个会话各自独立累计。

功能

1. 会话底部(与 token 统计同一行)… 输入/输出 token | 费用 ¥x.xx(高峰 ¥p / 闲时 ¥o)

2. 设置 → 费用统计:全局累计费用、高峰/闲时拆分、按模型(V4 Pro / V4 Flash)拆分、按会话降序列表。

安装

标准的 dsh bundle 插件,一条命令永久安装(无需手改任何 cordis.yml):

# 从 GitHub 安装(需要为构建授权一次,见下)
dsh plugin --profile web add github:fflow2023/dsh-usage-cost

# 或发布到 npm 后:
dsh plugin --profile web add @fflow2023/dsh-usage-cost

源码 checkout 环境把命令换成 pnpm dsh plugin --profile web add ...。第一次从 git 安装时,pnpm 会提示把生成的 allowBuilds 键复制进该 profile 的 pnpm-workspace.yaml,然后重跑一次即可。之后 dsh 会把本包追加进 dsh.profile.bundles,host 投影与浏览器半部分(底部费用行 + 设置页)同时生效,重启永久保留。

计费规则

单位:元 / 百万 tokens,按 2026-08-17 00:00(北京时间)生效的峰谷价。来源:DeepSeek 模型 & 价格

模型时段输入·缓存命中输入·缓存未命中输出
deepseek-v4-flash空闲0.051.54.5
高峰0.103.09.0
deepseek-v4-pro空闲0.154.513.5
高峰0.309.027.0
  • 高峰时段:北京时间 9:00–12:00、14:00–18:00;其余为空闲(高峰的一半)。
  • 高峰/闲时按每次请求的 request/header 时间戳(UTC+8)判定。
  • token 口径:cacheReadTokens → 缓存命中;inputTokens → 缓存未命中(DeepSeek 的 prompt_tokens 已减去命中量);outputTokens → 输出;DeepSeek 不报告 cache-write,按 0。
  • 只对 deepseek-v4-prodeepseek-v4-flash 计费;其它模型计入 unpricedTokens静默按错价。

涨价后如何更新

所有价格集中在 [index.js](index.js) 的 PRICES 一处。价格变动时只改这一个文件、bump 版本号即可,无需改其它代码。

轻量设计

  • 纯 JS、零构建、零运行时依赖:没有 TypeScript 构建步骤、没有 prepare 构建脚本,clone 即用。
  • Host:1 个 projection 单元,每个事件 O(1),无额外订阅/定时器/RPC/持久化。
  • Client:2 个 slot 注册,无 store、无副作用、无本地状态。

Model Experience

Request context and condition

#### What the model sees

本插件不向模型注入任何提示、schema、工具或消息。

#### Token effect

零直接 token 影响(只读投影)。

#### KV Cache effect

不影响请求前缀,不使缓存失效。

License

[MIT](LICENSE)