限流或配额耗尽时自动切换模型提供方:可按提供方配置模型,带冷却机制与永久最终兜底。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-llm-failover
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:HB00/dsh-llm-failover
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
Provider failover for DeepSeek Harness (dsh): when a model provider returns rate-limit (429) or quota-exhausted errors, switch to the next provider automatically — with a configurable per-provider model mapping, a permanent final fallback, and a visible notice in the UI.
模型提供方故障转移插件:遇到限流(429)或配额耗尽时,自动切换到下一个提供方——支持按提供方配置模型、永久最终兜底,并在界面显示切换提示。
Features / 功能
- Automatic switch on
RATE_LIMIT/QUOTAfailures, with configurable retry threshold (fallbackAfterRetries). / 遇到限流/配额错误自动切换,可配置切换前连续失败次数。 - Per-provider model mapping — a switched provider can use a different model. / 每个提供方可单独指定切换后使用的模型。
- Cooldown per provider (
cooldownMs): a cooled-down provider is skipped until it recovers. / 提供方冷却机制:冷却期间直接跳过,到期自动恢复。 - The last entry in the provider list is the permanent fallback and is never switched away (no retry loops). / 列表最后一条是永久兜底,永远不会被切走(不会死循环)。
- UI notice bar on every switch (auto-dismiss). / 每次切换在输入框上方显示提示条(自动消失)。
- Configuration card in Settings → Plugins → Plugin configuration. / 设置 → 插件 → 插件配置 页面卡片直接配置。
Install / 安装
dsh plugin --profile web add dsh-llm-failover
Configuration / 配置
Either use the Settings UI card, or edit ~/.dsh/settings.yaml:
llm-failover:
enabled: true # master switch / 总开关
providers: # tried in order; last one is the fallback / 按顺序尝试,最后一条是兜底
- provider: huoshan # provider key from your llm-pi-ai / llm-deepseek config
model: deepseek-v4-flash # optional: model to use after switching / 可选:切换后使用的模型
- provider: huoshan2
model: deepseek-v4-flash
- provider: deepseek-official # permanent fallback, never switched away / 永久兜底
model: deepseek-v4-flash
fallbackAfterRetries: 2 # consecutive failures before cooldown+switch / 连续失败几次后冷却并切换
cooldownMs: 60000 # cooldown duration in ms / 冷却时长(毫秒)
How it works / 原理
Hooks two official agent waterfalls:
agent/request— picks the first non-cooled provider in the configured order at request time (returns a new config object; the seed config is deep-frozen).agent/request-error(prepended, so it counts failures beforedsh-llm-retry) — afterfallbackAfterRetriesconsecutiveRATE_LIMIT/QUOTAfailures, cools the provider down and returns{ kind: "retry" }; the last list entry never switches.
The config card talks to the plugin-owned /llm-failover RPC channel (the official settings RPC serves only allowlisted namespaces); writes go through the standard settings service — schema-validated and persisted to settings.yaml, live without restart.
License
MIT
链接
同类插件
Ebony-Vinyl/dsh-our-free-model★ 72986
为 dsh 接入免费模型车道(含 DeepSeek V4.1 Flash、Kimi K3 等),无需登录、注册或填写 API Key,并提供本地 OpenAI 兼容网关、降级路由与用量看板。
dingminhua/dsh-connect-workbuddy★ 1557
将本机登录的 WorkBuddy 模型(国内版与国际版)接入 DSH,每次刷新按上游目录读取每个模型的积分倍率,支持逐模型图片输入开关、带自动换号的账号池、手动每日签到,以及卡片与输入框里的只读积分胶囊读数。
Alice-Marx/dsh-model-router★ 962
为 DeepSeek Harness 规划有依赖的工作包,将其分配给已配置的模型 API 或支持的厂商 CLI,并提供费用预览。
V1ki/dsh-plugin-subscriptions★ 603
把 ChatGPT(Codex)、Claude、Grok 订阅当作 DeepSeek Harness 的 LLM 提供方:设置页登录、模型目录、用量展示,以及 image_generate、video_generate 与 x_search 工具。
XDTrees/dsh-workbuddy-xdpool★ 516
把本机 WorkBuddy 桌面 App 登录过的所有账号自动并入 DSH 模型池:多账号轮换自动容错、实时积分,模型目录按模型标注积分倍率与限时免费 / 夜间折扣。
XDTrees/dsh-xdpool★ 516
把本机 WorkBuddy 桌面 App 登录过的所有账号自动并入 DSH 模型池:多账号轮换自动容错、429 冷却、实时积分,模型目录按模型标注积分倍率与限时免费 / 夜间折扣,扫码登录 13 家厂商,聚合免费额度渠道。账号重启不丢。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。