Introduction¶
The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” Under the default configuration, model requests directed at OpenCode often fail to work properly. This is usually caused by missing specific gateway origin headers, session ID identification, or missing tool schema definitions for free-tier models. dsh-opencode-patch is a DSH plugin specifically designed to resolve these network-layer protocol issues.
What Is This¶
This is a DeepSeek Harness host plugin maintained by viztor. Its core purpose is to ensure that OpenCode Zen and Go free-tier models are available in a DSH environment. By fixing missing network-layer protocol elements (such as session affinity and request origin headers), it resolves issues where requests are rejected or capabilities are limited.
Core Features¶
- Session Affinity: Implements deterministic
ses_…session hashes, supporting KV cache affinity across multi-turn conversations, subagents, and branches. - Gateway Origin Restoration: Restores
User-Agent,x-opencode-client,x-opencode-project, and the parent session inheritance chain. - Free-Tier Tool Fallback: Provides
readandbashtool schema definitions for free-tier models, resolving 403 errors caused by missing tool definitions. - Model Catalog and Billing: Provides models.dev-based offline caching and background refresh, displaying model names, prices, and context windows; supports a real-time dual-mode billing dashboard.
Installation and Enablement¶
- Install Dependencies: Ensure the environment meets Node 24+. Enter the Web configuration directory and install the package.
- Enable the Plugin: Add the package to the
dsh.profile.bundlesarray in the configuration file. - Configure Credentials: Set
OPENCODE_GO_API_KEY(Go subscription) orOPENCODE_API_KEY(Zen pay-as-you-go). - Restart Service: Restart the
dsh webservice.
Typical Usage¶
The installation command is as follows:
cd ~/.dsh/profiles/web && npm install dsh-opencode-patch
Enable the plugin in ~/.dsh/profiles/web/package.json:
{
"dependencies": {
"dsh-opencode-patch": "^0.14.0",
},
"dsh": {
"profile": {
"bundles": ["dsh-opencode-patch"],
"patchReload": "live",
},
},
}
Use Cases and Caveats¶
- Does Not Work by Default: Without this plugin, OpenCode models do not work by default.
- Routing Mechanism: OpenCode provides 4 different API shapes; this plugin routes by model rather than globally patching.
- Free-Tier Limitations: The plugin does not provide Zen free-tier IDs; headers are mainly used for paid routing.
- Non-Global Impact: Traffic from other providers (DeepSeek, OpenAI, etc.) is unaffected and remains byte-for-byte identical.
- Catalog Information: Without the plugin, catalog information is very sparse (no names, prices, or context windows).
Summary¶
dsh-opencode-patch resolves model unavailability by restoring the required network-layer protocol elements on specific routes. It does not apply global patches, ensures traffic from other providers remains unaffected, and provides complete model catalog and billing display.