dsh-gateway-models: Completing Protocols, Addresses, and Model Lists for OpenCode Go and Command Code Gateway Routing

Introduction

When using gateway routes like OpenCode Go or Command Code in DeepSeek Harness (DSH), common issues include: missing api in the route causing a needs an api error, having to fill in baseURL manually, incomplete model lists, and requests sent to OpenCode potentially triggering 400 MissingSessionID due to missing session headers. Manually modifying route configuration can alleviate these problems, but it requires repeated maintenance for every host and every route, and the engine catalog may not already include new models like DeepSeek V4.1.

itchenshi/dsh-gateway-models is a community-maintained DSH plugin containing only the host half (category: model inference). It automatically completes the wire protocols, default endpoints, and model lists for the above routes at the assembly layer, and attaches x-opencode-session to OpenCode-related requests. After installation, restarting the engine activates it—no need to open a separate plugin page.

What Is This

  • Name: dsh-gateway-models (GitHub: itchenshi/dsh-gateway-models)
  • Maintainer: itchenshi
  • Positioning: A DeepSeek Harness plugin targeting opencode-go and commandcode gateway routes. It declares the route protocols and endpoints for OpenCode Go / Command Code, fills in the model lists, and handles session headers.
  • License: MIT (see the repository README)

The plugin does not register the page half, nor does it read local HTTP routes. Keys are still resolved by the engine via apiKeyEnv; the plugin neither writes nor reads API keys.

Core Features

The following explains what the plugin does during the startup assembly phase for each of the two routes (facts are based on the repository README).

OpenCode Go (opencode-go)

  1. Declares the wire protocol api: openai-completions for the route, preventing the needs an api error for models outside the catalog.
  2. Reads the engine’s own model catalog, adds the DeepSeek V4.1 series to the opencode-go list, and places it first; user-configured entries are preserved with their original order unchanged.
  3. If the route has no baseURL, it fills in https://opencode.ai/zen/go/v1; already-configured addresses are not modified.

After restarting, you can verify in the model selector: the first item should be DeepSeek V4.1 Flash; V4.1 is ranked first in llm-pi-ai.providers.opencode-go.

Command Code (commandcode)

  1. Declares api and baseURL for the route; users typically only need to fill in the key and do not have to manually enter the API address.
  2. Completes the model list via the public catalog interface GET https://api.commandcode.ai/provider/v1/models (no key required, requests carry no Authorization header). The strategy is add-only, non-modifying, and idempotent.

The Command Code half only takes effect for routes already configured at the user layer (e.g., keys have been filled in), and identifies routes by the API address api.commandcode.ai; route names such as commandcode, commandcode-goat, etc. are all acceptable.

Session Header x-opencode-session

Attaches x-opencode-session to requests sent to OpenCode / OpenCode Go routes:

  • Default mode: uuid: one random UUID per session, does not send internal session IDs to third parties.
  • Optional mode: session-id: explicitly sends the internal session ID.

Used to alleviate MissingSessionID-type errors and support scenarios such as session affinity.

Installation and Activation

Installation commands must come from the official README. After installation, follow the prompts to restart the engine (no page half, no additional UI configuration needed).

The plugin is built into the GUI: open the GUI → Settings window → check Gateway Routes under “Third-party Plugins”, then restart the engine after installation.

Other DSH Hosts (dsh web / CLI)

Choose either one (both install the complete repository content, including cordis.patch.yml):

# Recommended: install directly from GitHub
dsh plugin --profile web add github:itchenshi/dsh-gateway-models

# Alternative: install from Release tarball (example version v0.2.6)
dsh plugin --profile web add https://github.com/itchenshi/dsh-gateway-models/releases/download/v0.2.6/dsh-gateway-models-0.2.6.tgz

This package is not on npm (registry.npmjs.org has no such package), so it can only be installed via the built-in GUI or the two methods above.

Configuration (Optional)

All fields under the config of the id: opencode-go line in cordis.patch.yml are optional:

Key Default Description
providers [opencode, opencode-go] Route names to which the session header is attached; add custom route names if you have them
commandcodeProviders None Additional Command Code route IDs; only needed when a route’s address cannot be seen in the configuration
mode uuid uuid = random UUID per session; session-id = send internal session ID
debug false When true, logs every streaming call that receives the session header
debugFile None Path for appended JSON logs; only effective under $DSH_HOME/logs or the system temp directory; stops appending when exceeding 8 MiB

When you don’t modify the configuration, the above defaults are sufficient.

Typical Usage and Verification

There is no standalone UI: after installation and engine restart, the plugin modifies route configuration at the assembly layer.

  1. OpenCode Go: Confirm the first item in the model selector is DeepSeek V4.1 Flash; check the ordering in llm-pi-ai.providers.opencode-go if necessary.
  2. Command Code: On routes where keys have been configured, check whether the model list has grown compared to before installation; startup logs will normally contain a line like
    [gateway-models] "commandcode": N model(s) from the provider catalog (list X -> Y).
  3. Session header: Default is UUID mode; for debugging, set debug to true or specify a compliant debugFile path.

If the host startup log contains
[gateway-models] active for providers [opencode, opencode-go] with mode uuid (debug=off), it means the OpenCode-related half has been activated.

Applicable Scenarios and Notes

Who it’s for

  • Developers using DSH gateway routes (OpenCode Go, Command Code) who want to fill in fewer baseURLs and maintain model lists manually less often.
  • Scenarios requiring DeepSeek V4.1 to be pinned to the top of the OpenCode Go list, or requiring synchronization of a complete model list from the Command Code public catalog.
  • Situations encountering MissingSessionID on OpenCode routes and needing a stable per-conversation session header.

Environment and Compatibility

  • DSH >= 0.2.0-rc.2 (0.1.x cannot write route configuration due to settings service API changes).
  • Node >= 20.
  • Depends on the public contracts of the engine assembly layer, the settings service, and llm events; when contracts change, the engine will explicitly report plugin load failure at startup rather than silently failing.

Security and Trust

The plugin runs with the permissions of the current DSH process; you should read the repository source code and the MIT license before installation. Except for the GET request to the Command Code public model catalog, the plugin does not make any key-requiring outbound calls, nor does it register local HTTP routes. Configuration writes are validated through the settings service; on failure, the entire write is rejected without leaving half a configuration.

Common Questions (excerpted from README)

  • V4.1 does not appear: if the log shows llm.discoverModels() is unavailable or could not detect the "opencode-go" model catalog, the plugin will skip automatic model filling rather than guess.
  • Command Code list not completed: if could not read the Command Code model catalog (...) appears, it means the public catalog request failed and the original list is unchanged.

The DSH ecosystem philosophy is “everything is a plugin”; the SkillHub catalog page is a community site with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-gateway-models consolidates the repetitive work of protocols, endpoints, models, and session headers across the OpenCode Go and Command Code gateway routes into a single host plugin: V4.1 pinned to the top, Command Code catalog synchronization, default x-opencode-session, all verifiable in the model selector and logs after installation and restart.

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

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

Xiaoye