During Beijing working-day peak hours (default 09:00-12:00 and 14:00-18:00) it blocks official DeepSeek requests or reroutes them to a configured target provider; off-peak traffic flows to official as usual.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-peak-block
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:better-er/dsh-peak-block
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.
在 DeepSeek 官方高峰时段拦截官方 provider 请求,保障安心使用梁文谷。
高峰时段默认北京时间工作日 09:00–12:00、14:00–18:00,周末与中国法定节假日全天谷价。拦截到官方请求时:已配置 targetProvider 则切到该目标,未配置则阻止提示并把这条未发出的消息放回输入框;非高峰不拦截,正常走官方。官方判定默认精确匹配 deepseek-official 与 deepseek-account 两个官方路由,不做名称前缀规则,因此 pi-ai 自带的三方 deepseek 中转不会误拦。DSH 0.2 起实际会话默认走 deepseek-account,只认前者会让插件永远放行。
效果
未配置 targetProvider 时于高峰时段发起官方请求,请求被阻止,界面呈现「未配置拦截目标」的报错,同时被拦下的消息自动放回输入框,等谷时直接重发即可:

演示视频
| 禁止梁文峰演示 · 24 秒 |
|---|
安装
从 GitHub 安装:源码在 src/,lib/ 不入仓库,安装时 npm 会触发 prepare 脚本现场构建。
dsh plugin --profile web add github:better-er/dsh-peak-block
从 npm 安装:包内已含构建产物 lib/index.js 与 lib/client.js,安装时不再构建。
dsh plugin --profile web add dsh-peak-block
两种方式装完都会自动挂载,重启 DSH web 后启用,无需手工编辑任何文件。
卸载
dsh plugin --profile web remove dsh-peak-block
彻底移除,重启 DSH web 后不再加载。
配置
插件通过 cordis 配置注入,默认 enabled: true,其余键可覆盖:
| 键 | 默认 | 说明 |
|---|---|---|
enabled |
true |
总开关 |
officialProviders |
未设,认 deepseek-official 与 deepseek-account |
视为「官方」的 provider 精确名单,不设用默认判定 |
targetProvider |
空 | 拦截后切到的目标 provider;留空 = 阻止并提示 |
peakWindow |
工作日 9–12、14–18,周末与法定节假日谷 | 峰谷时段窗口,可整体或局部覆盖 |
配置示例:
plugins:
dsh-peak-block:
enabled: true
targetProvider: opencode-go
peakWindow:
days: [1, 2, 3, 4, 5]
hourRanges: [[9, 12], [14, 18]]
weekendOffPeak: true
边界
- 只拦对话模型请求:
agent/request覆盖 agent loop 的正常对话;compaction 等走ctx.llm.stream的路径不拦。 - 回填只恢复文字:图片与文件附件在拦截时已随提交离开输入框,需要重新选择。
- 回填只对发消息触发的拦截生效:自动续跑等没有用户消息的请求被拦时,没有内容可回填。
- 主机侧的待回填内容保留 10 分钟;页面重载后确认过的内容不会重复放回。
- 输入框已有新内容时,拦截消息放在前面、空行分隔,不覆盖新输入。
targetProvider必须是 DSH 已注册适配器路由,否则切换后以NO_ADAPTER失败。days用 JSgetUTCDay序号,1..5 为周一..周五;时区判定纯 UTC+8 数学换算,与系统时区无关。- 法定节假日名单内置 2026 年,取自国务院放假安排共 33 天,恒为谷价且不受
peakWindow覆盖;表外年份只按周末判定,新安排公布后随源码更新。
要求与开发
是标准形态的 dsh 双半身插件:host 在
agent/requestwaterfall 里拦截并切换/阻止,同时用agent/pre-step记下本步的用户消息;浏览器半身在 composer 工具行里轮询插件通道/dsh-peak-block,把被拦消息写回草稿。设置全部经 cordis 配置文件注入,见上方配置表,不提供界面配置 UI。TypeScript 源码在
src/index.ts、src/restore.ts、src/rpc-channel.ts与src/client/index.ts,由 tsdown 构建到lib/;lib/是产物不入库,改完要重新构建:pnpm install pnpm build # 构建 lib/index.js、lib/index.d.ts 与 lib/client.js pnpm typecheck # 严格类型检查 pnpm test # vitest 单测,覆盖峰谷判定、拦截决策与消息暂存纯函数
isPeakBeijing/isOfficial/decide与RestoreQueue/extractUserText/mergeRestoredText从包入口导出,单测见tests/index.spec.ts、tests/restore.spec.ts与tests/apply.spec.ts。
License
Links
More in this category
bowenliang123/dsh-context★ 5632
DeepSeek Harness officially recommended - a context insight plugin for context composition, evolution and Multi-Agent collaboration. It provides a cross-session Insights page (tokens, cost, cache hit, activity heatmap, skill and tool loads), a per-session Context tab (composition, token and timing stats, timeline, browser, events, file activity, command executions), a Fleet tab for the agent family (the current agent, its parents and every subagent), and a /context command.
Han-1413141/dsh-cost-meter★ 791
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 292
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 207
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 195
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
Mt-Youya/dsh-plugins#sessions-insight★ 132
Browse Claude Code, DSH and Codex session logs by working directory, with per-turn context composition, token usage, compaction markers and cost estimates.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.