TokenLedger
zh667
Relay-site attributed token usage for DeepSeek Harness — zero config, no credentials
ruby1304/dsh-quota-status
DeepSeek Harness web plugin: minimal quota/balance card — DeepSeek API balance with tier colors & peak/off-peak pricing pill, Kimi For Coding weekly + 5h windows with live reset countdowns. zh/en, loopback-only RPC, keys never leave the host.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:ruby1304/dsh-quota-status
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness (DSH) web 插件:在一个极简卡片里实时查看 DeepSeek API 余额、Kimi For Coding 套餐余量(周限 + 5 小时窗口)与 ChatGPT(Codex)订阅限流窗口,带剩余量、进度条、重置倒计时和 DeepSeek 波峰/波谷电价提醒。
A DeepSeek Harness (DSH) web plugin: one minimal card for the DeepSeek API balance, the Kimi For Coding plan quota (weekly + 5h windows) and ChatGPT (Codex) subscription rate limits — remaining amounts, progress bars, reset countdowns, and a DeepSeek peak/off-peak pricing reminder.


DEEPSEEK_API_KEY 与 KIMI_CODING_API_KEY(经 dsh credentials seam,密钥永不进入浏览器)。--dsw-alias-*),自动适配深浅主题。authority: loopback),API Key 只在宿主进程解析与使用。dsh plugin --profile web add dsh-quota-status
dsh web
也可以手动加入 profile:
dsh-quota-status是 bundle,会通过cordis.patch.yml插入quota-status行。
默认无需任何配置。在 ~/.dsh/profiles/web/cordis.patch.yml 里可以按行覆盖:
- id: quota-status
config:
refreshMs: 30000 # 默认 60000
timeoutMs: 15000 # 上游查询超时
warnBalance: 30 # DeepSeek 余额低于 30 变黄
criticalBalance: 10 # 低于 10 变红
warnUsagePercent: 40 # Kimi 余量低于 40% 变黄
criticalUsagePercent: 15 # 低于 15% 变红
codexBinary: cliproxyapi # 设置页「登录 ChatGPT」调用的本机程序
codexConfigPath: ~/.cli-proxy-api/config.yaml
providers:
- id: deepseek
label: DeepSeek
kind: deepseek-balance
credential: DEEPSEEK_API_KEY
endpoint: https://api.deepseek.com/user/balance
- id: kimi-coding
label: Kimi Coding
kind: kimi-usage
credential: KIMI_CODING_API_KEY
endpoint: https://api.kimi.com/coding/v1/usages
# ChatGPT 订阅(可选,需本地 CLIProxyAPI 网关已登录 codex):
# 读网关本地 OAuth 授权文件,查询官方 wham/usage 的 5h/周限窗口。
- id: codex-sub
label: ChatGPT
kind: codex-usage
credential: '' # codex-usage 无需 env 凭证
endpoint: https://chatgpt.com/backend-api/wham/usage
authDir: ~/.cli-proxy-api # codex-*.json 所在目录,取最新未禁用文件
providers 列表会整体替换默认列表;kind 支持 deepseek-balance、kimi-usage 与 codex-usage。codex-usage 行只在宿主进程读取 CLIProxyAPI 的本地 OAuth 授权文件(access_token + account_id),token 绝不进入浏览器或任何响应。
统一卡片声明 root-scoped list Slot dsh-quota-status.extra-row。其他本机插件可以向该 Slot 注册额外配额行,并通过 Slot owner 的 renderRow() 提交业务无关、归一化后的 meter 展示数据(名称、已用、上限、剩余百分比、单位、重置时间和阈值)。本插件统一负责布局、展开交互、键盘语义、金额与倒计时格式、进度条及警告颜色。
额外插件应在自己的 Host 中查询上游和处理业务规则,Client 只接收归一化展示数据。凭证、token、API key 和 Authorization header 不得通过 RPC 或 Slot props 传递。卸载任一插件时,Cordis 会随父注册或扩展注册的 disposer 清理对应 Slot 生命周期。
| Provider | Endpoint | Meaning |
|---|---|---|
| DeepSeek | GET https://api.deepseek.com/user/balance |
可用余额(充值 + 赠送),按量计费,无重置时间 |
| Kimi For Coding | GET https://api.kimi.com/coding/v1/usages |
套餐周限(usage)+ 各窗口明细(limits[],含 5h 滚动窗口与 resetTime) |
| ChatGPT(Codex 订阅) | GET https://chatgpt.com/backend-api/wham/usage |
订阅限流窗口(rate_limit.primary/secondary_window,按 limit_window_seconds 归一化为 5h/周限;used_percent 换算剩余量;plan_type 显示为套餐等级),凭证来自 CLIProxyAPI 本地 auth 文件 |
npm install
npm run typecheck
npm test
npm run build # 输出 lib/(host + client bundle)
src/providers.ts:纯函数适配器,fixture 单测在 tests/providers.spec.ts。src/index.ts:host 半身,拥有 /dsh-quota-status RPC channel(specs / fetch-all)。src/client.ts:浏览器半身,注册 shell.overlay 和业务无关的额外配额行子 Slot。ctx.credentials.resolve() 在宿主进程解析,不写入响应、日志或浏览器。codex-*.json),同样不写入响应、日志或浏览器。authority: loopback),浏览器只收到归一化后的余额/余量视图。MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: quota。