dsh-model-proxy: Domain-based proxy for DSH model API requests

Preface

When integrating overseas model providers in DeepSeek Harness (DSH), the common practice is to enable a system-wide proxy for the entire machine, or to set HTTP_PROXY individually for the terminal. This often routes web scraping, MCP, tool calls, etc. through the proxy as well, which is both slow and prone to conflicts with local services. If you only want “model API goes through the proxy, everything else connects directly”, you need to do fine-grained routing on fetch within the Harness process. Below we introduce the community plugin dsh-model-proxy (maintainer: recyvan, category: model inference), which specifically forwards DSH model API requests by domain through a proxy, while traffic not listed in the rules maintains direct connections.

What is this

dsh-model-proxy is a model proxy plugin for DeepSeek Harness: without modifying Harness source code, it uses a Cordis patch to intercept model-related fetch calls within the process, routing them through the system proxy, custom HTTP/HTTPS/SOCKS proxy, or disabling the proxy based on configuration. After uninstallation, behavior is identical to when it was not installed.

  • Repository: recyvan/dsh-model-proxy
  • Community directory: skillhub.cn plugin page
  • License: MIT (see repository README)
  • Current package version (package.json): 0.2.0
  • Requires DSH: 0.2.1-rc.2 or newer; the settings page is generated by the host based on the plugin’s Config schema (independent settings service was removed in 0.2.x)

Core Features

Proxy modes and routing

Setting Meaning
Mode rule (recommended) / system / custom / off
Proxy protocol http / https / socks5 / socks5h / socks4
Proxy address e.g. socks5h://127.0.0.1:7890, or 127.0.0.1:7890 (protocol is filled in from the previous item)
Proxy only these domains If empty, uses built-in presets; if filled, only proxies the listed domains (comma-separated, supports *.openai.com, .aiplatform.googleapis.com, etc.)
Exclude domains Always direct, highest priority

Changes take effect on the next request, no need to restart DSH.

In rule mode, when the domain list is empty, the built-in presets route common overseas APIs like OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter through the proxy, while domestic lines like DeepSeek, DashScope, Zhipu, Kimi maintain direct connections.

system mode follows the Windows system proxy (re-reads HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings every 30 seconds).

custom mode allows filling in a proxy address and listing exceptions in Exclude domains, achieving “global proxy, a few direct connections”.

Three security constraints that cannot be relaxed

No matter how the user configures, the rule engine will enforce first:

  1. Forced direct connection: loopback, private network segments, localhost, .local/.lan/.internal etc. must not go through the proxy; users can only add items, not remove these.
  2. Plaintext gate: non-https model requests are rejected before establishing a connection, unless explicitly enabled in the settings page (the page will show a persistent warning).
  3. Data minimization: request/response bodies are streamed through, not parsed, not persisted to disk, not reading Authorization or vendor API keys; default logs only record exit identifiers and error types, not hostnames, paths, or body content.

When the proxy exit fails, it falls back to direct connection, no silent switching to another exit; the degraded status is logged and displayed on the settings page.

Coverage and limitations

  • Will proxy: requests sent through Harness fetch — in practice this covers almost all model requests; if you add a domain to the proxy list, other fetch calls to that domain will also go through the proxy.
  • Will not proxy: transport: websocket streaming, vendor native SDK channels (such as Amazon Bedrock); Harness built-in environment variable proxy can handle such scenarios. Web scraping tools create their own undici agents, invisible to domain rules.
  • Routes by domain: if the same domain hosts both model API and other traffic, the entire domain will go through the proxy; you can put that domain in Exclude domains.
  • Only single-hop proxy is fully wired on the undici side; multi-hop chains have an interface in lib/core/dispatcher.js but are only passed to undici for the first hop.
  • The proxy must listen on loopback; for mainland access to overseas APIs, the README recommends prioritizing socks5h (DNS resolved by the proxy), and pay attention to DNS pollution.

Installation and activation

Install the plugin under the corresponding profile (command from official README):

dsh plugin --profile <your-profile> add github:recyvan/dsh-model-proxy

Restart DSH after installation — the host side loads within the Harness process.

Uninstall:

dsh plugin --profile <your-profile> remove dsh-model-proxy
dsh --profile <your-profile>

After removal, restores all direct connections, no configuration residue, no listening ports.

Typical usage

Scenario A: Local Clash / V2Ray on port 7890, only overseas APIs through proxy

  1. Open Settings — Model Proxy (independent page in the settings sidebar).
  2. Mode = rule, protocol = http, address = 127.0.0.1:7890, leave domain list empty (use built-in presets).
  3. Enable local/LAN listening in the proxy client.

Scenario B: Follow Windows system proxy

Mode = system, rest as needed; the plugin periodically syncs after system proxy changes.

Scenario C: Global proxy, a few domains direct

Mode = custom, fill in the proxy address, list exceptions in Exclude domains.

Additional notes for mainland environments: plaintext http carrying API keys through the proxy is rejected by default; if truly needed, you must check the corresponding option on the settings page. Proxy credentials can only be written in the address (http://user:pass@host:port), which will be stored in plaintext in the settings; a safer approach is to have the local proxy skip authentication for loopback.

Verification and self-testing

  1. The settings page displays real-time status: path A · exit route · N rules · proxied x / direct y.
  2. Accessing http://127.0.0.1:<port>/dsh-model-proxy/status locally returns JSON consistent with the settings page (only loopback / same-origin).
  3. Run npm test (i.e. node test/run-all.mjs) in the source directory; the test suite comes with the repository, dependencies are resolved from the current DSH profile (or DSH_HOME) for the host’s own undici and @deepseek-ai/schemastery.

Use cases and caveats

Suitable for: developers in mainland China using DSH to call overseas model APIs, who want rule-based traffic splitting and reduced side effects of whole-machine proxying.

Not suitable for or needs separate solutions: WebSocket streaming, Bedrock and other non-fetch channels; scenarios that only rely on Harness web scraping and don’t want to touch the proxy list.

The plugin runs with the current DSH process permissions and will modify the exit behavior of fetch within the process. Before installation, it is recommended to read the source code and MIT license on GitHub to confirm that the routing and security policies meet your compliance requirements. The DeepSeek Harness community plugin directory (such as skillhub.cn) is an independent ecosystem site, not officially affiliated with DeepSeek / High-Flyer; the facts in this article are based on the repository README and package.json.

Conclusion

dsh-model-proxy uses “domain-based proxying + forced direct connections for private networks + plaintext and logging constraints” to separate model API outbound traffic from other Harness traffic. Configuration is completed on the settings page, failures are visible, and uninstallation is reversible. To learn more, you can start from the community directory page, or directly check the GitHub repository README (includes English and README_zh.md).

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye