Stores provider API keys in one local pool and hands out the least-used enabled key over a loopback-only endpoint, tracking usage counters without proxying requests.
Install
# from a prebuilt release tarball
dsh plugin --profile web add "https://github.com/474885697-alt/dsh-kit/releases/download/v0.1.0/dsh-kit-ai-gateway-0.1.0.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:474885697-alt/dsh-kit#path:/plugins/dsh-kit-ai-gateway
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
本机 API Key 池:统一存放、按用量轮询、只在本机借出。
版本 0.1.0 | 包名 dsh-kit-ai-gateway | 仅宿主侧(无客户端代码)| MIT
它解决什么问题
多个 Key(DeepSeek / OpenAI / MiniMax / ElevenLabs…)散在配置文件里,用哪个全凭记忆。
这里集中存一份 keys.json(权限 600),每次 gateway_pick 借出该 provider 下用得最少的 Key,并把计数加一,方便观察配额消耗。
列表默认打码,show_secrets 才显示完整 Key——建议只在确认本机安全时用。
安装
plugin_manager install_bundle target="C:/Users/03/Documents/deepseek-harness/default-workspace/plugins/dsh-kit-ai-gateway"
装完即可用,工具会出现在工具列表里;用 plugin_health 可以体检清单。要卸载就用插件页的开关。
工具
| 工具 | 用途 | 参数(* 表示必填,? 表示可选) |
|---|---|---|
gateway_keys |
Key 池管理:查看(打码)/ 添加 / 移除 / 启用 / 禁用 | action list / add / remove / enable / disableid? stringkey? stringprovider? stringlabel? stringbaseUrl? stringmodel? stringshow_secrets? boolean |
gateway_pick |
借出该 provider 下最久未用的 Key,并把用量加一 | provider? deepseek / openai / minimax / elevenlabs / stability / custom |
gateway_usage |
按 provider 查看 Key 数量与用量 | — |
用法示例
示例:加 Key → 借 Key
gateway_keys(action="add", provider="deepseek", key="sk-…", label="主号")
gateway_pick(provider="deepseek") # → { key: "sk-…", id: "…", used: 1 }
示例:看用量
gateway_usage()
# → { providers: { deepseek: { keys: 2, used: 14 } } }
HTTP 路由(仅本机 loopback)
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/dsh-kit-ai-gateway/pick |
body:{"provider":"deepseek"},借出一个最久未用的 key |
| GET | /api/dsh-kit-ai-gateway/status |
key 数量与用量计数(不含明文) |
配置
- 无需配置;数据在
~/.dsh/dsh-kit-ai-gateway/keys.json(写入时chmod 600)。
数据存在哪
- 同上;计数与 Key 存在同一份 JSON。
安全边界
- 列表/状态接口一律打码;只有显式
show_secrets:true才返回明文,且仅在本机工具调用里。 - HTTP 路由只允许 loopback,
/pick需要 POST。 - 不校验 Key 是否有效、不联网测试——它只是本地仓库。
已知行为
gateway_pick在某个 provider 没有启用中的 Key 时返回 404。
验收
- 假 ctx 单测覆盖增删改查与轮询;真宿主
/status200,用量计数正确。
宿主兼容性
- Web / 桌面宿主:HTTP 路由与工具都可用。
- headless / CLI(没有 webServer 服务):路由自动跳过,工具照常注册。
Links
More in this category
Ebony-Vinyl/dsh-our-free-model★ 67530
Adds free model lanes to DeepSeek Harness — DeepSeek V4.1 Flash, Kimi K3 and others — with no login, sign-up or API key, plus a local OpenAI-compatible gateway, fallback routing and a usage dashboard.
dingminhua/dsh-connect-workbuddy★ 1386
Connects locally signed-in WorkBuddy models, CN and international alike, to DSH, reading each model's credit multiplier from the upstream catalog on every refresh, with per-model image input toggles, account switching backed by an auto-failing-over pool, manual daily check-in, and read-only credit overviews shown as compact pills on the card and in the composer.
Alice-Marx/dsh-model-router★ 957
Routes DeepSeek Harness work across configured model APIs and supported vendor CLIs with dependency-aware packages and cost previews.
V1ki/dsh-plugin-subscriptions★ 579
Use ChatGPT (Codex), Claude, and Grok subscriptions as DeepSeek Harness LLM providers, with Settings login, model catalogs, usage, plus image_generate, video_generate, and x_search tools.
XDTrees/dsh-workbuddy-xdpool★ 481
Merge every locally signed-in WorkBuddy account into DeepSeek Harness as one auto-failing-over model pool (multi-account rotation, live credits, and a model catalog showing per-model credit multipliers and free/night-discount tags).
XDTrees/dsh-xdpool★ 481
Merge every locally signed-in WorkBuddy account into DeepSeek Harness as one auto-failing-over model pool: multi-account rotation, 429 cooldowns, live credits, a model catalog with per-model credit multipliers and free/night-discount tags, QR-code login for 13 vendors, and aggregate free-tier channels. Accounts persist across restarts.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.