viztor/dsh-opencode ↗★ 1

@viztor/dsh-opencode

提供OpenCode模型的会话关联与工具回退支持 适合在DSH上使用OpenCode模型,需要会话亲和性及免费额度监控的用户。

套件
@viztor/dsh-opencode
相容性
待驗證
版本
0.5.1
授權
MIT
最近更新
2026年10月1日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:viztor/dsh-opencode

OpenCode on DeepSeek Harness

npm version CI Release License: MIT Node >= 24 Last commit

Free OpenCode models, working inside DeepSeek Harness. Zen (muse-spark-1.3-contributor-free, space-bunny-free) and Go (deepseek-v4.1-flash) — no 403 FreeTierError, no 400 MissingSessionID.

OpenCode's gateways expect three things DSH doesn't send by default: a valid x-opencode-session on every call, CLI origin proof on Zen (User-Agent, client headers, ses_…-shaped IDs), and read/bash tool definitions on free-tier calls. DSH strips the user agent, identifies sessions with UUIDs the gateways reject, and can send tool-less requests — so the calls fail. This plugin restores exactly what's missing at the network layer, and only for OpenCode traffic (opencode / opencode-go routes, zen/v1 / zen/go/v1 URLs). DeepSeek, OpenAI, GitHub, and every other request pass through byte-for-byte untouched.

Install

From npm:

dsh plugin --profile web add @viztor/dsh-opencode

Or pin it in your profile's package.json:

{
  "dependencies": {
    "@viztor/dsh-opencode": "^0.5.0"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        "@viztor/dsh-opencode"
      ]
    }
  }
}

Then pnpm install in the profile directory.

Configure

DSH Web → Settings → Plugins → OpenCode Integration. Flip toggles, Save:

SettingDefaultEffect
Inject User-AgentonRestores the OpenCode CLI User-Agent DSH strips
User-Agent OverrideemptyCustom string instead of the canonical CLI one
Inject Origin HeadersonAdds x-opencode-client: cli + x-opencode-project: global
Inject Core ToolsonAdds fallback read/bash schemas to free-tier /responses calls
Providersopencode, opencode-goWhich route IDs get the treatment
Debug LoggingoffLogs each header-injected call via ctx.logger
Debug FileemptyAppends JSONL stream-debug entries to a server-side path

Defaults live in code and show in the labels, so an empty field always means "the default". Settings resolve in layers — built-in defaults, then cordis.patch.yml, then anything saved here — and saving writes only what you edited. The Overridden badge marks UI-saved fields; Reset drops a field back to the file value.

Headless config

For servers or cordis.patch.yml overlays (all optional — omitting everything yields the defaults above):

- id: dsh-opencode
  name: "@viztor/dsh-opencode"
  config:
    providers: [opencode, opencode-go]
    injectUserAgent: true
    userAgent: ""
    injectOriginHeaders: true
    injectCoreTools: true
    debug: false

Types and debugFile are documented in cordis.patch.yml.

Troubleshooting

SymptomLikely causeFix
403 FreeTierError on free modelsHeaders stripped or tools missingKeep the three inject toggles on
400 MissingSessionIDNo session header attachedPlugin must be in bundles and activated — check boot logs
Anything else misbehavingShouldn't be us — non-OpenCode traffic is never touchedFile an issue with a redacted log

Compatibility

Last verified: 2026-10-01 — refreshed on every release (see Contributing).

ComponentVerified version
Plugin@viztor/dsh-opencode@0.5.1 (npm + GitHub Packages)
HostDSH Web profile (dsh-profile-web, patchReload: live)
RuntimeNode 24+
Gatewayszen/v1 (/responses + chat completions), zen/go/v1 (chat completions)
Modelsmuse-spark-1.3-contributor-free, space-bunny-free, deepseek-v4.1-flash (Go)
Gatesvp check clean, 49 deterministic tests green, registry install resolves

Links

Attribution

Evolved from nobu121/dsh-opencode-session by @nobu121, which pioneered the x-opencode-session approach for OpenCode Go. This project extends it to Zen free-tier compatibility, deterministic session hashing, configurable headers, and a Web settings UI.