Introduction¶
DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture. The official PiAiAdapter and OpenAI-compatible interface are provided to make it easy for developers to integrate local or cloud models. In scenarios where you need to reuse existing login sessions, model catalogs, and credit systems, manually wrapping or integrating them incurs additional development and maintenance costs. This article introduces ericwang1358/dsh-connect-dumate — a model inference plugin compatible with DSH 0.2.x that connects a locally logged-in “Baidu DuMate” (百度搭子) into the official DSH architecture.
What It Is¶
dsh-connect-dumate is a DSH model inference plugin developed by maintainer EricWang1358. It reads (read-only) the local DuMate desktop client’s login state (auth.json + .cookie-key) and model metadata (opencode.json), providing an OpenAI-compatible Loopback Shim within the DSH process. The official PiAiAdapter then fully handles streaming output, tool calling, multimodal input, and error retry. The plugin also offers a standalone credit dashboard, daily check-in, and model enablement/multiplier display configuration.
Core Features¶
-
Zero extra dependencies & no host pollution
All DSH runtime interfaces are declared inpeerDependencies. It does not carry legacy@deepseek-ai/*override dependencies, nor does it disable the host’s built-inllm-pi-ai. -
No-client direct access (read-only login state reuse)
Automatically reads and AES-256-GCM decrypts the local DuMate desktop client’sauth.jsonand.cookie-key(supports full paths on Windows / macOS / Linux), exchanging for a cloud gateway Token on demand per request. Also supports entering a manual Cookie in the panel as a fallback for machines without the client installed. -
Dynamic model catalog
Automatically reads conversation model metadata from the desktop client’sopencode.json(provider.QianfanPersonalQuota.models) (supportsqwen4-max,deepseek-v41-flash,glm-53,kimi-k31, etc.), and atomically saves a snapshot to~/.dsh/dumate-models.snapshot.jsonas a fallback. -
In-process Loopback Shim + official
PiAiAdapter
Binds a127.0.0.1:0ephemeral port within the plugin and validates a 32-byte random in-process Bearer Secret. The official DSHPiAiAdapterfully handles true SSE streaming, Tool Calling (function/tool invocation), multimodal image input, automatic 401 token-refresh retry, and immediate abort on disconnection. -
V4.1 reasoning intensity mapping
Correctly maps theoff/low/high/maxreasoning toggles for V4.1 backend models such asdeepseek-v41-flash, while safely stripping invalidreasoning_effortfrom other models. -
DSH Settings Panel
View the split DuMate independent credit pool (filtering shared products and inactive subscription periods) under Settings → Baidu DuMate and the plugin configuration card. Includes one-click daily check-in / auto check-in on startup, model enablement checkboxes, and a credit multiplier display toggle. -
Measured credit multiplier table
The plugin ships with a measured credit multiplier table based onscripts/measure-rates.mjs(sorted by measured output unit price from high to low), covering mainstream models such askimi-k31,qwen3.8-max,deepseek-v4.1-flash,glm-53. Runpnpm measure:ratesto re-measure in real time for the current account.
Installation & Enablement¶
DSH CLI Profile¶
# Install from npm (after publication) or GitHub
dsh plugin --profile <your-profile> add github:EricWang1358/dsh-connect-dumate
Then add "dsh-connect-dumate" to the dsh.profile.bundles array in the corresponding profile’s package.json.
DSH Desktop (Desktop Source Build Installation)¶
git clone https://github.com/EricWang1358/dsh-connect-dumate.git
cd dsh-connect-dumate
pnpm pack
Then use the desktop’s built-in pnpm to install the generated .tgz package via DSH Desktop’s plugin manager or the desktop profile directory (~/.dsh/profiles/desktop), and add "dsh-connect-dumate" to the dsh.profile.bundles array in ~/.dsh/profiles/desktop/package.json.
Local Credentials & Path Reference¶
The plugin reads DuMate desktop client’s login state and model metadata in a read-only manner and does not modify any DuMate files:
- Windows:
%APPDATA%\qianfan-desktop-app - macOS:
~/Library/Application Support/qianfan-desktop-app - Linux:
$XDG_CONFIG_HOME/qianfan-desktop-app(defaults to~/.config/qianfan-desktop-app)
Environment variable overrides:
DUMATE_USER_DATA_DIR: Custom DuMate data directoryDUMATE_OPENCODE_CONFIG: Customopencode.jsonpathDUMATE_GATEWAY_URL: Custom gateway conversation endpoint
The plugin’s own settings and model snapshot are stored at:
~/.dsh/dsh-connect-dumate.settings.json~/.dsh/dumate-models.snapshot.json
Development & Testing¶
Requires Node.js >= 22.0.0:
# Syntax check
npm run check
# Run offline unit tests (zero network, zero local state dependencies)
npm test
# Optional: Trigger a real end-to-end streaming test (requires a logged-in DuMate desktop client on this machine)
DUMATE_LIVE_TEST=1 npm test
Typical Usage¶
- After installing the plugin, configure the login state under DSH Settings → Baidu DuMate (auto-read or manually enter a Cookie).
- Enable the desired models in the plugin configuration card (e.g.,
deepseek-v41-flash,kimi-k31,glm-53, etc.). - Select the corresponding model in DSH’s model selector. DSH will forward the request to the DuMate gateway via the Loopback Shim and return a streaming response.
- Periodically run
pnpm measure:ratesto calibrate the credit multiplier for the current account.
Applicable Scenarios & Notes¶
- Ideal for DSH users who already use the DuMate desktop client and wish to reuse their existing login session and credit system.
- The plugin runs with the current DSH process permissions. It is recommended to review the source code and license (MIT) before installation.
- Please comply with DuMate’s and Baidu’s relevant terms of service and rate limits, and assess the usage risk for your own account.
Conclusion¶
Building on the official DSH architecture, dsh-connect-dumate achieves a smooth integration with Baidu DuMate through read-only login state reuse, a dynamic model catalog, and the Loopback Shim. It preserves DSH’s streaming and tool-calling capabilities while providing practical features such as a credit dashboard and automatic check-in. Project directory and source code are available at:
- Directory page: https://www.skillhub.cn/plugins/EricWang1358/dsh-connect-dumate
- GitHub: https://github.com/EricWang1358/dsh-connect-dumate