rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:wangzhongyang/dsh-endpoint
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Expose the model providers and models already configured in DeepSeek Harness as an OpenAI-compatible HTTP endpoint.
The endpoint only forwards. It holds no provider credentials and never talks to a
provider directly: every model call goes through ctx.llm.stream(), so DSH's provider
adapters (credentials, protocol differences, retries, image handling, token usage) keep
owning the real request.
OpenAI-compatible client
│ POST /v1/chat/completions
▼
┌────────────────────── DSH host process ───────────────────────┐
│ dsh-endpoint (Cordis plugin) │
│ HTTP listener → OpenAI mapping → SessionMirror → ctx.llm │
│ │ │
│ dsh-llm-pi-ai / dsh-llm-deepseek-* │
└──────────────────────────────────────────┼─────────────────────┘
▼
provider API
already owned by an active write handle).Requires DeepSeek Harness Desktop (web profile) 0.2.1-rc.x.
From npm:
dsh plugin --profile web add dsh-endpoint
From a checkout (useful while developing):
dsh plugin --profile web add /absolute/path/to/dsh-endpoint
In the Desktop app you can also use Settings → Plugins and install it from the market once the package is listed.
No authentication, no rate limiting. The endpoint spends your configured model quota for anyone who can reach it. Keep it on
127.0.0.1unless you put it behind a proxy you control, and disable the plugin to switch it off.
Restart the app after installing: host plugins are ESM modules, and reinstalling does not replace the module already loaded in the running process.
Settings → Model Endpoint (a custom section, same level as plugin pages).

