Preface¶
DeepSeek Harness (DSH) adopts a plugin architecture. When using OpenCode Zen’s free model lanes, an API key is typically required for access, and direct integration into the model selector is difficult. The dsh-opencode-free-model plugin solves this pain point by placing OpenCode Zen’s free model lanes directly into the model selector without requiring an API key.
Plugin Introduction¶
This is a Host-only cordis plugin. It registers two provider routes on DSH’s llm service, decodes all three wire protocols supported by OpenCode Zen (Chat Completions / Responses / Messages) into Harness’s StreamChunk protocol, and uses background probing to determine which models are advertised.
Core Features¶
- No Key Required: This lane handles key management via pooled credentials (
Authorization: Bearer public). The plugin does not store any user secrets. - Three Wire Protocols: Implements decoding for three gateway dialects, including
/zen/v1/chat/completions,/zen/v1/responses, and/zen/v1/messages. The protocol is determined by the shape of the request. - Fingerprint Tool Gating: The free tier requires the request body to declare a tool named
read. The plugin declares this tool and providesbash/glob/grepto widen the fingerprint characteristics, filling the missing slot by convertingpwshtobash. - Stable Sessions: Each conversation maps to a stable
ses_…ID, which is the decoded form of the gateway ID. The ID generation method ensures stability. - Attribution: Harness requires attribution User-Agents for every request, and this lane rejects specific product tokens. The plugin preserves attribution but rewrites the product name to
dsh, while retaining the version and origin URL. - Availability Probing: A background probe with a concurrency of 2 classifies each model as Available / Region Blocked / Unavailable / Rate Limited / Unknown. Egress changes trigger immediate re-probing.
- Region Routing: Region-sensitive models are routed to the
opencode-free-model-regionroute. - Inference Cutoff Resumption: Turns interrupted during inference where no content was seen (no text, no tool calls, no finish token) will be resumed from a checkpoint.
- Thinking Level Control:
reasoning_effortis the actual control mechanism. Each model broadcasts the levels it actually accepts, and the plugin forwards the selected level as-is.
Installation and Activation¶
Install the plugin using the following command:
dsh plugin --profile desktop add github:artorias-zj/dsh-opencode-free-model
After installation, restart DSH, and an OpenCode Free group will appear in the model selector.
Configuration¶
Configuration comes from the config key in the bundle patch and is applied on every mount. If a key is omitted in the bundle patch, it falls back to the default value.
- insert:
- id: opencode-free-model
name: 'dsh-opencode-free-model'
config:
enabled: true # Master switch; false advertises no models and causes calls to fail with CONFIG_DISABLED
exposeRegionModels: true # Advertise region-restricted models on the second route
probeIntervalMinutes: 15 # Background re-probing interval (minutes)
defaultMaxTokens: 32768 # Max output tokens per turn
streamRecovery: true # Allow one inference checkpoint resumption
The environment variable OPENCODE_FREE_MODEL_BASE can override the upstream root URL (config.baseUrl takes precedence).
Compatibility and Notes¶
- Runtime Environment: Requires Node.js
^22.15.0 || >=24.0.0. - DSH Version: Built for DeepSeek Harness
0.2.0-rc.2. - License: MIT License.
- Code Type: Pure ESM, no native modules, no build step, no runtime dependencies. No browser code (no
dsh.clientdeclaration).
Conclusion¶
By integrating OpenCode Zen’s free model lanes into DSH, this plugin solves the issue of keyless access and provides a stable usage experience through stable sessions and protocol decoding.
GitHub Repository: https://github.com/artorias-zj/dsh-opencode-free-model