DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Agent Rate Limit — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins
A

@zhourenke/dsh-agent-rate-limit

Agent Rate Limit

代理循环速率限制器——通过拦截 LLM 流式处理管道,并在请求之间添加自适应延迟,防止违反 TPM/RPM 限制

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add github:zhourenke/dsh-agent-rate-limit#33b78694ce8665a3a89f0eda181bf6859b2f220b
README兼容性版本

兼容性与来源证明

Agent Rate Limit 以 @zhourenke/dsh-agent-rate-limit 发布,当前版本为 0.1.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
any
发布来源
github
Registry 更新时间
2026/8/22

版本

0.1.0stable
2026/8/22

相关插件

正在加载相关插件…

最新版
0.1.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
未提供
文件数
未提供
Surface
any
许可证
MIT
发布源
github
GitHub
★ 1
周下载
0
最近提交
2026/9/12
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 models-usage 分类下经过校验的插件。

Usage Stats@ychris12138/dsh-usage-statsdsh Web GUI 的令牌使用热力图、提供商余额和订阅配额Codex Connectdsh-codex-connect用于 DeepSeek Harness 的 ChatGPT OAuth 和 Codex 模型。Damage Pulsedsh-damage-pulseDeepSeek Harness 余额监控器,配有鲸鱼女孩伙伴,并为每次令牌消耗提供感知缓存的伤害动画。Agy Linkdsh-agy-link适用于 DeepSeek Harness 的 Google Antigravity(agy CLI)模型——将 Gemini/Claude/GPT-OSS 订阅流式接入 DSH,并支持思考过程、工具活动、令牌使用量以及在 GUI 中通过 Google OAuth 登录。

README

@zhourenke/dsh-agent-rate-limit

English | 中文

Agent loop rate limiter — prevents TPM (Tokens Per Minute) and RPM (Requests Per Minute) limit violations by intercepting the LLM streaming pipeline and adding adaptive delays between requests.

When model providers enforce rate limits (e.g., Alibaba Cloud Bailian's 15,000 RPM + 1,200,000 TPM for deepseek-v4-flash), the agent loop can trigger these limits every few steps, causing errors and interruptions. This plugin solves that by:

  • Tracking token usage in a sliding 60-second window
  • Estimating input tokens from messages before each request
  • Counting output tokens from stream chunks as they arrive
  • Adding adaptive delays when approaching TPM or RPM limits
  • Exponential backoff on rate-limit errors (auto-retry with { kind: 'retry' })

How it works

User input → [agent/request] → [llm/stream*] → LLM API → [agent/request] → ...
                                    ↑
                          Rate limiter intercepts here

  ┌─ Sliding window (60s FIFO) ──────────────────────┐
  │  t0:  +5000 tokens (input)                       │
  │  t5: +12000 tokens (input)                       │
  │  t12: +8000 tokens (input)                       │
  │  ...                                             │
  │  Current window: 980,000 / 1,200,000 TPM         │
  │  Remaining: 220,000 tokens → pass through        │
  │  If approaching limit → delay before next request │
  └───────────────────────────────────────────────────┘

The plugin intercepts two Waterfall events:

EventPurpose
llm/streamCheck rate limits → delay if needed → stream tokens → count output tokens → update window
agent/request-errorDetect rate-limit errors (429) → return { kind: 'retry' } with exponential backoff

Installation

This plugin is a DSH profile bundle. The only supported installation method is to place the package folder directly into a DSH profile's node_modules and list it in that profile's dsh.profile.bundles array. No npm link, no pnpm, and no registry access is required.

Find your DSH profile

First, determine which profile you are using:

# List available profiles
Get-ChildItem "$env:USERPROFILE\.dsh\profiles" -Name

Common profiles: web, tui, headless. The profile directory is $env:USERPROFILE\.dsh\profiles\<name>\.

Step 1 — Copy the package folder into the profile

# Create the scoped directory if it does not exist
$target = "$env:USERPROFILE\.dsh\profiles\<name>\node_modules\@zhourenke"
New-Item -ItemType Directory -Force $target

# Copy the whole plugin folder (package.json, cordis.patch.yml, lib/, ...)
Copy-Item -Recurse C:\path\to\dsh-agent-rate-limit "$target\"

The copied tree must contain package.json (with dsh.bundle.patch), cordis.patch.yml, and lib/.

Step 2 — Register the bundle

Edit $env:USERPROFILE\.dsh\profiles\<name>\package.json:

  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
+       "@zhourenke/dsh-agent-rate-limit"
      ]
    }
  }

No dependencies entry is needed — DSH resolves bundles purely by package name from the profile's node_modules at startup (a dependencies entry only matters to pnpm install, which is not used for this plugin).

Step 3 — Restart DSH

The plugin is loaded on the next DSH startup. When you update the plugin source, re-copy the folder (or use a junction if you prefer live updates) and restart DSH.

Verify the installation

After restarting DSH, check the startup logs for [agent-rate-limit] entries confirming that the rate limiter is active:

dsh web 2>&1 | Select-String "agent-rate-limit"

