dsh-connect-dumate: Connect a Locally Logged-In Baidu Dumate to DeepSeek Harness

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

  1. Zero extra dependencies & no host pollution
    All DSH runtime interfaces are declared in peerDependencies. It does not carry legacy @deepseek-ai/* override dependencies, nor does it disable the host’s built-in llm-pi-ai.

  2. No-client direct access (read-only login state reuse)
    Automatically reads and AES-256-GCM decrypts the local DuMate desktop client’s auth.json and .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.

  3. Dynamic model catalog
    Automatically reads conversation model metadata from the desktop client’s opencode.json (provider.QianfanPersonalQuota.models) (supports qwen4-max, deepseek-v41-flash, glm-53, kimi-k31, etc.), and atomically saves a snapshot to ~/.dsh/dumate-models.snapshot.json as a fallback.

  4. In-process Loopback Shim + official PiAiAdapter
    Binds a 127.0.0.1:0 ephemeral port within the plugin and validates a 32-byte random in-process Bearer Secret. The official DSH PiAiAdapter fully handles true SSE streaming, Tool Calling (function/tool invocation), multimodal image input, automatic 401 token-refresh retry, and immediate abort on disconnection.

  5. V4.1 reasoning intensity mapping
    Correctly maps the off / low / high / max reasoning toggles for V4.1 backend models such as deepseek-v41-flash, while safely stripping invalid reasoning_effort from other models.

  6. 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.

  7. Measured credit multiplier table
    The plugin ships with a measured credit multiplier table based on scripts/measure-rates.mjs (sorted by measured output unit price from high to low), covering mainstream models such as kimi-k31, qwen3.8-max, deepseek-v4.1-flash, glm-53. Run pnpm measure:rates to 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 directory
  • DUMATE_OPENCODE_CONFIG: Custom opencode.json path
  • DUMATE_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

  1. After installing the plugin, configure the login state under DSH Settings → Baidu DuMate (auto-read or manually enter a Cookie).
  2. Enable the desired models in the plugin configuration card (e.g., deepseek-v41-flash, kimi-k31, glm-53, etc.).
  3. 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.
  4. Periodically run pnpm measure:rates to 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

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

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

Xiaoye