a42null/dsh-opencode-zen-plugin: DeepSeek Harness OpenCode Zen Model Adapter Plugin

The core philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” OpenCode Console (Zen) provides an independent model catalog and API channel, but DSH does not natively support it directly. The a42null/dsh-opencode-zen-plugin plugin serves to integrate OpenCode Console’s models into DSH’s invocation chain, making it a standard provider within DSH.

This plugin is maintained by A42Null and is released under the MIT License.

Core Features

The plugin automatically handles model catalog retrieval, protocol adaptation, and metadata synchronization at runtime, so developers do not need to manually configure model lists or endpoints.

  • Zero-Config Model Catalog: On startup and via a timer (default 300 seconds), the plugin fetches the model list from OpenCode’s public API and syncs it into DSH’s model selector.
  • Automatic Endpoint Routing: Maps model name prefixes to different API protocols automatically:
    • gpt-*, grok-*, muse-spark*: mapped to OpenAI Responses API (/zen/v1/responses)
    • claude-* and specific qwen models (e.g., qwen3.8-flash, qwen3.7-max, etc.): mapped to Anthropic Messages (/zen/v1/messages)
    • gemini-*: mapped to Google GenerateContent (/zen/v1/models/<id>:streamGenerateContent?alt=sse)
    • deepseek, glm, minimax, kimi, qwen3.8-max, big-pickle, etc.: mapped to OpenAI-compatible API (/zen/v1/chat/completions)
  • Metadata Synchronization: Fetches context window, output budget, and reasoning level information from models.dev, using a 7-day disk cache (stored at ~/.opencode-zen/models.dev.json).
  • Optimized Error Messages: Provides specific error codes and resolution suggestions for insufficient funds (402), permission restrictions (403), and free-tier limitations—rather than generic “Invalid API Key” errors.
  • Reasoning Passthrough: Supports reasoning levels off / minimal / low / medium / high / xhigh / max, and passes them through to each protocol’s native fields.
  • Streaming Protocol Support: Full support for the Harness streaming protocol, including streaming text, reasoning content, tool calls, usage statistics, and stop reason mapping.
  • Tool Calling & Image Input: Supports image attachments for Vision models.
  • Stream Monitoring: Includes timeout protection—aborts requests after 120 seconds to first byte or 300 seconds of idle time, preventing hangs.

Installation & Activation

Recommended to install directly via DSH’s package manager—no Git repository configuration required.

dsh plugin add @a42null/dsh-opencode-zen-plugin

After installation, restart DSH or reload the plugin to register the opencode-zen provider.

Configuration

In the DSH interface, navigate to Settings → Plugins → OpenCode Zen → Configure.

Setting Description Default
apiKey OpenCode Console API Key (required) (empty)
baseUrl OpenCode Zen gateway base URL https://opencode.ai/zen
includeFreeModels Whether to include free models (*-free) false
refreshSeconds Auto-refresh interval for model catalog (seconds) 300

Settings take effect immediately upon saving—no DSH restart required. If no Key is configured, the model list remains visible (unauthenticated), but calls will return a clear authentication error.

Usage

  1. Configure Key: Enter your OpenCode Console API Key in the configuration panel above.
  2. Select Model: The opencode-zen provider’s model list will appear in DSH’s chat interface model selector.
  3. Invoke: Select a model to start chatting. The plugin automatically switches the underlying protocol based on the model type, handling streaming output and tool calls.

Notes

  • Free Model Limitations: *-free models run within the OpenCode client; calling them via the Console API returns a 403 error, so they are hidden by default. To use them, enable includeFreeModels in settings, but they typically do not work properly in DSH.
  • SystemOne Models: jev-* series models are skipped because they lack chat capabilities.
  • Paid Models: Calling paid models still requires sufficient funds in your Console account.
  • Environment Variables: The API Key can also be passed via the environment variable OPENCODE_ZEN_API_KEY, but the Key set in the settings panel takes precedence.

Summary

This plugin solves the integration problem for DSH users who want to use OpenCode Zen models through automatic routing and metadata synchronization. It not only supports standard chat functionality but also fully passes through reasoning parameters and streaming protocols, making it suitable for developers who need to reuse OpenCode models within a DSH environment.

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

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

Xiaoye