Skip to content

echo-xianyu/dsh-go-rotator

40Last commit Aug 14, 2026

dsh-go-rotator DSH plugin

dsh-go-rotator is a DSH plugin that manages multiple OpenCode Go API keys. It distributes requests across keys, automatically rotates keys on errors, tracks token costs, and watches dashboard quotas to disable keys nearing limits. It also provides a web settings page and a standalone HTTP API.

How to install the dsh-go-rotator DSH plugin

dsh plugin --profile <profile> add ./dsh-go-rotator-0.2.0.tgz

This source command needs manual review. Copying does not run it.

dsh-go-rotator DSH plugin data source

dsh-go-rotator DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-go-rotator DSH plugin can do

  • Request-level routing using apiKeyEnv to resolve the active key per request.
  • Automatic key rotation on RATE_LIMIT, QUOTA_EXCEEDED, AUTH, and INVALID_CREDENTIAL errors with cooldown and debounce.
  • Cost accounting per token for completed streams, stored in rolling windows (5h/week/month) and long-term ledgers (day/month/year).
  • Quota watchdog that periodically scrapes the real dashboard quota (needs workspaceId + authCookie) and disables keys exceeding threshold.
  • Web settings page integrated into dsh web client, plus a standalone HTTP API on port 7777 by default.
  • All data stored under the plugin install directory, no absolute paths needed.

Where the dsh-go-rotator DSH plugin fits

  • Distribute API calls across multiple OpenCode Go keys to avoid hitting rate limits.
  • Automatically recover from quota errors by rotating to a fresh key.
  • Monitor and cap key usage to stay within subscription budgets.
  • Integrate key rotation with external tools via the HTTP API.
  • Track token costs per conversation or per time period for billing or auditing.

Who the dsh-go-rotator DSH plugin is for

  • DSH users who rely on OpenCode Go subscriptions for multiple API keys.
  • Developers building automation or tools that need to pool and rotate keys transparently.

dsh-go-rotator DSH plugin limitations

  • Only supports OpenCode Go API keys; not a generic key rotator for other providers.
  • Requires dsh ≥ 0.1.0-rc.6.
  • Quota watchdog requires manual configuration of workspaceId and authCookie for dashboard scraping.
  • Data is stored locally; no built-in remote synchronization or multi-instance support.
  • Plugin is still in early development (version 0.2.0), may have breaking changes.

dsh-go-rotator DSH plugin: from the repository README

Quoted from the echo-xianyu/dsh-go-rotator README, the upstream source of the dsh-go-rotator DSH plugin. Copyright remains with the original authors.

**OpenCode Go 订阅 key 轮换器** —— 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)提供多 key 负载均衡、自动轮换与配额管理。 ## ✨ 特性 - **按请求路由** —— provider 通过 `apiKeyEnv` 每请求解析活跃 key,多 key 自动分摊负载; - **自动轮换** —— 流以 `RATE_LIMIT` / `QUOTA_EXCEEDED` / `AUTH` / `INVALID_CREDENTIAL` 错误终止时冷却当前 key 并切换(env 即时生效,错误原样上抛,内置 llm-retry 用新 key 无感重试); - **成本记账** —— 正常完成的流按 token 估算成本:滚动窗口(5h/周/月)入状态文件,长期账本(日/月/年)入统计文件; - **配额看门狗** —— 定时抓取各 key 的 dashboard 真实配额(workspaceId + authCookie),越过阈值自动禁用该 key; - **Web 设置界面** —— dsh web 客户端设置页 + 独立 HTTP API(默认 `http://localhost:7777`),供外部工具读写同一状态; - **自包含** —— 全部数据落在插件安装目录的 `data/` 下,配置永远不需要绝对路径。 ## 📦 安装 ```sh # 1. 配置 provider 路由($DSH_HOME/settings.yaml) # llm-pi-ai: # providers: # opencode-go: # displayName: OpenCode Go # api: openai-completions # baseURL: https://opencode.ai/zen/go/v1 # apiKeyEnv: GO_ROTATOR_ACTIVE_KEY # models: [ ...opencode-go 模型... ] # 2. 安装插件(tarball / 本地目录均可) dsh plugin --profile <profile> add ./dsh-go-rotator-0.2.0.tgz # 或开发期直接引用源码目录: # dsh plugin --profile <profile> add file:/path/to/dsh-go-rotator # 3.(可选)把默认模型路由到 opencode-go # $DSH_HOME/cordis.patch.

Read the full READMERepository license: MIT

dsh-go-rotator DSH plugin questions

How do I install the dsh-go-rotator plugin?

Download the tarball from the Releases page, then run `dsh plugin --profile <profile> add ./dsh-go-rotator-0.2.0.tgz`. You can also point to a local directory with `dsh plugin --profile <profile> add file:/path/to/dsh-go-rotator`. Make sure your dsh version is at least 0.1.0-rc.6.

What API keys does this plugin support?

It only supports OpenCode Go subscription keys. You need to configure the provider in your dsh settings.yaml under `llm-pi-ai` with `api: openai-completions`, `baseURL: https://opencode.ai/zen/go/v1`, and `apiKeyEnv: GO_ROTATOR_ACTIVE_KEY`. The plugin will then automatically manage the active key.

How does the plugin rotate keys when an error occurs?

When a stream ends with an error code like RATE_LIMIT, QUOTA_EXCEEDED, AUTH, or INVALID_CREDENTIAL (configurable via `rotateOnCodes`), the plugin cools down that key (default 60 minutes) and selects the next available key. The built-in llm-retry mechanism then retries the request with the new key, making the rotation transparent to the user.

Can I monitor key usage or quota from outside DSH?

Yes, the plugin starts a standalone HTTP API on port 7777 by default (configurable via `guiPort`). You can use that API to read current state, costs, and key status. The plugin also provides a settings page inside the dsh web client.

What happens if all keys are disabled or exhausted?

If all keys are either cooled down or disabled due to quota, the plugin will have no active key to use. Requests will fail with an authentication error. You should monitor the state file or API to replenish keys or adjust thresholds. The plugin does not create keys automatically.