iqingyoung/429-throttle-mcp

dsh-throttle

DeepSeek Harness 限流插件:长程任务自动控速避免 429,支持任务复盘。

ツールと機能429rate-limiterrpm

dsh-throttle

English | 中文

DeepSeek Harness 限流插件 — 为 Harness 生态提供速率限制的 API 代理,复用 429-throttle-mcp 核心逻辑。


是什么

很多免费大模型 API(Grok、Gemini、Dots 等)每分钟只能调用 30 次左右。Agent 在做长程任务时,很容易超出限额被 429 拒绝。

dsh-throttle 在这个痛点上提供了一个透明限流层,专为 DeepSeek Harness 生态设计:

Agent → call_api 工具 → 限流器 → 实际 API 请求 → 返回结果 + 用量快照

与 429-throttle-mcp 共享同一个 rate-limiter.js 核心逻辑,只是通信协议从 MCP stdio 改为 DSH Plugin API。


核心参数

参数默认值说明
maxCalls30每分钟最大调用次数 (RPM)
maxTokens750000每分钟最大 Token 数 (TPM),含请求体和响应体

配置来源:DSH config 或 dsh-manifest.json。


暴露的工具

call_api

通过限流代理发送 HTTP 请求。

参数类型必填说明
urlstring✅目标 API 的完整 URL
methodstring❌HTTP 方法,默认 GET
bodystring❌请求体,JSON 字符串
headersstring❌自定义请求头,JSON 字符串

如果被限流拒绝,返回 RATE_LIMIT_EXCEEDED 错误,包含 retryAfterSeconds 建议等待时间。

get_rate_limit_status

查询当前速率限制使用情况。返回已用/剩余调用次数和 Token 数。

set_rate_limit

动态调整限流参数(实时生效无需重启)。

参数类型说明
callsPerMinutenumber每分钟最大调用次数 (RPM)
tokensPerMinutenumber每分钟最大 Token 数 (TPM)

安装

npm install dsh-throttle

在 DSH 配置中添加:

{
  "plugins": {
    "dsh-throttle": {
      "maxCalls": 30,
      "maxTokens": 750000
    }
  }
}

加载插件:

dsh plugin load dsh-throttle

与 429-throttle-mcp 的关系

429-throttle-mcpdsh-throttle
类型MCP ServerDSH Plugin
通信协议MCP stdio JSON-RPCDSH Plugin API
安装npm i 429-throttle-mcpnpm i dsh-throttle
核心代码rate-limiter.js(共享)rate-limiter.js(共享)
GitHub主仓库同仓库

SEO 关键词

429报错, anti 429, DSH限流, DeepSeek Harness plugin, 大模型每分钟调用限制, 免费大模型速率限制, Agent批量调用触发429, RPM, TPM, rate limiter, quota guard, mcp proxy, throttle, llm api quota, cop, HTTP 429, Too Many Requests, rate limiting, token bucket, sliding window


License

MIT