echo-xianyu/dsh-go-rotator
DSH插件,用于切换opencode Go订阅
Project Overview项目介绍
dsh-go-rotator is a native DSH plugin built specifically for DeepSeek Harness to manage multiple OpenCode Go subscription API keys. To install the plugin, you first configure the opencode-go provider in your DSH_HOME/settings.yaml file, pointing the apiKeyEnv to GO_ROTATOR_ACTIVE_KEY that the plugin maintains. Then you can install the plugin via the DSH CLI using dsh plugin --profile <profile> add ./dsh-go-rotator-0.2.0.tgz, or link the source directory directly for local development. After installation, you can optionally update your cordis.patch.yml to route your default DSH model to the opencode-go provider. Once that configuration is complete, you can run DSH normally, and the plugin will automatically sync the active key to the environment variable with no extra manual steps.
This plugin is designed for DSH users that hold multiple OpenCode Go API keys to avoid running into rate limits or quota exhaustion during regular usage. It automatically distributes load across multiple keys by routing each request to an active key parsed from the environment variable on every individual request. When a request terminates with errors like RATE_LIMIT, QUOTA_EXCEEDED, AUTH or INVALID_CREDENTIAL, it puts the current key on cooldown and automatically rotates to the next available key. It also tracks cost based on token usage from completed requests, storing rolling window stats in the state file and long-term ledgers sorted by day, month, and year in a separate stats file.
dsh-go-rotator requires DSH version 0.1.0-rc.6 or newer, and it is released under the open source MIT license. All plugin data is stored within the plugin’s install directory under the data/ subfolder, so no absolute paths are required for any user configuration. API keys are only stored locally in the plugin’s state file, and are never printed to logs or shared anywhere outside of your local system. The state file uses an atomic tmp and rename write strategy, so it is safe for concurrent access across multiple DSH processes. First run automatically initializes all required data files, and there is no legacy path detection or migration logic for existing setups.
dsh-go-rotator 是专门为 DeepSeek Harness (DSH) 开发的原生插件,作用是为 OpenCode Go 订阅密钥提供多密钥管理、负载均衡与自动轮换功能。它支持按请求路由活跃密钥,遇到速率限制、配额耗尽、认证错误等情况时自动冷却当前密钥并切换到下一个可用密钥,配合 DSH 内置的重试机制可以实现服务的无感切换。
适合同时持有多个 OpenCode Go 订阅密钥的 DSH 用户使用,可以帮助用户分摊请求负载,避免单个密钥超配额中断服务,还能自动监控和管理各密钥的配额消耗。用户安装后只需要在 DSH 的 settings.yaml 配置文件中添加 opencode-go 提供源,将路由指向插件维护的环境变量,再把默认模型路由到该提供源即可启用密钥轮换功能。
本插件采用 MIT 许可证开源,要求 DSH 版本不低于 0.1.0-rc.6,所有数据都存储在插件安装目录下的 data 文件夹中,不需要用户手动配置绝对路径。密钥仅保存在本地状态文件中,不会被打印或记入日志,状态文件采用原子写入操作,支持多进程并发安全,端口被占用时还会自动递增端口号回退。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-go-rotator(echo-xianyu/dsh-go-rotator)
仓库:https://github.com/echo-xianyu/dsh-go-rotator
本站详情页:https://www.yhbd.top/plugins/echo-xianyu-dsh-go-rotator/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 3 · 最近提交 2026-08-14 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:echo-xianyu/dsh-go-rotator
把 echo-xianyu/dsh-go-rotator 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
🔑 dsh-go-rotator
OpenCode Go 订阅 key 轮换器 —— 为 DeepSeek Harness(dsh)提供多 key 负载均衡、自动轮换与配额管理。
✨ 特性
- 按请求路由 —— provider 通过
apiKeyEnv每请求解析活跃 key,多 key 自动分摊负载; - 自动轮换 —— 流以
RATE_LIMIT/QUOTA_EXCEEDED/AUTH/INVALID_CREDENTIAL错误终止时冷却当前 key 并切换(env 即时生效,错误原样上抛,内置 llm-retry 用新 key 无感重试); - 成本记账 —— 正常完成的流按 token 估算成本:滚动窗口(5h/周/月)入状态文件,长期账本(日/月/年)入统计文件;
- 配额看门狗 —— 定时抓取各 key 的 dashboard 真实配额(workspaceId + authCookie),越过阈值自动禁用该 key;
- Web 设置界面 —— dsh web 客户端设置页 + 独立 HTTP API(默认
http://localhost:7777),供外部工具读写同一状态; - 自包含 —— 全部数据落在插件安装目录的
data/下,配置永远不需要绝对路径。
📦 安装
# 1. 配置 provider 路由($DSH_HOME/settings.yaml)
# llm-pi-ai:
# providers:
# opencode-go:
# displayName: OpenCode Go
# api: openai-completions
# baseURL: https://opencode.ai/zen/go/v1
# apiKeyEnv: GO_ROTATOR_ACTIVE_KEY
# models: [ ...opencode-go 模型... ]
# 2. 安装插件(tarball / 本地目录均可)
dsh plugin --profile <profile> add ./dsh-go-rotator-0.2.0.tgz
# 或开发期直接引用源码目录:
# dsh plugin --profile <profile> add file:/path/to/dsh-go-rotator
# 3.(可选)把默认模型路由到 opencode-go
# $DSH_HOME/cordis.patch.yml:
# - id: agent-default-model
# config:
# provider: opencode-go
# model: deepseek-v4-flash
# 4. 运行 —— 活跃 key 由插件启动时自动同步到 env,无需手动导出
dsh --profile <profile> "hello"
需要 dsh ≥ 0.1.0-rc.6。Release 资产(tgz / 源码 zip / 校验和)见页面右侧 Releases。
⚙️ 配置
profile cordis.patch.yml 或 --patch 覆盖行 go-rotator:
| 键 | 默认 | 说明 |
|---|---|---|
stateFile |
<插件目录>/data/opencode-go-rotator.json |
状态文件(keys、冷却、轮换日志、用量窗口;支持 ~/ 与相对路径) |
statsFile |
状态文件中的 statsFile(默认 <插件目录>/data/opencode-go-rotator-stats.json) |
长期账本 |
apiKeyEnv |
GO_ROTATOR_ACTIVE_KEY |
provider 每请求解析的 env 引用 |
cooldownMinutes |
60 | 出错 key 的冷却分钟数 |
disableThresholdPercent |
97 | 配额使用率阈值,越过即禁用该 key |
rotateOnCodes |
RATE_LIMIT, QUOTA_EXCEEDED, AUTH, INVALID_CREDENTIAL |
触发轮换的 LlmError 码 |
rotateDebounceMs |
3000 | 并发失败时的轮换防抖 |
scrapeIntervalMs |
300000 | dashboard 配额抓取间隔;0 关闭 |
guiPort |
7777 | GUI/API 端口;0 关闭(被占用时自动 +1 回退) |
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
Q00/ouroboros
crafter-station/petdex
whiteguo233/OpenBiliClaw
anywhere-labs/Agents-Anywhere
agentrq/agentrq
freestylefly/wesight