KIDLi1412/dsh-session-cost ↗★ 3

@kidli1412/dsh-session-cost

DSH web plugin: a status bar at the bottom of the conversation showing the estimated API cost of the current session (per-model token pricing, CNY) plus the live DeepSeek account balance queried through the official balance API. 适合需要紧密监控API余额、防止因欠费导致服务中断的用户。

パッケージ
@kidli1412/dsh-session-cost
互換性
未検証
Harness ピア範囲
^0.1.5-rc.1
バージョン
0.2.7
ライセンス
MIT
最終更新
2026/09/14

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:KIDLi1412/dsh-session-cost

ドキュメント

README 全文を読む ↗

~/.dsh/settings.yaml 或 profile 插件配置

session-cost: pricing: deepseek-v4-flash: input: 1 cacheRead: 0.02 cacheWrite: 1 output: 2 # 或分时段(offpeak/peak 各自覆盖,未给字段继承默认): # deepseek-v4-pro: # offpeak: { input: 4.5, output: 13.5 } # peak: { input: 9, output: 27 }


`pricing` 与配置卡写入的 `lowBalanceThreshold` 共存于同一个 `session-cost:` section,互不覆盖(schemastery 解析保留未知键;`pricing` 仍由服务端从插件 config 读取)。

## 安全

- 两个端点均为 loopback-only 精确路由(peer socket 地址 + Host 双重校验),浏览器同源调用。
- API Key 不落盘:请求时经 credentials 缝解析 `llm-deepseek` 命名空间的 `apiKeyEnv`(默认 `DEEPSEEK_API_KEY`)。
- 余额缓存仅存于内存,2 分钟 TTL。

## License

MIT