shxiaooo/dsh-account-quota ↗★ 0
dsh-account-quota
DeepSeek Harness web plugin: an ambient balance/limit reading under the composer, showing upstream-reported DeepSeek balance and OpenCode Go usage, plus a day’s spend folded from the balance deltas the host samples.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:shxiaooo/dsh-account-quota说明文档
阅读完整 README ↗配置
顶层字段:
| 字段 | 默认值 | 说明 |
|---|---|---|
requestTimeoutMs | 10000 | 单次上游请求超时(覆盖响应体读取,不只是建立连接) |
maxResponseBytes | 65536 | 上游响应体上限;边读边判,超限即中止传输 |
cacheMs | 60000 | 快照新鲜度下限,同时是 Host 半的采样周期(见下) |
statePath | $DSH_HOME/account-quota/state.json | 余额序列落盘位置;$DSH_HOME 未设置时回退 ~/.dsh |
cacheMs 同时承担两个角色,因为它们问的是同一个问题 —— 「账户的画面可以有多旧」:
定时采样按这个周期把缓存填上,而周期内的 HTTP GET 直接从内存应答,不再打上游。
代价是与浏览器是否打开无关的固定请求量:默认 60000 即每个适配器每天约 1440 次
(一天两次请求合计约 2880 次)。它换来的是当天起点能落在零点附近,而不是「用户早上
第一次打开界面的时刻」。另外,未知的配置键会直接报错而不是被忽略。
提供方适配器:
- id: account-quota
config:
cacheMs: 60000
providers:
deepseek:
kind: tokens
displayName: DeepSeek 官方
apiKeyEnv: DEEPSEEK_API_KEY
balanceUrl: https://api.deepseek.com/user/balance
currency: CNY
deepseek-go:
kind: plan
displayName: OpenCode Go
apiKeyEnv: OPENCODEGO_API_KEY
usageUrl: https://opencode.ai/zen/go/v1/usage
rollingLabel: 5 小时 # 上游窗口策略,非本插件常量
kind: plan要求usageUrl返回usage.rolling|weekly|monthly。kind: tokens要求balanceUrl返回{ is_available, balance_infos: [...] }。rollingLabel是滚动窗口的显示名。窗口长度属于上游策略,故可配置而非硬编码。- 写
providers会替换内置表而不是追加:本部署的两个路由就是内置表。 合并会把没配置的默认项留成真实适配器,而它要的凭据恰恰是自带providers的部署不会设置的 —— 那一行只会显示「凭据未配置」,白占位置。 要保留内置的某一项就照抄一遍(patch 本来也必须重写整份config)。