| Field | Meaning |
|---|---|
| Listen address | 127.0.0.1 (local only) or 0.0.0.0 (all interfaces) |
| Port | default 43130; the GUI owns 43129 |
| Default model | used when a request omits model |
| Model aliases | JSON map, e.g. {"gpt-4o": "opencode-go/deepseek-v4.1-flash"} |
| Session mirror | write each API conversation into a DSH session |
| Mapping retention | days an external conversation id keeps its session after last use |
| Workspace directory | workspace that groups mirrored sessions |
Saving applies immediately: changing the listen address or port rebinds the listener
in place (the old listener closes, the new one binds, and a failed bind rolls back to
the previous address). Switching 127.0.0.1 ↔ 0.0.0.0 takes the same path. Toggling the
mirror or changing the workspace directory still needs a plugin reload, because those are
built at startup.
In-flight streaming responses are dropped when the listener moves.
The page reads and writes two loopback-only routes: GET /dsh-endpoint/state and
GET|PUT /dsh-endpoint/config. Saves go to the user layer
$DSH_HOME/dsh-endpoint/config.json, which is merged over the plugin config at startup.
| Method | Path | Notes |
|---|---|---|
GET |
/healthz |
liveness + registered providers |
GET |
/v1/models |
provider/model ids plus aliases |
GET |
/v1/models/{id} |
one model |
POST |
/v1/chat/completions |
streaming and non-streaming |
Model ids are provider/model, e.g. opencode-go/deepseek-v4.1-flash.
Supported: messages (system/user/assistant/tool), tools and tool_calls
pass-through, temperature, max_tokens / max_completion_tokens, stream,
stream_options.include_usage, stop (truncated endpoint-side because not every
adapter accepts it).
Rejected explicitly: n > 1, tool_choice other than "auto", remote (http(s)) media
URLs, file_id references, and binary documents (PDF/DOCX).
Inline base64 only — the endpoint never fetches remote URLs on a client's behalf.
| Input | Handling |
|---|---|
image_url with data:image/{png,jpeg,webp,gif};base64,… |
decoded → ctx.attachments.saveImages → ImageBlock; the adapter resizes per route |
image_url with http(s)://… |
400: send a data URL instead |
file part with file_data of text/*, JSON, YAML, XML, JS, SQL |
inlined as a text block (512 KiB cap, filename preserved) |
file part with a binary document (PDF, DOCX, …) |
400: text extraction is not implemented |
file part with file_id |
400: the Files API is not implemented |
Attachments live in DSH's attachment store, so the mirrored session keeps a compact reference instead of megabytes of base64.
| Limit | Value | Source |
|---|---|---|
| Request body | 20 MiB, max 300 MiB | limits.maxBodyBytes, a plugin default. DSH's own /api limit is 300 MiB (314572800); higher values are rejected |
| One inline text file | 8 MiB, never above the body cap | limits.maxTextFileBytes, a plugin default. DSH sets no file-size limit |
| One image | 20 MiB | DSH attachment service (not this plugin) |
| Images per message | 20 | DSH attachment service |
| Total image bytes per message | 200 MiB | DSH attachment service |
| Image pixels / longest side | 64 MP / 8192 px | DSH attachment service |
The text-file cap is a prompt-size guard, not a protocol limit: the body is already
bounded by maxBodyBytes, and a file near the cap is far past most models' context
windows. Truncation is announced in the inlined text, so the model knows it is partial.
Ignored on purpose: every other unknown field (top_p, seed, service_tier,
metadata, …). Real clients send fields this build does not model; rejecting them would
break more than it protects, so they are logged and dropped rather than silently applied.
Resolution order, first hit wins:
x-dsh-session-id (this plugin's own header)x-session-id, x-conversation-id, x-chat-id, x-thread-id,
x-agent-session-id, x-claude-code-session-id, x-codex-session-idsession_id, conversation_id, chat_id, thread_id,
metadata.session_id, metadata.conversation_id, usersha256(model + first user message) — deterministic across
requests and restartsx-request-id, x-correlation-id and x-trace-id are never treated as session ids.
Every response echoes back the key the request used — the client's own header/body
value, or the derived/minted key when the client sent none — so a client can store it and
replay it on the next call. The internal mirror id is exposed separately as
x-dsh-mirror-session for debugging; never send that one back.
Keys that cannot be written into a header (non-ASCII body values) are echoed in the
endpoint's own ep-<32 hex> reference form, which resolves to the same conversation.
Only new user/tool messages are appended to the mirrored session (assistant messages are always the ones this endpoint produced), so logs grow per turn instead of quadratically. If the client's user history diverges from what was recorded, a new DSH session is started and the divergence is logged.
Any client that can point an OpenAI-compatible provider at a custom base URL:
export OPENAI_BASE_URL=http://127.0.0.1:43130/v1
export OPENAI_API_KEY=anything # there is no auth; any placeholder works
| Client | How to configure | Status |
|---|---|---|
curl / any HTTP client |
POST the body directly | verified |
| OpenAI Python SDK | OpenAI(base_url="http://127.0.0.1:43130/v1", api_key="any") |
request shape verified |
| OpenAI Node SDK | new OpenAI({ baseURL: "http://127.0.0.1:43130/v1", apiKey: "any" }) |
request shape verified |
| Cline (VS Code) | Provider: OpenAI Compatible → Base URL + any key | expected; not yet end-to-end tested |
| Roo Code (VS Code) | Provider: OpenAI Compatible | expected; not yet end-to-end tested |
| Continue (VS Code / JetBrains) | provider: openai, apiBase: http://127.0.0.1:43130/v1 |
expected; not yet end-to-end tested |
| OpenCode (CLI) | custom provider in opencode.json, see below |
verified, tool loop included |
| Cherry Studio | Add provider → OpenAI → API Host | expected |
| Chatbox | Model provider → OpenAI API → API Host | expected |
| LobeChat | OpenAI provider → proxy/base URL | expected |
| Open WebUI | Connections → OpenAI → Base URL | expected |
Model ids contain a slash, which breaks provider/model parsing on the client, so add a
slash-free alias first (Settings → Model Endpoint → Model aliases), e.g.
{"flash": "opencode-go/deepseek-v4.1-flash"}. Then point a project opencode.json at the
endpoint:
{
"provider": {
"dsh": {
"name": "DSH Endpoint",
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "http://127.0.0.1:43130/v1", "apiKey": "anything" },
"models": { "flash": { "name": "DeepSeek via DSH" } }
}
}
}
opencode run -m dsh/flash "list the files here and tell me which is largest"
A ready-to-copy file lives at examples/opencode.json.
OpenCode sends x-session-id, which the endpoint already treats as the conversation key,
so a whole multi-step tool loop lands in one mirrored session.
Tool calls are forwarded both ways (tools in, tool_calls out); OpenCode's shell/read
tool loop has been verified end to end.
127.0.0.1; binding 0.0.0.0 lets anyone who can reach the port spend your quota.n > 1, tool_choice other than auto, logprobs, top_p, seed are not applied.0.2.1-rc.x); API changes there can break this plugin.pnpm install
node --test # 47 cases, no DSH required
node spike/mock-provider.mjs 44001 # local fake provider
spike/ also contains the P0 harness that creates a session in a throwaway DSH_HOME,
persists it, restores it, and checks that GUI takeover is refused (spike/run.sh).
Verified on a real Desktop install:
/v1/models (31 models across opencode-go, deepseek-official, deepseek-account)x-dsh-session-idturn/start → step/start → user → assistant → step/end → turn/end, second turn appends only the new user messageagentLoop.resume refused while the write handle is held43130 → 43131 → 43130) without restarting the appNot verified yet:
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: llm-gateway、deepseek-harness、openai-compatible。