Introduction¶
DeepSeek Harness (DSH) uses a plugin-based architecture and allows developers to register custom routes for different backend model services. When integrating third-party models such as OpenCode Go, issues such as session consistency, client identification conventions, and credential management often need to be handled. dsh-opencode-go is an LLM provider plugin for DeepSeek Harness. It registers the zen-go route and ensures that every outbound inference request carries a stable per-session x-opencode-session header.
Core Features¶
The plugin mainly addresses the following technical requirements:
- Routing registration: Registers the
zen-goroute in DSH, avoiding collisions with commonly used names in user-created profiles. - Multi-endpoint support: Supports three API endpoints:
chat/completions: OpenAI-compatible, and supports mimo, deepseek-v4, glm, kimi, longcat, and hy.responses: Supports grok, gpt-5.6-luna, and muse-spark, and includes a separateresponse.incompleteterminal state.messages: Anthropic-compatible, supports minimax and qwen, and usesx-api-keyfor authentication.
- Session management: Automatically attaches the
x-opencode-sessionheader to requests (taken from the session ID, or generated as a UUID when missing) to ensure session tracing. - Client identification: Uses a custom User-Agent (
deepseek-harness/<version> (+url) dsh-opencode-go/<version>) to help operators identify and allowlist the client, rather than the genericGo-http-client/1.1. - Credential resolution: Supports layered credential resolution order (process environment variables -> managed store -> project/home
.env), allowing key rotation without a restart. - Settings panel: Provides Web interface settings, supporting key entry on the Models page row and sidebar, model selection, configuring context/output limits, and setting the endpoint and reasoning level.
- Reasoning levels: Supports Low/Medium/High/Xhigh levels; different endpoints (
chat/responses/messages) correspond to different parameter fields. - Multimodal and image handling:
- Supports vision models.
- When the total size of inline images in a request exceeds
maxRequestImageBytes(default 64 MiB), it emits anIMAGE_OFFLOAD_REQUIREDsignal, which is handled by DSH’s offload mechanism; this plugin does not directly drop images. - Individual image sizes are determined by admission normalization in the attachment service; this plugin does not enforce image size limits.
- Usage recording: Consistently records usage for the three endpoints (
prompt_tokens/input_tokens) and generates ausage.lusage ledger recording the model, session, actualx-opencode-sessionheader, input and output usage, and reasoning consumption.
Installation and Enablement¶
Use the following command to install the plugin:
dsh plugin --profile web add github xia-sc/dsh-opencode-go
After installation, restart the DSH Web service. In the session’s model selector, choose zen-go/<model> to use the plugin.
Credential configuration:
Add the key to $DSH_HOME/.credentials.yaml, or paste and save it directly in the settings card. You can also set the environment variable OPENCODE_GO_API_KEY.
Configuration¶
In the DSH configuration, set the llm-opencode-go section or layer configuration. Key configuration fields are as follows:
| Field | Default | Description |
|---|---|---|
apiKeyEnv |
OPENCODE_GO_API_KEY |
Credential reference name |
apiBase |
https://opencode.ai/zen/go |
API base URL (without the /v1 prefix) |
requestTimeoutMs |
60000 |
Connection + first-packet timeout |
streamIdleTimeoutMs |
300000 |
Stream idle timeout |
maxRequestImageBytes |
67108864 |
Maximum total inline image bytes per request (bytes) |
enabledModels |
All | Enabled model list |
modelCaps |
[] |
Manual model capability overrides (context window, endpoint, multimodality, etc.) |
Note: The official /v1/models endpoint does not return context window information; modelCaps must be filled in manually. If a setting in the settings card is rejected (for example, configuring the max level, which is only available for chat, on the responses endpoint), the entire settings block is discarded and defaults are used.
Typical Usage and Considerations¶
- Local source installation: If installing from local source code, run the script first to establish the dependency bridge:
cd <插件源码目录>
node scripts/setup-local-deps.cjs
dsh plugin --profile web add <插件源码目录>
-
Token budget management: In
responsesendpoints, high reasoning effort can consume a large number of tokens, so start with a largermaxTokensin the settings. -
Pricing: Pricing is determined by the billing plugin; this plugin is responsible only for usage reporting.
-
Image limits: This plugin does not enforce image size limits; that limit is determined by the attachment service’s admission normalization.
Conclusion¶
dsh-opencode-go provides a one-stop solution covering route registration, session management, credential resolution, and usage recording. It is suitable for scenarios that require integrating the OpenCode Go ecosystem and managing it centrally in DSH. For more details, see the project directory or GitHub repository.