rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:LegifyX/dsh-peak-router
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A provider-agnostic peak/off-peak route rule for DeepSeek Harness.
During a configured pricing window it moves live sessions to one provider/model
pair; outside the window it moves them back to another. Both sides are ordinary
provider / model ids from whatever the profile declares, so the plugin is
not tied to DeepSeek, deeprelay, or any other platform.
The switch is written with agent.model.select(), so each change is a durable
model/selection event in the session log — auditable, and never a mutation of
a request already in flight.
A browser half adds a Peak Router page under Settings → Web Extensions. The
page edits the same settings the profile patch declares, with the profile kept
as defaults and the page's saves stored as overrides in
<dsh home>/dsh-peak-router.json.
Some providers charge peak prices for part of the day. A flat-rate plan elsewhere makes those hours the cheapest time to spend that quota instead. The router applies that choice automatically at the boundary, and can stop when the target's own subscription meter is nearly spent.
Every field has a default; only the ones you want to change need to appear.
| Field | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch. Live-editable from the row's settings form. |
peakRoutes |
[{ provider: deeprelay, model: deeprelay/deepseek-v4.1-flash }] |
Ordered peak preference list. The first route with meter room is used; an exhausted route falls through to the next. Empty = no peak switching (main route all day). |
peakProvider / peakModel / peakReasoningEffort |
deeprelay / deeprelay/deepseek-v4.1-flash / '' |
Legacy single-route fields. Used only when peakRoutes is absent or empty. |
offPeakProvider |
deepseek-account |
Provider route used outside the window. |
offPeakModel |
deepseek-flash |
Model used outside the window. |
offPeakReasoningEffort |
'' |
Optional adapter reasoning effort. |
swapBack |
true |
Move sessions back when the window ends. false = one-way. |
respectManualSelection |
true |
Once you pick a different model in a session, that session is left alone until restart. |
timeZone |
Asia/Shanghai |
IANA zone the window and holiday dates are read in. |
peakWindows |
['09:00-12:00', '14:00-18:00'] |
HH:MM-HH:MM windows. Multiple windows allowed; 22:00-02:00 crosses midnight. |
peakDays |
weekdays |
weekdays (Mon–Fri) or all. |
holidays |
[] |
Extra off-peak dates (YYYY-MM-DD) in timeZone. |
quotaAdapter |
deeprelay |
Subscription-meter reader. none disables the guard. |
quotaProvider |
deeprelay |
Deprecated: the guard now reads each route's own provider. |
quotaApiKeyEnv |
DEEPRELAY_API_KEY |
Credential reference holding that provider's key. |
quotaBaseURL |
https://api.deeprelay.ai |
API origin for the meter read. |
minRemainingPercent |
1 |
Skip the swap when any meter has less than this left. |
DeepSeek peak → deeprelay flat plan (the shipped default):
- id: dsh-peak-router
name: dsh-peak-router
config:
peakProvider: deeprelay
peakModel: deeprelay/deepseek-v4.1-flash
offPeakProvider: deepseek-account
offPeakModel: deepseek-flash
Several peak routes in preference order — deeprelay first, then a second provider, then a third; the main route is the final fallback:
- id: dsh-peak-router
name: dsh-peak-router
config:
offPeakProvider: deepseek-account
offPeakModel: deepseek-flash
peakRoutes:
- provider: deeprelay
model: deeprelay/deepseek-v4.1-flash
- provider: openrouter
model: anthropic/claude-x
- provider: zai
model: glm-4.6
A completely different pair — peak to OpenRouter, off-peak to a local model:
- id: dsh-peak-router
name: dsh-peak-router
config:
peakProvider: openrouter
peakModel: anthropic/claude-x
offPeakProvider: llamacpp
offPeakModel: Qwen2.5-Coder-7B-Instruct-Q5_K_M
quotaAdapter: none
A provider whose peak window is UTC-based, every day, and needs no meter check:
- id: dsh-peak-router
name: dsh-peak-router
config:
timeZone: UTC
peakWindows: ['01:00-04:00', '06:00-10:00']
peakDays: all
quotaAdapter: none
One-way (switch at peak, never switch back):
swapBack: false
Paused:
enabled: false
Open Settings → Web Extensions → Peak Router. The page shows the current period, the next boundary, the live route count and the last switch, and edits:
Save writes the overrides and applies them immediately (no restart). Reset to profile defaults deletes the override file. A provider or model that is already persisted but missing from the catalog still appears in its select, so an older route is never silently dropped.
peakRoutes in order; otherwise it uses the main (off-peak)
pair unless swapBack is false.minRemainingPercent left. The next route
in the list is tried; when every route is spent, the main route is used even
if swapBack is false. A failed meter read is logged and that route is
treated as available. A provider with no meter adapter (anything other than
deeprelay today) is always treated as available.agent.model.select(). A new agent is routed synchronously as it is created,
so its first step already runs on the right side.respectManualSelection: false to keep enforcing the schedule.Intl in timeZone, so DST and
midnight-crossing windows are handled without offset arithmetic. The next
boundary is armed exactly; a five-minute safety pass catches sleep/resume
drift.holidays; the plugin ships none.quotaAdapter currently has one implementation, deeprelay. Adding another
provider is one entry in QUOTA_ADAPTERS in lib/index.js; the routing core
never learns a provider name.agent sessions through the registry. Direct
ctx.llm.stream() callers (session titles, compaction) keep their own route.The package has a host half (lib/index.js) and a Web Extensions page
(lib/client.js, declared through dsh.client in package.json). A profile
that links it and inserts the row works:
# profile package.json
"dsh-peak-router": "link:./plugins/dsh-peak-router"
# profile cordis.patch.yml
- insert:
- id: dsh-peak-router
name: dsh-peak-router
config: { ... }
Restart the Host for the row and its client module manifest to load. After that, a page refresh is enough for later code changes.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。