Introduction¶
In DeepSeek Harness (DSH), hitting the TokenShare provider triggers hard platform-side limits. Over-frequency may lead to temporary bans; sporadic upstream 503s can cause the entire dialogue to fail directly, requiring manual resending. Relying solely on the keys in the provider configuration cannot prevent issues like “hitting the limit too hard in one minute” or “dropping the flow after a single 5xx”. Below is an introduction to the community plugin dsh-tokenshare-limiter (maintainer: cznbnbnb, category: Model Inference). It hooks into the llm/stream waterfall to rate limit the TokenShare route per minute, and retries after a configured wait time on upstream 429/5xx errors, rather than passing the error directly to the dialogue.
What is this¶
dsh-tokenshare-limiter is a DSH plugin, current version 1.0.0 (requires engines.dsh: >=0.2.0, developed and verified on DSH 0.2.2-rc.2). It does not manage the TokenShare API key—the credentials are still handled by DSH’s provider configuration. The plugin only reads the provider and signal fields from llm/stream, and does not read, modify, or record request bodies.
Community directory page: cznbnbnb/dsh-tokenshare-limiter. Source code and documentation: GitHub Repository. License: MIT.
Core Features¶
Two things are done at the llm/stream layer:
- Outbound Throttling: Allows up to N requests within the sliding window. Excess requests are queued and sent after the window rolls, rather than hard-counting against the limit via failed retries.
- Exception Replay: When the upstream returns 429/5xx, wait for M minutes before resending, minimizing the direct hand-off of transient failures to the dialogue layer.
Default parameters are safety-oriented: Maximum 14 times per minute, wait 5 minutes to retry after an exception. The settings page provides a Run/Pause toggle, sliders for adjustment, as well as this window’s usage, cumulative requests, queue count, replay count, failure count, and recent logs.
Points to note regarding behavior (all from README):
- The throttle metric is “maximum N times per minute”: The first N requests are sent directly; the (N+1)th request is queued until the window rolls (approximately one minute later).
- Only replay requests that have not yet output a body; failed requests that have started streaming output will not be replayed to avoid duplicate paragraphs.
- The default upper limit for consecutive retries of the same request is 6 times (
maxRetries), returning the error to the upper layer after about 30 minutes;0means no replay. - When the plugin encounters an internal exception, it falls back to passing through and logs, avoiding blocking other dialogues due to a limiter failure.
Installation and Activation¶
First, install from GitHub (recommended). Replace <your profile> with the actual DSH profile you use:
dsh plugin --profile <your profile> add github:cznbnbnb/dsh-tokenshare-limiter
After installation, restart dsh web or refresh the desktop page. Open Settings → “TokenShare Limiter”. If you can see the status page, the plugin has loaded. The plugin declares a requirement for DSH >=0.2.0; earlier versions may lack the settings.section slot, so the settings page won’t display, though the README indicates the throttling logic will still work.
Uninstall:
dsh plugin --profile <your profile> remove dsh-tokenshare-limiter
The README also states that for local directory installation, you need to git clone first and then add ./dsh-tokenshare-limiter; if you are auditing the repository source code, you can clone it yourself. This article will not expand on this path.
Typical Usage¶
It takes effect immediately after installation; generally, no prior configuration changes are needed. When parameters need adjustment:
- Open Settings → “TokenShare Limiter”.
- Toggle Running / Paused at the top capsule.
- Drag Max per minute (1-60), Wait minutes after exception (1-60), and save; it takes effect immediately.
Slider values are written to ~/.dsh/settings/tokenshare-limiter.json; changing parameters does not require a restart and is not affected by logic outside of the plugin’s enable/disable state (README specifies: slider values take precedence over defaults in the profile).
If you want to write default values in the profile at once, you can configure in cordis.patch.yml (fields not covered by the settings page fall back here):
- id: tokenshare-limiter
name: dsh-tokenshare-limiter
config:
enabled: true
providers: tokenshare
perMinute: 14
retryWaitMinutes: 5
windowSeconds: 60
maxRetries: 6
| Field | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch |
providers |
tokenshare |
Controlled provider route name, comma-separated |
perMinute |
14 |
Maximum number of passes per window |
retryWaitMinutes |
5 |
How long to wait before replaying after upstream exception |
windowSeconds |
60 |
Window length (seconds) |
maxRetries |
6 |
Upper limit for consecutive retries of the same request |
Use Cases and Notes¶
Who is it suitable for: Developers who use the TokenShare provider in DSH for a long time, have dense dialogue or Agent calls, wish to reduce the risk of bans, and hope to automatically wait and retry on 5xx instead of manually resending.
Permissions and Trust: The plugin runs with the current DSH process permissions and intervenes in all model request paths that pass through llm/stream and match providers. It is recommended to read the repository source code and the MIT license before installation. The README states that it does not send data to external servers; HTTP settings are only on local 127.0.0.1 and only accept loopback sources; disk storage is only for the three fields perMinute, retryWaitMinutes, and enabled.
Known Limitations (from original README):
- The complete “wait 5 minutes to resend” chain has not been fully tested in real 503 scenarios; you can check if queuing and replaying occurred via “Recent Logs” on the settings page.
- Throttle counting is in-process; the window count starts from zero after a DSH restart.
- It only acts on
llm/streamand does not intercept other network requests inside the provider adapter (for example, model list discovery).
Community directories like SkillHub have no official affiliation with DeepSeek or Fangyuan. The DSH ecosystem is “everything is a plugin”; this plugin is a community contribution, not an officially bundled component.
Conclusion¶
dsh-tokenshare-limiter turns the TokenShare “don’t hit too hard” and “don’t break the dialogue immediately on 5xx” into configurable outbound throttling and exception replay, providing a settings page and local statistics. For installation commands and field descriptions, please refer to the GitHub README; to view the entry on the directory site, see the SkillHub Plugin Page.