Imzl-zl/dsh-model-router--packages-dsh-model-router ↗★ 1
dsh-model-router
Transparent cross-provider failover for DSH Agent main requests. 适合需要高可用模型调用、在主模型失效时自动切换备用候选模型的任务。
Other repositories with this package name
Install
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Imzl-zl/dsh-model-router#a73dc8b1bfaf62f37ceaff6521ad978376c58eb8&path:packages/dsh-model-routerREADME
Read the full README ↗Configuration
enabled: true # master switch
profiles: # matched by exact provider/model
- id: coding-main
when: { provider: deepseek-official, model: deepseek-v4-flash }
candidates: # [0] is pinned to the when model
- { provider: deepseek-official, model: deepseek-v4-flash, maxAttempts: 2 }
- { provider: pi-ai-gpt, model: gpt-5, maxAttempts: 1, needs: { images: true } }
- { provider: pi-ai-claude, model: claude-sonnet-5, maxAttempts: 1, needs: { minContextTokens: 120000 } }
switchOn: { rateLimit: true, server: true, timeout: true, transport: true, emptyResponse: false, invalidRequest: false }
maxTotalAttempts: 6
default: # pure fallback pool for unconfigured models
enabled: false
candidates:
- { provider: deepseek-official, model: deepseek-chat, maxAttempts: 1 }
switchOn: { rateLimit: true, server: true, timeout: true, transport: true, emptyResponse: false, invalidRequest: false }
maxTotalAttempts: 3
candidates[0]of a matched profile must be thewhenmodel — your own selection always attempts first, so a switch never happens without a failure.- The default pool is pure fallback: the model you picked is always the first hop, with one attempt.
- Backoff is not configurable: it belongs to
llm-retry. Each switch is preceded by one backoff wait (about 0.5–10 s with the default policy). - Unchecked
switchOncodes never move the chain; DSH still retries the same route per its own default policy (up to 5 times for the default retryable codes) before the request terminates.