Introduction

When developing with DeepSeek Harness (DSH), free models frequently trigger rate limits (Rate Limit), causing requests to fail or tasks to terminate. Built-in retry mechanisms often struggle to handle this kind of persistent throttling issue.

The following section introduces the dsh-camel plugin. It is an optional plugin for DeepSeek Harness, maintained by JuwanXu. This plugin specifically addresses rate-limit recovery for free models and provides provider- and model-based adaptive quota learning, proactive request throttling, and a Retry-After-aware retry mechanism.

Core Features

The plugin provides the following capabilities:
* Free model rate limit recovery.
* Provider- and model-aware adaptive quota learning.
* Proactive request throttling.
* A retry mechanism with Retry-After support.
* Visible retry states.
* Task-scoped configuration.
* Session-based activity and quota event logging.
* Precise (provider, model) learning isolation.
* Pause and resume controls.
* A safe fallback mechanism.

Installation and Enablement

The plugin is installed into the specified configuration file by the following command:

dsh plugin --profile <profile-name> add dsh-camel

Usage

After installation, all executable policies are disabled by default. They need to be enabled through commands or configuration.

Command-line Control

Available commands depend on whether the host provides the optional command service. These commands are task-local and do not modify configuration files:

  • /camel preset recover: enable unlimited rate-limit retries and disable throttling mode.
  • /camel preset adaptive: enable unlimited rate-limit retries and adaptive throttling, and disable fixed throttling.
  • /camel preset bounded: enable 5 rate-limit retries and disable throttling mode.
  • /camel off: persistently disable all Camel policies for the current task.
  • /camel reset: remove the current task’s overrides and restore plugin defaults (this may re-enable global policies).
  • /camel set: set task configuration, appending camel/config before the in-memory overrides.

Configuration and Priority

Configuration priority is: task session overrides > plugin defaults > built-in values.

The plugin has built-in numeric values for throttling, retry, and adaptive throttling, but all three enabled values default to false. They must be explicitly enabled in the configuration file.

Example configuration snippet:

- 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

Adaptive Throttling Notes

When adaptive throttling is enabled for a resolved route, its throttling is taken over by adaptive mode, and fixed throttling is not applied again. Adaptive admission uses max(minRequests, floor(learnedRequests × safetyRatio)). Matched RATE_LIMIT responses use decreaseRatio to reduce the learned count. After a window is cleared, the count can be increased after increaseAfterWindows windows.

Use Cases and Considerations

  • Rate-limit focus: The plugin focuses on rate-limit handling and does not replace generic model error retries.
  • No LLM calls: The plugin does not call an LLM to classify failures or adjust strategy.
  • Boundary operation: The plugin operates at the agent request error/retry boundary and does not inject user prompts or require a browser UI.
  • Automatic retries: The plugin performs automatic rate-limit waits/retries and does not rewrite messages or fork conversations.

Conclusion

dsh-camel provides a concrete tool for rate-limit handling in the DSH plugin ecosystem, especially when dealing with free models, where adaptive learning and proactive throttling can improve success rates.