Preface¶
When integrating multiple LLM Providers into DeepSeek Harness (DSH), two common issues often arise, compounded by the fact that “the official configuration only provides a single global strategy”: some relay stations require proxy access while others require direct connections. Modifying NO_PROXY acts as a process-level patch and cannot distinguish traffic by Provider. Another issue involves gateways performing client validation based on headers like user-agent or originator. In Harness, the user-agent is hardcoded as dsh-llm, and conflicting fields in the profile’s headers are filtered out, while YAML modifications require a restart.
The following is an introduction to the community plugin dsh-llm-net-router (Maintainer: dyh886, Category: Networking Tools). It wraps globalThis.fetch at the transport boundary to decide whether to connect directly or via HTTP/HTTPS/SOCKS5 proxies based on the request’s target host. It also rewrites client fingerprints after the final request headers are assembled. Uninstallation restores the original state, and rule files are written to disk atomically. The facts in this article are sourced from the GitHub Repository README and package.json.
What is this¶
dsh-llm-net-router is a Cordis plugin for DSH (id: llm-net-router) designed for scenarios where “each Provider requires its own egress strategy and client impersonation.” Unlike the official @deepseek-ai/dsh-http-proxy, which only parses a single global undici dispatcher, this plugin makes runtime decisions based on the target host of the request. Unlike modifying headers in the profile, it rewrites headers at the fetch boundary without touching baseURL or starting local relay ports.
Settings entry: Settings → Network Routing (settings.section, order 72). Requires DeepSeek Harness 0.2.0-rc.2 (dshTarget) and Node.js >= 18; zero runtime dependencies, MIT license.
Core Features¶
Egress Strategy by Host¶
Addresses not matched by Provider rules follow the “Default Strategy.” Once matched, three modes are available:
| Mode | Meaning |
|---|---|
| Inherit Global (inherit) | Hands over to the native Harness strategy; default is the most conservative option. |
| Force Direct (direct) | The host does not go through any proxy. |
| Use Proxy (proxy) | Specify address:port, supporting HTTP / HTTPS / SOCKS5. |
match supports example.com, .example.com, *.example.com, host:port, and *. Longer matches take priority; for matches of the same length, the provider id is sorted lexicographically. Declarative rules in cordis.patch.yml are merged with $DSH_HOME/net-router/rules.json, with the file taking precedence.
Client Fingerprint (Transport Boundary Rewriting)¶
| id | Headers Sent (Summary) |
|---|---|
none |
No rewriting |
codex |
originator: codex_cli_rs and Codex CLI style user-agent |
claude-code |
Claude CLI style user-agent, x-app: cli, etc.; optional 1M appends anthropic-beta: context-1m-2025-08-07 |
custom |
Headers manually written as JSON in the UI |
codexVersion / claudeVersion can override version numbers; headers can override built-in values. context1m is only effective when fingerprint: claude-code is set. The anthropic-beta is deduplicated and merged with the request’s existing beta and the headers, avoiding the disabling of built-in beta features like pi-ai’s thinking.
UI and Probing¶
- Proxy Pool: Can probe TCP / tunnel availability individually.
- Provider Rules: Configure path, proxy, and fingerprint for each line. Matrix Probing tests connectivity under combinations of “Direct / Each Proxy” × “No Masking / Codex / Claude Code (+1M)” and allows one-click adoption to write rules.
- Verify with Real Inference Endpoint: By default, only probes
GET /models; if checked, it probesPOST /chat/completions(max_tokens: 1), as many relay stations only perform client validation on the inference path. - Recent Routing Decisions: Logs requests affected by this plugin, matched rules, paths, fingerprints, and results.
How to read probe conclusions (excerpt): ok indicates 2xx; client-gate requires changing fingerprint; context-gate requires checking the 1M box next to Claude Code; auth indicates checking the key.
Installation and Activation¶
The environment must have DeepSeek Harness 0.2.0-rc.2 and Node.js >= 18 installed. One method recommended in the README is using the official plugin entry (no need to run npm install for runtime dependencies in the plugin directory):
$dshHome = $env:DSH_HOME; if (-not $dshHome) { $dshHome = "$env:USERPROFILE\.dsh" }
dsh plugin --profile desktop add file:$dshHome/plugins/dsh-llm-net-router
If the plugin is already placed in $DSH_HOME/plugins/dsh-llm-net-router, you can also use the README method:
dsh plugin --profile desktop add github:dyh/dsh-llm-net-router
After completion, enable it in the profile’s cordis.patch.yml at the same level as other plugins (excerpt):
- id: llm-net-router
config:
enabled: true
defaultMode: inherit
defaultProxy: ''
proxyPool:
- http://127.0.0.1:7890
- socks5://127.0.0.1:1080
probeTimeoutMs: 8000
inferenceTimeoutMs: 30000
rulesFile: 'net-router/rules.json'
Add dsh-llm-net-router to dsh.profile.bundles and restart Harness (Desktop: Quit from tray and restart). To uninstall, remove from bundles and dependencies, delete the junction (if manually created), and restart; rules.json can be kept or deleted.
Typical Usage¶
Rules File Example¶
Rules saved from the UI or handwritten are located at $DSH_HOME/net-router/rules.json (atomic replace write, BOM tolerant):
{
"version": 1,
"defaults": { "mode": "inherit", "proxy": "" },
"proxies": ["http://127.0.0.1:7890"],
"providers": {
"agentrouter": {
"enabled": true,
"match": ["agentrouter.org"],
"mode": "proxy",
"proxy": "http://127.0.0.1:7890",
"fingerprint": "codex",
"headers": { "x-app": "cli" },
"note": ""
}
}
}
When 1M context models are needed and the gateway requires a beta (different from 401 client validation):
{
"anyrouter": {
"enabled": true,
"match": ["anyrouter.top"],
"mode": "proxy",
"proxy": "http://127.0.0.1:7890",
"fingerprint": "claude-code",
"context1m": true,
"headers": {},
"note": "1M model requires context-1m beta"
}
}
CLI Probing¶
When Harness is running, UI rules and credentials can be reused:
node scripts/probe-cli.mjs --api http://127.0.0.1:19387 --provider primerelay
node scripts/probe-cli.mjs --api http://127.0.0.1:19387 --provider primerelay --endpoint inference
Standalone probing (works even when Harness is not running); use credential references for keys to avoid shell history:
node scripts/probe-cli.mjs https://relay.example.com/v1 `
--api-key-ref RELAY_API_KEY --endpoint inference --model gpt-6-sol `
--proxies 127.0.0.1:7890,socks5://127.0.0.1:1080
--api-key-ref reads from the refs: section of $DSH_HOME/.credentials.yaml.
Applicable Scenarios and Notes¶
Target Audience: DSH users configuring multiple relay stations or self-built gateways where requirements for proxy paths and client headers vary. It is ideal for testing path and fingerprint combinations without modifying the provider baseURL or restarting the system; matrix probing and decision logs save significant time.
Permissions & Security: The plugin runs with the current DSH process privileges, wrapping global fetch and reading/writing rules and configurations under $DSH_HOME. Please review the source code and License (MIT) yourself before installation and only install from trusted sources.
Known Boundaries (README Summary): Only affects requests sent via globalThis.fetch; when the official HTTP proxy plugin’s global dispatcher and “Inherit Global” mode coexist, refer to the README “Known Boundaries”. The community catalog skillhub.cn plugin page is an independent listing and has no official affiliation with DeepSeek / HiDream.
Conclusion¶
dsh-llm-net-router supplements what the Harness configuration layer struggles to express: “Egress by Provider + Client Header Modification by Site.” Rules can be modified via the UI or declaratively seeded, and probing distinguishes between client gates and 1M gates. For further information, see the directory page https://www.skillhub.cn/plugins/dyh886/dsh-llm-net-router and the repository https://github.com/dyh886/dsh-llm-net-router.