rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
Suiwan/whale-purse
A cute whale desktop pet for DeepSeek Harness that keeps an eye on your DeepSeek balance and session usage/cost. Drag her anywhere, click to open a live panel with real-time spend, peak/off-peak pricing, budget alerts, and history trends.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Suiwan/whale-purse
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
一只住在 DeepSeek Harness(DSH)里的鲸鱼娘桌宠,帮你盯着 DeepSeek 账户余额和当前会话的用量/花费。
把「DeepSeek 余额 + 会话 token 用量/预估花费」做成一只可拖拽的二次元鲸鱼娘,浮在 DSH Web GUI 上。点她弹出用量明细面板(当前 / 历史双 Tab),拖她换位置,位置自动记住;余额 30s、花费 3s 自动刷新。

A cute whale desktop pet for DeepSeek Harness that keeps an eye on your DeepSeek balance and session usage/cost. Drag her anywhere, click to open a live panel with real-time spend, peak/off-peak pricing, budget alerts, and history trends.
localStorage 记忆,刷新/重开保持),点击开面板Get User Balance 接口,30s 轮询 + 并发去重;请求失败保留上次快照并提示过期model / 低余额阈值 / 今日预算,保存到本地 JSON,无需手改 YAMLsessionProjections 的 tokenUsage 投影,按官方价格折算花费(输入未命中 / 缓存命中 / 输出三桶,分桶条形图按金额占比绘制、每桶标注 token 数、金额与金额占比,避免缓存命中 token 占大头却几乎不花钱的误导;DeepSeek 官方没有「缓存写入」计费类别,故不展示该桶);model: auto 时按会话实际请求头识别 flash/pro,识别为非 DeepSeek 模型(如 GPT / Claude)的会话不估算花费;已落盘消息按各自发生时的峰谷档与模型计价,进行中增量按当前档计价;DSH「在新会话中新建分支」checkout 出的历史 seed 不会重复计费,只统计新建分支后的新增用量sessionPersistence 时自动合并已保存会话)+ 本会话每条提问的花费明细(多步循环自动合并成一行,问题前 10 字 + Tokens + 花费)--dsw-alias-* token)This operation was aborted把本仓库软链进你的 DSH web profile 依赖:
ln -s /path/to/whale-purse ~/.dsh/profiles/web/node_modules/whale-purse
在 ~/.dsh/profiles/web/cordis.patch.yml 里加一条 insert:
- insert:
- id: whale-purse
name: 'whale-purse'
config:
model: auto # auto | pro | flash
refreshIntervalSeconds: 30
lowBalanceThreshold: 20 # 余额低于 20 元时提醒(可不写,默认 10)
dailyBudget: 5 # 今日花费超过 5 元时提醒(可不写,默认不提醒)
保存后刷新浏览器即可(Cmd+Shift+R)。
余额接口需要能解析到 DEEPSEEK_API_KEY(凭据缝 → 启动环境 → process.env,逐层回退)。
推荐在鲸鱼娘面板右上角点 ⚙ 设置 修改
model、低余额阈值、今日预算;保存后写入~/.dsh/whale-purse.settings.json,优先级高于下面 YAML 里的同名配置,无需重启。
| 字段 | 默认 | 说明 |
|---|---|---|
model |
auto |
计价模型:auto(按会话实际请求头识别;非 DeepSeek 模型不估算花费)/ pro / flash |
refreshIntervalSeconds |
30 |
余额轮询间隔(秒) |
apiKeyEnv |
DEEPSEEK_API_KEY |
API key 的环境变量名 |
baseUrl |
https://api.deepseek.com |
余额接口 base URL |
pricingRefreshHours |
6 |
官方定价页抓取间隔(小时) |
lowBalanceThreshold |
10 |
余额低于该值(CNY)时触发低余额提示 |
dailyBudget |
未设置 | 今日花费预算(CNY),超过后面板提示 |
enabled |
true |
是否启用余额查询 |
whale-purse/
├── lib/
│ ├── index.js # host 端:余额服务 + HTTP 路由(/api/whale-purse/balance、/api/whale-purse/balance/daily、/api/whale-purse/balance/messages、/api/whale-purse/settings)
│ └── client.js # 浏览器端:鲸鱼娘桌宠 + 双 Tab 面板(WebP 立绘 base64 内联)
├── assets/
│ ├── whale-sprite.webp # 内联立绘(280×373,透明,约 41KB)
│ ├── whale-sprite.png # 鲸鱼娘立绘源 PNG(280×373,透明)
│ ├── whale-front-source.png # 立绘源图
│ └── preview.png # 预览图
└── scripts/
├── embed-asset.mjs # 把 whale-sprite.webp/png 重新内联进 lib/client.js
├── screenshot.mjs # Playwright 截图脚本
└── smoke-test.mjs # 模型识别/计价逻辑冒烟测试(node scripts/smoke-test.mjs)
whale-sprite.webp 由 PNG 源图生成:cwebp -q 90 -alpha_q 100 -m 6 assets/whale-sprite.png -o assets/whale-sprite.webp。改完素材后运行 npm run embed 重新内联。
children 表声明,原先在声明就绪前直接 slots.register('shell.overlay', …) 会抛 slot "shell.overlay" is not declared (a parent entry's children table must declare it),而该错误被宿主吞掉(不落控制台),表现为余额接口正常、浏览器半边也加载了,但桌宠不渲染;现改为 slots.inject('shell.overlay', …) 等待式注册(宿主没有该 API 时回退为直接注册,0.1.x 行为不变)scripts/smoke-test.mjs 冒烟测试,覆盖模型识别、分支 seed 跳过与混合模型计价CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。