Expected output:

[agent-rate-limit] Plugin loaded. TPM: 1200000, RPM: 15000, factor: 0.8, window: 60000ms, retryOn429: true

Configuration

KeyDefaultDescription
windowMs60000Sliding window size in milliseconds (60s).
tpmLimit1200000TPM (Tokens Per Minute) limit. Default matches Alibaba Cloud Bailian deepseek-v4-flash.
rpmLimit15000RPM (Requests Per Minute) limit.
safetyFactor0.8Safety factor (0.8 = use 80% of the limit, leaving 20% buffer).
maxBackoffMs30000Maximum backoff delay in milliseconds (30s).
retryOn429trueWhen true (default), HTTP 429 responses are silently retried with adaptive backoff — the conversation continues smoothly. Set to false to surface 429 errors to the user.
maxRetries5Maximum consecutive 429 retries per burst before giving up and surfacing the error to the user. Prevents an infinite retry loop when the error is permanent (e.g. account quota genuinely exhausted).

Example: Adjusting for different providers

# In your profile's cordis config or agent preset:
- id: agent-rate-limit
  name: '@zhourenke/dsh-agent-rate-limit'
  config:
    tpmLimit: 2000000     # 2M TPM for a different provider
    rpmLimit: 5000        # 5K RPM
    safetyFactor: 0.75    # 75% utilization, 25% buffer
    retryOn429: true      # silently retry on 429 (recommended)
    maxRetries: 5         # give up after 5 consecutive 429s

How the rate limiting works

Token estimation

The plugin uses a heuristic to estimate tokens from text:

  • CJK characters (Chinese, Japanese, Korean): ~1.5 chars per token
  • Other characters (Latin, numbers, etc.): ~3.5 chars per token

This is intentionally conservative — it's better to delay slightly more than to hit the rate limit.

Error recovery

When a rate-limit error is detected (HTTP 429, the typical response from providers like Alibaba Cloud Bailian when TPM or RPM limits are hit), the plugin:

  1. Records the error and increments the retry count for the current burst
  2. Returns { kind: 'retry' } to tell the agent loop to retry transparently — the user never sees the error
  3. Applies escalating backoff: 2s → 4s → 8s → 16s → 30s (capped at maxBackoffMs), reducing the pressure on the API with each retry
  4. Gives up after maxRetries consecutive failures (default 5): the error is then surfaced to the user. This prevents an infinite retry loop when the 429 is permanent — e.g. the account's allocated quota is genuinely exhausted ("Allocated quota exceeded, please increase your quota limit")
  5. When a request finally succeeds, the retry counter resets

Set retryOn429: false in the config if you prefer 429 errors to surface to the user instead of being silently retried.

Sliding window algorithm

The sliding window maintains a FIFO queue of { timestamp, tokens } entries. Before each request:

  1. Prune entries older than windowMs (60s)
  2. Sum remaining tokens = current TPM
  3. Count entries = current RPM
  4. If RPM ≥ limit → delay until oldest entry expires
  5. If TPM ≥ limit → delay until oldest entry expires
  6. If TPM + estimated input tokens ≥ limit → delay until enough tokens expire
  7. Apply backoff delay if there were consecutive errors

Rate limit detection

The plugin detects HTTP 429 responses by checking the following in the error:

SignalExample
HTTP status codestatusCode: 429
Error code429, RATE_LIMITED, QUOTA
"rate limit" textrate limit exceeded, rate_limit
"too many requests"too many requests, please try again later
TPM/RPM tokensTPM limit reached, token limit exceeded
"throttle"request throttled, throttling
"quota"Allocated quota exceeded (Bailian)
"429" in message429: {...}

When any of these match, the plugin retries transparently with adaptive backoff by default (retryOn429: true).

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    dsh-agent-rate-limit                          │
│                                                                  │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │  SlidingWindow (module-level state)                        │  │
│  │  ┌─────────────────────┐  ┌───────────────────────────┐   │  │
│  │  │  windowEntries[]    │  │  consecutiveErrors        │   │  │
│  │  │  {timestamp,tokens} │  │  (exponential backoff)    │   │  │
│  │  └─────────────────────┘  └───────────────────────────┘   │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                  │
│  ctx.on('llm/stream', ...)          ctx.on('agent/request-error')│
│  ┌─────────────────────────┐        ┌─────────────────────────┐  │
│  │ 1. Check sliding window │        │ 1. Detect rate-limit    │  │
│  │ 2. Delay if needed      │        │ 2. Return {kind:'retry'}│  │
│  │ 3. Count output tokens  │        │ 3. Record error         │  │
│  │ 4. Update window        │        └─────────────────────────┘  │
│  └─────────────────────────┘                                     │
└─────────────────────────────────────────────────────────────────┘

Dependencies

  • @deepseek-ai/schemastery — configuration schema validation
  • @deepseek-ai/cordis — plugin framework
  • @deepseek-ai/dsh-invariants — DSH invariants
  • @deepseek-ai/dsh-llm — LLM error types

License

MIT