dsh-connect-zcode: Reusing ZCode Coding Plan Model Quota in DSH

Introduction

DeepSeek Harness (DSH) runs the toolchain, sessions, approvals, and team collaboration within a single harness. The ZCode desktop client comes with its own agent loop, sub-agents, and memory, but in many scenarios you may only want to use the Zhipu BigModel Coding Plan quota bound to ZCode, while keeping sessions and tools running through DSH.

Directly extracting the API Key to call the gateway is not straightforward: the Coding Plan uses a first-class API Key (id.secret) that can be stored either in plaintext config or an encrypted credential store. Historically, the Start Plan used JWT authentication, and upstream risk controls disallowed direct connections; the hosted relay channel that this plugin previously attempted was taken offline on 2026-10-17. Below we introduce the community plugin dsh-connect-zcode (maintainer: Shuffle-1992): it reads credentials from ZCode’s local configuration, registers a standard LLM provider in DSH, and lets DSH send model requests itself.

What Is This

dsh-connect-zcode is a DSH-native provider plugin, categorized under model inference. It integrates ZCode (Z.ai / Zhipu BigModel)’s Coding Plan (paid subscription) into DSH. The provider id is zcode, the wire protocol is anthropic-messages, and the endpoint is derived from the baseURL field in ~/.zcode/v2/config.json.

The credential policy is zero disk writes, zero caching, reading on every invocation. The plugin is not published to npm; the current repository version is 0.6.0 (MIT). DSH compatibility is declared in package.json as engines.dsh: ">=0.2.0-rc.2 <0.3.0-0".

If you need “agent autonomous task execution + free Start Plan quota”, the README points to the sister project zcode-dispatch, which complements this plugin’s provider mode but is not covered by the installation steps in this article.

Core Features

Direct Coding Plan Channel

Item Description
provider id zcode
Wire protocol anthropic-messages
Request sender DSH (via pi-ai → gateway HTTP)
Credential source ZCode config.json or encrypted credentials.json
Applicable plan Coding Plan

The plugin parses builtin:bigmodel-coding-plan from ZCode configuration (can be overridden via planKey) and declares the model list and context window to DSH. The default context window is 200000; the settings panel can write per-model budgets up to 1M (contextBudgets), aligned with the caps declared by the ZCode client in its config.

Settings Panel Capabilities

The client injects the DSH settings UI, supporting:

  • Model visibility (enabledModelIds): an empty array means all models are shown; a non-empty array shows only the listed model ids.
  • Context budget (contextBudgets): write the official Max tier (e.g., 1000000) per model.
  • Capability switches (modelOverrides): configure reasoning / image for models without official metadata; models locked by official data ignore this option.

The concurrency upper bound for inference is controlled by maxConcurrent (default 2, range 1..2).

Quota and Switch (auxiliary)

The plugin maintains a frozen switch file (default ~/.dsh/dispatch.switch.json) and a quota ledger (default ~/.dsh/dispatch-runs.jsonl, append-only). A missing or corrupt switch file is treated as enabled. These paths can be overridden via the environment variables ZCODE_CONNECT_SWITCH_PATH and ZCODE_CONNECT_LEDGER_PATH.

Installation and Activation

Prerequisites

  1. ZCode logged into Coding Plan
    Run /login bigmodel-coding-plan in ZCode (OAuth or manually pasting a Key).
    Check ~/.zcode/v2/config.json → provider["builtin:bigmodel-coding-plan"]: enabled: true, options.apiKey is not a JWT starting with ey, options.baseURL is non-empty.

  2. DSH desktop client (Electron) running normally
    The plugin resolves pi-ai / dsh-llm-pi-ai / dsh-llm from the host’s embedded node_modules inside app.asar. If resolution fails, set ZCODE_CONNECT_MODULES_ROOT or ZCODE_CONNECT_DSH_RESOURCES and restart DSH.

For the web profile, replace --profile desktop with --profile web. You can pin a version by adding a git tag, e.g., #v0.4.0.

dsh plugin --profile desktop add github:Shuffle-1992/dsh-connect-zcode

After installation, restart DSH; a zcode group should appear in the model selector.

Compatibility and Offline Self-Check

Before and after upgrading DSH, you can run in the plugin directory:

node scripts/compat-check.mjs

A last line of COMPAT PASS and exit code 0 means you are within the declared DSH / Node range. The repository also provides:

node test/selfcheck.mjs

It should output SELFCHECK PASS and exit 0.

Configuration Essentials

Common keys in the plugin config (cordis.patch.yml or profile overrides):

Key Default Description
planKey builtin:bigmodel-coding-plan The plan entry to wire up
contextWindow 200000 Base context window
maxConcurrent 2 Concurrency upper bound (1..2)
credentialPath empty → ~/.zcode/v2/config.json ZCode config path
enabledModelIds [] Model visibility; empty means all
contextBudgets {} Per-model context budget written by the panel
modelOverrides {} Capability switches written by the panel

Environment variables can also override the module root directory and DSH resources path; see the “Configuration” section of the README.

Common Causes When Credentials Cannot Be Read

The Coding Plan Key may appear in two places:

  • ~/.zcode/v2/config.json → provider["builtin:bigmodel-coding-plan"].options.apiKey (plaintext)
  • ~/.zcode/v2/credentials.json → encrypted entry enc:v1

After OAuth re-login, ZCode may only update credentials.json without writing back to config.json, causing tools that read only the latter to receive 401 errors. In this case, confirm your ZCode login status, or specify credentialPath as needed / let the plugin logic cover the path you actually use (refer to the repository’s troubleshooting documentation for details).

Typical Usage

  1. Complete ZCode Coding Plan login and DSH plugin installation.
  2. In the DSH model selector, choose a model under the zcode group to start a session; requests are sent by the DSH harness and consume Coding Plan quota.
  3. In the plugin settings panel, check the models you want to display, select the 200K or 1M context tier, and enable the required reasoning/image capability declarations.
  4. For long-context boundary probing (will consume quota), use the repository script node scripts/probe-context-limit.mjs; for zero-inference verification, use node scripts/probe-context-declared.mjs (only GET /v1/models).

For authentication, the project has verified that the Coding Plan channel works with just the x-api-key header alone; anthropic-version is not required.

Use Cases and Caveats

Who it’s for: Developers who have already purchased or enabled the Coding Plan in ZCode and want to use the same set of tools, approvals, and team workflows within DSH, without switching back to ZCode’s built-in agent.

Permissions and security: The plugin runs with the current DSH process’s permissions and reads the API Key from the local ZCode configuration (it is not written to the plugin directory, but is still used within the process). Before installing, it is recommended to review the source code and MIT license on GitHub to ensure compliance with your requirements.

Ecosystem note: The DSH community plugin catalog (e.g., the SkillHub entry) is maintained by the community and has no official affiliation with DeepSeek / 幻方 (Fanhui); installation commands should follow the repository README — do not construct CLI commands based solely on the plugin name.

Version and history: The hosted relay channel for Start Plan / promotional quota was removed from the code on 2026-10-17 due to incomplete integration; the current repository retains only the Coding Plan provider channel. If user-facing materials still mention “two plans”, refer to the current README description.

Conclusion

dsh-connect-zcode solves the wiring problem of “quota in ZCode, execution in DSH”: a single dsh plugin ... add github:Shuffle-1992/dsh-connect-zcode, combined with ZCode’s local Coding Plan login, lets you use the zcode provider in the DSH model list.

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

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

Xiaoye