PeterZoneZz/dsh-token-cost ↗★ 1
@dsh-user/dsh-token-cost
DSH (DeepSeek Harness) web plugin: a draggable whale floating widget showing per-request token cost, session/total spend, and the official DeepSeek account balance
AI Analysis
核心用途是直观监控 API 消费情况。适合对大模型调用成本敏感,希望在界面右下角随时掌握当前对话花费及官方余额的 DSH 用户。余额查询需配置 API Key。
Install
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:PeterZoneZz/dsh-token-costREADME
Read the full README ↗4. 配置 API Key(余额查询)
余额查询复用 DSH 的 credentials 机制:在 DSH Web 的 模型设置页写入 DEEPSEEK_API_KEY,或启动 DSH 前 export DEEPSEEK_API_KEY=sk-...。不配置也不影响 token 用量与费用显示,仅余额部分显示降级提示。
⚙️ 配置
价格表与余额查询均可通过 profile 的 cordis.patch.yml 覆盖(价格单位为元 / 百万 tokens,按模型 id 匹配,未匹配回落 default;cacheWrite 按输入价计费,cacheRead 按缓存命中价计费):
- id: token-cost
config:
prices:
deepseek-chat: { input: 2, cacheRead: 0.5, cacheWrite: 2, output: 8 }
deepseek-reasoner: { input: 4, cacheRead: 1, cacheWrite: 4, output: 16 }
deepseek-v4-flash: { input: 1, cacheRead: 0.25, cacheWrite: 1, output: 4 }
default: { input: 2, cacheRead: 0.5, cacheWrite: 2, output: 8 }
balance:
enabled: true
apiKeyEnv: DEEPSEEK_API_KEY
baseUrl: https://api.deepseek.com
pollMs: 60000
🖱️ 使用
| 操作 | 效果 |
|---|---|
| 鼠标悬停鲸鱼 | 鲸鱼摇摆,外圈环形显示剩余余额百分比 |
| 点击鲸鱼 | 展开锚定卡片(余额 / 本次会话用量 / 累计花费) |
| 按住拖动 | 移动浮窗;靠近屏幕左右边缘松手自动吸附 |
点击卡片外部 / Esc / ✕ | 关闭卡片 |
| 卡片打开时拖动鲸鱼 | 卡片跟随移动,保持锚定 |