模型与提供方
#dsh-plugin
dsh-plugin-adapter
将 OpenCode Zen 免费模型接入 DeepSeek Harness,无需 API Key,并跟踪网关兼容性。
1624318455
@1624318455
⬇ 2
★ 0
master
安装
dsh plugin --profile web add github:1624318455/dsh-plugin-adapter
需要可复现安装时,可在仓库后追加 #commit 固定提交。
将 OpenCode Zen 免费模型接入 DeepSeek Harness,无需 API Key,并跟踪网关兼容性。
该插件未提供要点说明,请参考仓库 README。
dsh-plugin
- 安装并启动 DeepSeek Harness:
npx @deepseek-ai/dsh web - 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
- 用 dsh plugins list 确认已安装,必要时重启 Harness 生效
插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。
| 代码仓库 | github.com/1624318455/dsh-plugin-adapter |
| 许可证 | MIT |
| 主要语言 | master |
| 下载量 | 2 |
| GitHub 星标 | 0 |
| 最近推送 | 2026-09-17 |
| 收录日期 | 2026-09-19 |
| 分类 | 模型与提供方 |
事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。
以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。
# dsh-plugin-adapter
**Free OpenCode Zen models, natively inside DSH (DeepSeek Harness).**
No API key. No registration. No extra process.
[](https://github.com/1624318455/dsh-plugin-adapter)
[图片: license]
[图片: Awesome]
[图片: node]
[图片: tests]
[图片: stars]
[图片: last commit]
English | [简体中文](README.zh-CN.md)
---
`dsh-plugin-adapter` registers a native DSH `LlmAdapter` that streams directly from
[OpenCode Zen](https://opencode.ai/zen)'s **anonymous free lane** — the same
models OpenCode's own CLI uses without an account, served to your DSH model
picker as a regular provider called `opencode2dsh`.
Requests leave your machine looking exactly like traffic from the OpenCode
CLI (same user agent, same correlation headers), and the model catalog stays
fresh through a three-tier fallback chain. There is nothing to log into and
nothing to host.
## Features
- **Zero credential, zero setup** — the anonymous lane needs no key; install, restart, chat
- **Native adapter, no sidecar** — one npm package, no child process, no binary, no local port (the legacy Go sidecar is not part of the published package; see `legacy/`)
- **CLI-identical disguise** — requests carry the OpenCode CLI user agent and its session/request/project header set, derived per conversation
- **Gateway-compat tracking** — Responses-only models auto-route to `/responses`, and a synced live session keeps the free lane open while Zen only serves known sessions
- **Live catalog with a fallback chain** — live upstream list ∩ free-by-metadata, falling back to offline cache and a verified static list
- **Self-healing** — fast startup retries, periodic refresh, and a written health snapshot for diagnostics
- **Proper error surfaces** — upstream failures (rate limit, auth, timeout, transport) arrive in DSH as classified finish reasons, and retries stay owned by DSH
## Requirements
DSH (DeepSeek Harness) with a web profile; Node.js ≥ 20 (already present if
DSH runs); outbound HTTPS to `opencode.ai` and `models.dev`.
## Install
**From the plugin market** (recommended, once listed): in DSH open
**Settings → Plugin Market**, search `dsh-plugin-adapter`, one-click install.
**From GitHub**:
```sh
dsh plugin --profile web add github:1624318455/dsh-plugin-adapter
```
**From npm**:
```sh
dsh plugin --profile web add @memef1f1y/dsh-plugin-adapter
```
**From source** (build the tarball yourself):
```sh
git clone https://github.com/1624318455/dsh-plugin-adapter.git
cd dsh-plugin-adapter/packages/plugin
pnpm install && pnpm pack
dsh plugin --profile web add ./memef1f1y-dsh-plugin-adapter-.tgz
```
**Verify**: restart `dsh web`, open the model picker, and pick a model from
the **opencode2dsh** group.
## Configuration
Defaults work out of the box. Override via the profile's `cordis.patch.yml`:
```yaml
- id: opencode2dsh
name: '@memef1f1y/dsh-plugin-adapter'
config:
mode: adapter # adapter (default) | sidecar
providerId: opencode2dsh
refreshSeconds: 300 # catalog refresh cadence
```
| Option | Default | Description |
| --- | --- | --- |
| `mode` | `adapter` | `adapter`: native LlmAdapter streaming straight from Zen. `sidecar`: legacy local-agent mode, not bundled — build the agent from `legacy/agent` and pass `agentPath`. |
| `providerId` | `opencode2dsh` | Provider name shown in DSH. |
| `refreshSeconds` | `300` | Live catalog refresh interval. Pricing metadata refreshes every 24 h. |
| `gatewaySession` | — | A live CLI session id sent as `x-opencode-session` (Zen only serves known sessions). Takes precedence over `gatewaySessionFile`. |
| `gatewaySessionFile` | — | File holding the session id, re-read every turn so an external helper can rotate it without a restart. |
| `agentPath` | auto-resolved | Sidecar only: path to the agent binary. |
| `agentArgs` | — | Sidecar only: extra CLI args for the agent. |
| `restartDelayMs` / `restartMaxDelayMs` / `maxConsecutiveCrashes` | `1000` / `60000` / `5` | Sidecar only: restart backoff and circuit breaker. |
## How it works
```
DSH session
│ harness chunks (block-start / text-delta / usage / finish …)
▼
ZenAdapter (registered LlmAdapter)
│ pi-ai openai-completions stream (chat models)
│ pi-ai openai-responses stream (Responses-only models)
▼
https://opencode.ai/zen/v1 ← Authorization: Bearer public
with CLI-identical headers:
user-agent: opencode/… (CLI-identical, runtime values)
x-opencode-client, x-opencode-session, x-session-affinity,
X-Session-Id, x-opencode-request, x-opencode-project
```
- **Session correlation** — by default session/project ids are SHA-256 derived from the
conversation's first user turn (stable per conversation, non-reversible),
and each request gets a fresh random id, mirroring the CLI. When
`gatewaySession`/`gatewaySessionFile` is set, the synced live session id is
sent instead (Zen only serves sessions it has seen from a genuine CLI flow).
- **Catalog fallback chain** — S1: live `GET /v1/models`; S2: models.dev
pricing metadata decides "free"; S3: a compile-time verified static list.
A disk cache (~7-day TTL) covers upstream outages.
- **Resilience** — the adapter registers immediately at startup; if the first
catalog fetch races your network (VPN/TUN reconnects, DNS), the plugin
retries on a short cadence (~1 min) before settling into the periodic
refresh. Responses models get a wider 300 s body-idle watchdog for bursty
reasoning; chat models keep the 120 s default.
- **Sidecar mode** (`mode: sidecar`, legacy) — spawns a local Go agent (a
single-tenant port of [opencode2api](https://github.com/jasonxu114514/opencode2api))
on `127.0.0.1:`, token-authenticated, and registers a standard
`llm-pi-ai` route. **Not part of the published package**; build it from
`legacy/agent` (`go build ./cmd/agent`) and point `agentPath` at the binary.
## Edge cases handled
- **Responses-only models** (`muse-spark-*`): chat returns a bare 500 while
`/responses` returns 200 — auto-routed, no config needed.
- **Unknown sessions**: unknown `x-opencode-session` ids get
`403 FreeTierError` — sync a live CLI session via `gatewaySessionFile`.
(Note: non-streaming probes always 403 — diagnose with `stream:true`.)
## Settings persistence
Adapter config lives in the profile's `cordis.patch.yml` (static per
install). The synced session file is plain text (one line) re-read every
turn. The IP-pool card (settings UI) owns the live routing section; catalog
health persists to `~/.opencode2dsh/adapter-status.json`.
## Health & troubleshooting
The plugin writes a health snapshot after every refresh round:
```
~/.opencode2dsh/adapter-status.json
```
```json
{
"status": "ready",
"total": 64,
"exposed": 9,
"lastError": "",
"writtenAt": "2026-08-29T07:01:54.915Z"
}
```
| Symptom | Likely cause & fix |
| --- | --- |
| Boot screen shows `Failed to load plugins … list slot "settings.plugin.item" requires options.id` | Your DSH is too old (≤ 0.1.0-rc.6): upgrade DSH to ≥ 0.1.0-rc.7 (latest recommended). Model routing is unaffected. |
| Only 3 models | Startup fetch raced your network; retries land within ~1 min. Check `adapter-status.json` for `lastError`. |
| `lastError: "fetch failed"` persisting | Outbound HTTPS to `opencode.ai` blocked; check proxy/VPN rules. |
| Rate-limit errors in chat | The anonymous lane is quota-per-IP; switch network node or wait. |
| `500` on `muse-spark-*` via chat | Responses-only model; routed to `/responses` automatically. |
| `403 FreeTierError: free tier can only be used from within OpenCode` | Zen only serves gateway-known sessions: sync a live CLI session via `gatewaySessionFile` (re-run the sync helper when it recurs). |
| `stream body idle timeout` on reasoning models | Bursty chain-of-thought tripped the watchdog; Responses models use 300 s. If it persists, the exit node may be killing long SSE — switch nodes. |
| Connection error to `127.0.0.1:*` | A stale sidecar route shadows the adapter; plugin ≥ 0.2.1 removes it at startup. |
| Install fails with `ERR_PNPM_IGNORED_BUILDS` | A transitive dependency of `pi-ai` (`@google/genai`, `protobufjs`) has build scripts that are not needed at runtime. Approve-or-decline them via the plugin market, or set both to `false` under `allowBuilds:` in the profile's `pnpm-workspace.yaml`. |
## FAQ
- **Do I need an API key?** No. The anonymous lane's key is the literal
string `public`; quotas are per exit IP.
- **Why did a working model suddenly 403/500?** Zen moves models between
APIs and tightens fingerprinting without notice — update the plugin first,
then check the table above.
- **muse-spark is slow?** It reasons with high effort before answering;
the first tokens can take ~30 s. That is the model, not the plugin.
## Development
```sh
git clone https://github.com/1624318455/dsh-plugin-adapter.git
cd dsh-plugin-adapter/packages/plugin
pnpm install
pnpm typecheck && pnpm test
pnpm build # bundle to lib/
```
The legacy Go sidecar lives in `legacy/agent` (`go test ./...`). Architecture
notes and the porting record live in `docs/`.
Releasing: `pnpm pack` in `packages/plugin` (prepack builds and syncs docs).
Test status: full suite 162 passed; 3 environment-sensitive groups
(watchdog timing, live-subscription, airport fixture) fail without a
built bundle/network/slack and pre-date this fork.
## Known limits
- Free models may train on your data during the free period (Zen policy) —
use privacy models or local runners for sensitive code.
- Responses models need a live synced session; a stale file yields 403
until refreshed.
## Acknowledgments
- [opencode2dsh](https://github.com/FishBottle7/opencode2dsh) by
[FishBottle7](https://github.com/FishBottle7) — the adapter, catalog and
IP-pool design originate there; this project maintains that core with
gateway-compatibility fixes.
- [**opencode2api**](https://github.com/jasonxu114514/opencode2api) by
[@jasonxu114514](https://github.com/jasonxu114514) — the legacy Go sidecar
in `legacy/agent` is a port of its anonymous-lane implementation.
- [OpenCode](https://opencode.ai) — for running the free anonymous Zen lane.
- [@earendil-works/pi-ai](https://www.npmjs.com/package/@earendil-works/pi-ai) — the wire layer used by adapter mode.
- [DeepSeek Harness](https://www.npmjs.com/package/@deepseek-ai/dsh) and the
[dsh-market](https://github.com/dsh-market/dsh-market) community.
## Friends
**[LinuxDo](https://linux.do)** — 新的理想型社区 / a new ideal community
## License
[MIT](./LICENSE) © FishBottle7, © 1624318455
数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。