dsh-coding-plan-quotav0.2.3

sxwer001/dsh-coding-plan-quota

客户端 MIT 最近更新 2026-11-07
1Stars
0Forks
2待解决 Issue
安装命令 dsh plugin --profile web add github:sxwer001/dsh-coding-plan-quota#74a969b42538e3a143e9b3a7fb1ccf18cdb4a98a

介绍

Quota ring in the DSH composer bar that tracks OpenCode Go and 14 other coding-plan quotas or balances, cycles 5-hour weekly and monthly windows on click, and colours itself by urgency.

标签

coding-plan cordis deepseek-harness dsh dsh-plugin opencode quota

概述

dsh-coding-plan-quota

支持 DSH 0.2.0-rc.2 和 0.2.1-rc.5,需要 Node.js ≥22.19.0。0.2.3 补充明确的兼容声明,保留 0.2.2 的 GLM 百分比修复。Windows 上验证了原生安装、模拟额度路由、圆环/卡片和实时停用/启用。2026-11-04,使用本机 rc.5 可执行文件和 0.2.3 安装包,经原生凭据服务实际读取 OpenCode Go 上游:三个窗口百分比及重置时间均解析成功,原生 HTTP 路由、缓存、POST 405 和跨站 403 检查通过。其他供应商尚未进行本版真实接口验收。

DSH 输入框工具行里的一个额度圆环,就在模型选择器的左侧。它读取你的 coding plan 用量窗口或账户余额,同时只显示一个来源。

  • 点击圆环循环切换该来源的窗口:5 小时 → 每周 → 每月。纯余额类来源改为刷新。
  • 按紧急程度着色:绿 <50% → 蓝 <75% → 橙 <90% → 红 ≥90%。
  • 悬停可看到已用百分比、实时重置倒计时,以及每个窗口的进度条。
  • 卡片用一行 额度来源 · <名称> › 标出当前来源。点它即可切换——选择页只列能真正答上来的来源,其余收在开关后面。
  • 采集失败的来源会保留上一次成功的数字并标记 stale,而不是变成空白。

所选来源与窗口都会持久化在 localStorage。

截图

安装

从 DSH 插件市场安装(分类 Usage & Billing),或在终端里直接装:

dsh plugin --profile web add dsh-coding-plan-quota                  # npm
dsh plugin --profile web add github:sxwer001/dsh-coding-plan-quota  # GitHub

装完请重启 DSH。

若要对着源码目录边改边调,用目录联接(junction)代替拷贝:

New-Item -ItemType Junction -Path "$env:USERPROFILE.dshprofilesdesktopnode_modulesdsh-coding-plan-quota" -Target "D:Antigravityprojectdsh-coding-plan-quota"

来源

来源id凭据说明
OpenCode Goopencode-goOPENCODE_GO_API_KEY5 小时 / 每周 / 每月
智谱 GLMglmZHIPU_API_KEY5 小时 / 每周;region: cn 走 open.bigmodel.cn
KimikimiKIMI_API_KEY
MiniMaxminimaxMINIMAX_COOKIE要浏览器会话 Cookie,不是 API key
火山方舟arkARK_API_KEY没有公开额度地址——请自行填 endpoint
Claude 订阅claudeCLAUDE_CODE_OAUTH_TOKENOAuth token,不是 API key
Codex / ChatGPTcodexCHATGPT_ACCESS_TOKEN + CHATGPT_ACCOUNT_IDchatgpt.com 在部分网络下不可达
Gemini CLIgeminiGEMINI_ACCESS_TOKENcloudcode-pa.googleapis.com 在部分网络下不可达
GitHub CopilotcopilotCOPILOT_API_TOKEN若 TLS 代理拦握手,请设 insecureTls: true
DeepSeek 余额deepseekDEEPSEEK_API_KEY仅余额
Moonshot 余额moonshotMOONSHOT_API_KEY仅余额
OpenRouter 余额openrouterOPENROUTER_API_KEY仅余额
硅基流动余额siliconflowSILICONFLOW_API_KEY仅余额
阶跃星辰余额stepfunSTEPFUN_API_KEY仅余额
Novita 余额novitaNOVITA_API_KEY仅余额

没有凭据的来源只会说明它需要哪一个。厂商按 remaining 报的百分比会被反相成 used;当套餐按模型各报一个窗口时(GLM、Gemini),取最差的那个。

配置

apply(ctx, config) 会把配置合并到这些默认值之上:

键默认值含义
cacheMs60000每个来源的宿主侧缓存时长
timeoutMs12000上游请求超时
thresholds[50, 75, 90]绿 → 蓝 → 橙 → 红的分界
defaultProvider"opencode-go"还没选择时显示哪个
hideUnconfiguredfalse隐藏没有凭据的来源
insecureTlsfalse跳过证书校验
providers{}按 id 索引的单来源覆盖项

单来源覆盖项:

键含义
enabled设为 false 会把该来源从卡片里移除
endpoint替换内置地址(这也是启用 ark 的方式)
apiKey直接写字面量密钥,优先级高于其他所有凭据来源
apiKeyEnv改为从这个环境变量读取密钥
region"cn" 切换到该厂商的国内地址
insecureTls单来源覆盖全局开关
- insert:
    - id: coding-plan-quota
      name: dsh-coding-plan-quota
      config:
        thresholds: [50, 75, 90]
        defaultProvider: opencode-go
        providers:
          ark:
            endpoint: "https://<your-ark-quota-url>"

凭据

对每个来源,先命中者胜:providers.<id>.apiKey → providers.<id>.apiKeyEnv 指名的环境变量(或内置名称)→ DSH 的 credentials 服务 → $DSH_HOME/.credentials.yaml → 该厂商自己 CLI 的凭据文件(OpenCode、Claude、Codex、Gemini、Copilot 有)。

凭据只在宿主半边读取,绝不送到浏览器。

说明

  • 卡片跟随 DSH 当前 UI 语言(中 / 英)实时切换,自身没有语言设置。
  • 浏览器半边读取宿主半边的同源路由:/plugins/dsh-coding-plan-quota/usage.json(支持 ?refresh=1、?provider=<id>、?debug=1)。
  • 改 lib/host.js 需要重启 DSH;改 lib/client.js 只需刷新页面。
  • node scripts/verify.mjs 跑端到端检查。

目录结构

dsh-coding-plan-quota/
├── package.json          dsh.bundle.patch + dsh.client { platform: web }
├── cordis.patch.yml      - insert: [{ id, name }]
├── lib/
│   ├── host.js           宿主半边——来源、凭据、缓存、HTTP 路由
│   └── client.js        浏览器半边——圆环、卡片与来源选择
├── scripts/
│   └── verify.mjs        端到端检查
├── README.md             中文(默认)
└── README.en.md          English

许可

MIT

星级评价

1.5 按 GitHub Stars 换算的社区热度,非用户打分
Stars1
Forks0
待解决 Issue2
最近更新2026-11-07

基本信息

作者sxwer001
版本0.2.3
开源许可MIT
默认分支main
入库时间2026-11-07

插件信息来自公开 GitHub 仓库与 SkillHub,版权归原作者所有;安装前请自行审查仓库代码。