jyao-SUSE-power-group/dsh-provider-rate-limit0

dsh-provider-rate-limit

针对 DeepSeek Harness 的服务商及模型限流插件,支持令牌桶算法(拒绝/排队模式)以及网关身份规则。

AI 分析

核心用途是防止大模型 API 调用超出服务商的速率限制(RPM/TPM)。适合高频使用多模型、需要平滑请求流量以避免报错的团队或个人。

包名
dsh-provider-rate-limit
版本
0.2.2
许可证
MIT
最近更新
2026年8月23日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:jyao-SUSE-power-group/dsh-provider-rate-limit

Configuration

Open Settings → 插件 → Provider Rate Limit. All options hot-reload — no restart needed.

OptionDefaultDescription
enabledtrueMaster switch; false passes everything untouched
requestsPerMinute20Global steady-state rate (applies when no route rule matches)
burst4Bucket capacity — how many requests may fire back-to-back
modewaitwait = queue up to maxWaitMs; reject = fail fast
maxWaitMs30000Longest 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 URL
  • userAgent — replacement User-Agent
  • dynamicIds — adds the per-request x-opencode-client/project/session/request header set
  • headers — arbitrary static headers (Name: Value pairs), 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.