qinyu765/dsh-llm-auto-route0

dsh-llm-auto-route

大模型服务商自动路由插件,支持服务商发现、匹配、健康检查以及输出前的自动故障转移。

AI 分析

核心用途是提高大模型API调用的可用性与灵活性。适合配置了多个API端点、需要自动测速、健康检查及多通道容灾备份的开发者。

套件
dsh-llm-auto-route
版本
0.1.0
授權
MIT
最近更新
2026年8月14日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:qinyu765/dsh-llm-auto-route

Configuration

The shipped patch contains the default rules. An application can override them through its Cordis configuration:

provider: auto
precedence:
  - explicit
  - provider_env
  - base_url
  - model_prefix
healthCheck:
  mode: adaptive       # off | adaptive | probe
  timeoutMs: 3000
  cacheTtlMs: 30000
failover:
  enabled: true
  maxAttempts: 3
diagnostics: info      # silent | error | info
routes:
  deepseek:
    apiKeyEnv: DEEPSEEK_API_KEY
    defaultModel: deepseek-chat
    priority: 10
  openai-compatible:
    apiKeyEnv: GATEWAY_API_KEY
    baseURLEnv: LLM_BASE_URL
    modelPrefixes: [gateway-]

Route fields are hints, not adapter configuration:

FieldMeaning
providerRegistered route id to return; defaults to the routes key.
apiKeyEnvNon-empty environment variable used as a provider-env signal and for discovery.
baseURL / baseURLEnvExact or user-supplied endpoint hint. baseURLEnv also supports unknown OpenAI-compatible hosts.
baseURLPatternsAdditional normalized URL prefixes.
portsLocal ports that identify this route when a base URL is supplied.
modelPrefixesModel id prefixes for automatic selection.
defaultModelModel to use when the request does not name one.
priorityTie breaker within one matching stage; higher wins.

Do not put an API key directly in route configuration. Use the official adapter's credential reference, normally apiKeyEnv, and keep this plugin's apiKeyEnv aligned with it.