dsh-camel
Provider/model-aware adaptive pacing and visible rate-limit retries for DeepSeek Harness free models. 适合频繁遇到免费模型 API 速率限制并需要自动重试的用户。
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:JuwanXu/dsh-camelConfiguration and precedence
defaults is optional. Built-in values include throttle, retry, and adaptive numbers, but all three enabled values are false.
task session override > plugin defaults > built-in values
An advanced profile configuration with two exact provider/model routes looks like this:
- id: camel
config:
defaults:
retry:
enabled: true
mode: unlimited
fallbackDelayMs: 60000
throttle:
enabled: true
maxRequests: 20
windowMs: 60000
scope: route
adaptive:
enabled: false
initialRequests: 10
minRequests: 1
maxRequests: 20
windowMs: 60000
safetyRatio: 0.85
decreaseRatio: 0.7
increaseAfterWindows: 3
stateTtlMs: 86400000
routes:
- provider: provider-a
model: model-v3
enabled: true
initialRequests: 8
maxRequests: 12
- provider: provider-b
model: model-r1
enabled: true
initialRequests: 4
maxRequests: 6
Replace each example route with the exact resolved request.provider and request.model strings used by the Harness adapter. Route matching is an exact pair, not a display name, prefix, wildcard, or failure-message guess. Different models on one provider never share learned capacity. A missing or empty model disables adaptive reads and writes for that request; static fixed pacing and RATE_LIMIT retry still follow their own enabled policies.
When adaptive pacing is enabled for a resolved route, it alone owns pacing for that route. Fixed throttle is not applied a second time. Adaptive admission uses max(minRequests, floor(learnedRequests × safetyRatio)); a matching RATE_LIMIT lowers the learned count with decreaseRatio, and clean completed windows can raise it one step after increaseAfterWindows. Learning is bounded by minRequests and maxRequests, expires after stateTtlMs, and never calls a model to classify failures or tune policy.
For one resolved provider/model route, Camel keeps one canonical shared learning state. A task's minRequests, maxRequests, and clean-window threshold are applied as that task's admission and display view; merely reading the state never rewrites another task's learned capacity or TTL. Within one live runtime, equal-time session snapshots merge conservatively regardless of task startup order, and the shorter TTL wins for the same state version. A later real learning transition may establish the TTL from the policy that produced that transition. New quota snapshots also carry the current rateLimitedInWindow marker; a legacy snapshot without it is restored conservatively as a potentially rate-limited partial window.
All counts are positive safe integers; ratios are finite values in (0, 1]; and minRequests <= initialRequests <= maxRequests. bounded retry requires maxRetries. Unknown or invalid fields fail closed rather than running a partial policy.