dsh-llm-key-rotation
Verified@m1khal3v/dsh-llm-key-rotation Β· v1.1.0 Β· MIT Β· Web UI
Seamless API-key rotation for DeepSeek Harness LLM providers when subscription limits are hit
Install
dsh plugin add @m1khal3v/dsh-llm-key-rotation Confirm the layer applied with dsh --profile default --dump-config β see the install guide.
Source
Tags
Creators
Readme
dsh-llm-key-rotation
Seamless API-key rotation for DeepSeek Harness.
Hit a quota limit or 429 Rate Limit? The plugin swaps in the next key you configured and retries instantly β no restarts, no context loss, and zero interruptions.
β‘οΈ Highlights
- π Invisible to Agent & User: Request fails with quota/rate limit β plugin hot-swaps the key β request retries and succeeds seamlessly.
- π Native Web UI: List every key a provider can use and toggle rotation right inside Settings.
- π§ Smart Anti-Spin: Cooldown discipline prevents infinite loops if all your keys are exhausted.
- π§Ό Zero Core Patches: Plugs cleanly into the Harness recovery waterfall β safe to install, safe to remove.
π How It Works
βββββββββββββββββββ 429 / QUOTA / AUTH ββββββββββββββββββββββββ
β Model Request β ββββββββββββββββββββββββββββββββββββΊ β llm-key-rotation β
βββββββββββββββββββ ββββββββββββ¬ββββββββββββ
β² β
β { kind: 'retry' } β 1. Pick next key
β (Adapter re-resolves key) β 2. Hot-swap env ref
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- You keep working with your currently-active key as usual.
- If a request fails (
QUOTA,RATE_LIMIT, orAUTH), the plugin loads the next key from your configured chain. - The turn retries with the new key, and future requests continue with the working key.
π Quick Start
1. Install the plugin
dsh plugin --profile web add @m1khal3v/dsh-llm-key-rotation
2. Configure via Web UI
Navigate to Settings β Plugins β Key Rotation:
- Toggle on rotation for your target provider.
- Select your trigger codes (default:
QUOTA,AUTH). - Click Add key, paste all the keys you want that provider to rotate through, and hit Save.
(Keys are safely saved to the Harness credential store).
βοΈ Behavior & Good to Know
- Smart Rotation Window (300s): During consecutive failures, the plugin walks forward through your configured keys. If no failures occur for >5 minutes, the chain resets to start from the top again.
- Interplay with
dsh-llm-retry:QUOTAandAUTHrotate immediately.RATE_LIMITis handled bydsh-llm-retryfirst (with backoff). To rotate instantly on 429 errors instead, simply removeRATE_LIMITfrom your provider'sretryableCodes.
- Live Terminal Logs: Watch rotation events in real time right in your
dshterminal:
(Secret values are never logged β only provider names, indices, and error codes).[llm-key-rotation] rotated provider="opencode-go" chain[0]β"OPENCODE_GO_API_KEY" (QUOTA)
π§βπ» Development
pnpm install
pnpm run verify # typecheck + test
pnpm run build