jyao-SUSE-power-group/dsh-provider-rate-limit ↗★ 0
dsh-provider-rate-limit
针对 DeepSeek Harness 的服务商及模型限流插件,支持令牌桶算法(拒绝/排队模式)以及网关身份规则。
AI 分析
核心用途是防止大模型 API 调用超出服务商的速率限制(RPM/TPM)。适合高频使用多模型、需要平滑请求流量以避免报错的团队或个人。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:jyao-SUSE-power-group/dsh-provider-rate-limit说明文档
阅读完整 README ↗Configuration
Open Settings → 插件 → Provider Rate Limit. All options hot-reload — no restart needed.
| Option | Default | Description |
|---|---|---|
enabled | true | Master switch; false passes everything untouched |
requestsPerMinute | 20 | Global steady-state rate (applies when no route rule matches) |
burst | 4 | Bucket capacity — how many requests may fire back-to-back |
mode | wait | wait = queue up to maxWaitMs; reject = fail fast |
maxWaitMs | 30000 | Longest queue time in wait mode before falling back to reject behavior |
models | [] | Per-route overrides: match by provider/model substring, each with its own RPM/burst |
Route rules
Route rules match on substrings of the resolved provider id and model name, e.g. provider opencode + model claude-*. The most specific matching rule wins; unmatched traffic uses the global limits.
Identity rules
Some free-tier gateways (e.g. OpenCode Zen) reject clients whose requests don't look like their official tooling. Identity rules let selected outbound URLs carry a different identity:
urlPattern— substring match against the request URLuserAgent— replacementUser-AgentdynamicIds— adds the per-requestx-opencode-client/project/session/requestheader setheaders— arbitrary static headers (Name: Valuepairs), applied last so they can override everything above
The fetch patch is ref-counted and unwinds cleanly: when the plugin deactivates, native fetch is restored exactly once, and a patch layered above ours in the meantime is never clobbered.
⚠️ Only spoof identities for services you are legitimately entitled to use, and in accordance with their terms.