From e3491e2bb0a3ed4e35e1e23a4d4b513e53b1c040 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 25 Oct 2026 05:40:08 +0800 Subject: [PATCH] docs: point dsh's own DeepSeek row at magpie by hand (#3298) tom047784 (Discord) wants dsh's llm-deepseek row, which keeps DeepSeek's cache across in-history prompt and tool updates and uploads images through the Files API, to go through magpie. magpie doesn't take that row over (the key would mean two things, it would override the user's own entry, and a file_id belongs to one account while magpie fails over), so this documents the entry a user writes themselves: docs/reference.md under "Notes on some agents", and a FAQ entry in site/public/docs start.html (en, zh, ja). Checked against @deepseek-ai/dsh-llm-deepseek 0.2.1-rc.2's source (npm pack into a scratchpad, read only): messagesApiRoot adds /v1 to baseURL unless it ends in /v1; apiKeyEnv is a credential reference read from dsh's credentials and then the environment; an explicit models list replaces DEFAULT_MODELS, whose in-history/addition-only settings are on deepseek-flash only; any Files failure rebuilds the request inline, bounded by maxInlineRequestImageBytes (20 MiB) against maxRequestFilesBytes (128 MiB). Against magpie: internal/agent/dsh.go drops only magpie-marked llm-deepseek entries and removes MAGPIE_GATEWAY_KEY on Disconnect; POST /v1/files answers 404; the catalog ids are deepseek/deepseek-flash and deepseek/deepseek-v4-pro. Tried: real dsh 0.2.1-rc.2, `dsh --profile headless`, sandbox DSH_HOME and HOME, a magpie built from this tree on its own port. Through a fake Anthropic upstream: "say pong" answered; the upstream got output_config.effort, thinking, tools, dsh_session_log and dsh_plugin_packages as sent, the provider's key, and no x-deepseek-harness-* header. A mid-history system message with tool_addition and the mid-conversation-tool-changes anthropic-beta went through unchanged (curl). With a real DeepSeek key copied into the sandbox: dsh read a file with a tool, three calls all 200, cache_read 5760 on a later call; a system message added in the history after two turns was followed and cache_read_input_tokens was 3456. Usage rows had agent dsh, /v1/messages and dsh's session; x-deepseek-harness-compact: 1 recorded kind compact. Not tried: an image turn through dsh (the inline fallback is from the source and the 404), the desktop app and its Models-page key entry, Windows. --- docs/reference.md | 70 ++++++++++++++++++++++++++++++++++ site/public/docs/ja/start.html | 22 +++++++++++ site/public/docs/start.html | 22 +++++++++++ site/public/docs/zh/start.html | 22 +++++++++++ 4 files changed, 136 insertions(+) diff --git a/docs/reference.md b/docs/reference.md index dd151289c..7c8ff54ce 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -191,6 +191,76 @@ The released-client stream/tool contract test is run with '^TestReasonixStudioCLIIntegration$' -count=1`. It uses isolated settings and a local test upstream, with no vendor credentials. +#### DeepSeek Harness: the DeepSeek row by hand + +Connecting dsh gives it magpie's own routes on dsh's pi-ai adapter +(`magpie`, `magpie-responses`, `magpie-anthropic`). dsh's DeepSeek row +(`llm-deepseek`, the `deepseek-official` route) is dsh's: magpie never +points it anywhere, and Disconnect leaves an entry of yours there alone. +That row does more for DeepSeek's own models than pi-ai does: when dsh's +prompt or tools change mid-session it adds the change to the history +(`systemPromptUpdate: in-history`, `toolUpdate: addition-only`), so +DeepSeek keeps its cache of what came before, and it uploads images +through the Files API (#3298). To keep that and still go through magpie +(usage, sessions, the accounts behind `deepseek/…`), point the row at +the gateway yourself, in `~/.dsh/profiles//cordis.patch.yml` +(`desktop` for the app, `web` for `dsh web`, `headless`): + +```yaml +- id: llm-deepseek + config: + baseURL: http://127.0.0.1:3425 + apiKeyEnv: MAGPIE_DS_KEY + models: + - id: deepseek/deepseek-flash + name: DeepSeek V4.1 Flash (magpie) + contextWindow: 1000000 + inputModalities: [text, image] + systemPromptUpdate: in-history + toolUpdate: addition-only + - id: deepseek/deepseek-v4-pro + name: DeepSeek V4 Pro (magpie) + contextWindow: 1000000 +``` + +- `baseURL` is the gateway's root, with no `/anthropic`: llm-deepseek adds + `/v1/messages` itself (`http://127.0.0.1:3425/v1` works too). +- The model ids are magpie's (`magpie models`); dsh sends them as written and + magpie asks DeepSeek for its own name (`deepseek-flash`). A `models` list + replaces llm-deepseek's defaults, which give the in-history updates to its + own `deepseek-flash` entry only, so name them again on yours. +- The key is the gateway's, not DeepSeek's: `magpie` on this computer, the + sharing key from another one. magpie sends DeepSeek your DeepSeek key from + the provider, as for any agent. Keep it under a name of your own + (`MAGPIE_DS_KEY`): `DEEPSEEK_API_KEY` is your DeepSeek key's, and magpie + takes `MAGPIE_GATEWAY_KEY` out on Disconnect. Export it, put it in + `~/.dsh/.env` (the CLI reads that), or enter it on the DeepSeek row in dsh's + Models page (dsh's own key store, the one the desktop app reads). +- Start sessions on the row's model in dsh. Picking a model for dsh in magpie + sets dsh's start on one of magpie's routes again. + +What goes through, tried with dsh 0.2.1-rc.2 (`dsh --profile headless`) and +a DeepSeek API key: llm-deepseek's request reaches DeepSeek's Anthropic +endpoint as dsh wrote it, its effort (`output_config.effort`), a system +message in the history, `tool_addition` blocks, the `anthropic-beta` header +and its `dsh_session_log` and `dsh_plugin_packages` fields included. A system +message added after two turns was followed and the turns before it were read +from DeepSeek's cache. The session (`x-deepseek-harness-session-id`) and a +compaction (`x-deepseek-harness-compact`) are recorded as on magpie's own +routes. Neither header, nor `x-deepseek-harness-user-id`, goes on to DeepSeek. + +What doesn't: +- magpie has no Files API. llm-deepseek's upload to `/v1/files` is answered + 404, and it sends that request's images inline as base64 instead, every + turn, up to `maxInlineRequestImageBytes` (20 MiB by default; past it dsh + takes the oldest images out of the request), where Files would take + 128 MiB (`maxRequestFilesBytes`). Raise it in + your entry for long sessions with many images, as in + `maxInlineRequestImageBytes: 67108864`. +- Keep the row on DeepSeek's own models. magpie passes llm-deepseek's fields + on as they are, `dsh_session_log` (dsh's log of the session) among them, so + another provider's model on this row would be sent them too. + #### VSCodium Chat VSCodium's Chat features are disabled by default. To use the Chat model diff --git a/site/public/docs/ja/start.html b/site/public/docs/ja/start.html index dc90a4793..0abc15e0d 100644 --- a/site/public/docs/ja/start.html +++ b/site/public/docs/ja/start.html @@ -290,6 +290,28 @@ magpie claude group/opus-anywhere # これを使う

Clash / mihomo の設定では、同じ行を rules: の下に、それぞれ先頭に - を付けて書きます。そのあと、エージェントからもう一度リクエストを送ってください。

+

DeepSeek Harness の DeepSeek 行をそのまま使い、magpie を通せますか?

+

手で設定すればできます。dsh を接続すると magpie は自分のルートを足すだけで、dsh の DeepSeek 行(llm-deepseek)は dsh に任せます。この行は、セッションの途中でプロンプトやツールが変わっても DeepSeek のキャッシュを保ちます。magpie を通すには ~/.dsh/profiles/<profile>/cordis.patch.yml に次を足します:

+
+ cordis.patch.yml + +
- id: llm-deepseek
+  config:
+    baseURL: http://127.0.0.1:3425
+    apiKeyEnv: MAGPIE_DS_KEY
+    maxInlineRequestImageBytes: 67108864
+    models:
+      - id: deepseek/deepseek-flash
+        name: DeepSeek V4.1 Flash (magpie)
+        contextWindow: 1000000
+        inputModalities: [text, image]
+        systemPromptUpdate: in-history
+        toolUpdate: addition-only
+      - id: deepseek/deepseek-v4-pro
+        name: DeepSeek V4 Pro (magpie)
+        contextWindow: 1000000
+
+

baseURL に /anthropic は付けません。モデル id は magpie のもの(magpie models)で、models を書くと dsh の既定の一覧が置き換わるので、更新方法の 2 行も残してください。MAGPIE_DS_KEY には DeepSeek のキーではなくゲートウェイのキー(このコンピュータでは magpie)を入れます。export するか、~/.dsh/.env に書くか、dsh のモデルページの DeepSeek 行に入力します。モデルは dsh で選びます。magpie で接続を解除してもこの設定は残ります。magpie には Files API がないため、dsh は画像を毎ターン base64 でインライン送信します。上限は maxInlineRequestImageBytes(既定 20 MiB、上の例では 64 MiB)です。この行では DeepSeek 自身のモデルだけを使ってください。詳しくはリファレンスへ。

困ったときや、共有したい構成があるときは Discord でどうぞ。ユーザーにすぐ使えるプロバイダを配りたいベンダーの方は magpie に追加 をご覧ください。

diff --git a/site/public/docs/start.html b/site/public/docs/start.html index 6c1d1b4ae..5d31995b0 100644 --- a/site/public/docs/start.html +++ b/site/public/docs/start.html @@ -290,6 +290,28 @@ magpie claude group/opus-anywhere # use it IP-CIDR6,::1/128,DIRECT,no-resolve

In a Clash or mihomo config the same lines go under rules:, each starting with - . Then send the agent a new request.

+

Can DeepSeek Harness keep its own DeepSeek row and go through magpie?

+

Yes, by hand. Connecting dsh adds magpie’s routes and leaves dsh’s DeepSeek row (llm-deepseek) to dsh. That row keeps DeepSeek’s cache when dsh’s prompt or tools change mid-session. To send it through magpie, add this to ~/.dsh/profiles/<profile>/cordis.patch.yml:

+
+ cordis.patch.yml + +
- id: llm-deepseek
+  config:
+    baseURL: http://127.0.0.1:3425
+    apiKeyEnv: MAGPIE_DS_KEY
+    maxInlineRequestImageBytes: 67108864
+    models:
+      - id: deepseek/deepseek-flash
+        name: DeepSeek V4.1 Flash (magpie)
+        contextWindow: 1000000
+        inputModalities: [text, image]
+        systemPromptUpdate: in-history
+        toolUpdate: addition-only
+      - id: deepseek/deepseek-v4-pro
+        name: DeepSeek V4 Pro (magpie)
+        contextWindow: 1000000
+
+

baseURL has no /anthropic. The model ids are magpie’s (magpie models), and a models list replaces dsh’s defaults, so keep the two update lines. MAGPIE_DS_KEY holds the gateway key (magpie on this computer), not your DeepSeek key: export it, put it in ~/.dsh/.env, or enter it on the DeepSeek row in dsh’s Models page. Pick the model in dsh; Disconnect leaves the entry alone. magpie has no Files API, so dsh sends images inline as base64 each turn, up to maxInlineRequestImageBytes (20 MiB by default, 64 MiB above). Keep the row on DeepSeek’s own models. More in the reference.

Stuck, or have a setup worth sharing? Ask on Discord. Vendors who want to hand their users a ready-made provider: see Add to magpie.

diff --git a/site/public/docs/zh/start.html b/site/public/docs/zh/start.html index 69e788aef..bb2363fed 100644 --- a/site/public/docs/zh/start.html +++ b/site/public/docs/zh/start.html @@ -290,6 +290,28 @@ magpie claude group/opus-anywhere # 使用它 IP-CIDR6,::1/128,DIRECT,no-resolve

Clash / mihomo 的配置里把这两行写在 rules: 下,每行前面加 - 。改完让 Agent 重新发一次请求即可。

+

DeepSeek Harness 能保留自己的 DeepSeek 行,同时走 magpie 吗?

+

可以,手动配置。连接 dsh 时 magpie 只加自己的路由,dsh 的 DeepSeek 行(llm-deepseek)留给 dsh。这一行在会话中途改提示词或工具时能保住 DeepSeek 的缓存。要让它经过 magpie,在 ~/.dsh/profiles/<profile>/cordis.patch.yml 里加上:

+
+ cordis.patch.yml + +
- id: llm-deepseek
+  config:
+    baseURL: http://127.0.0.1:3425
+    apiKeyEnv: MAGPIE_DS_KEY
+    maxInlineRequestImageBytes: 67108864
+    models:
+      - id: deepseek/deepseek-flash
+        name: DeepSeek V4.1 Flash (magpie)
+        contextWindow: 1000000
+        inputModalities: [text, image]
+        systemPromptUpdate: in-history
+        toolUpdate: addition-only
+      - id: deepseek/deepseek-v4-pro
+        name: DeepSeek V4 Pro (magpie)
+        contextWindow: 1000000
+
+

baseURL 不带 /anthropic。模型 id 用 magpie 的(magpie models);写了 models 就会替换 dsh 的默认列表,所以两行更新方式要保留。MAGPIE_DS_KEY 里放网关密钥(本机是 magpie),不是你的 DeepSeek 密钥:export、写进 ~/.dsh/.env,或在 dsh 模型页的 DeepSeek 行填入都行。模型在 dsh 里选;在 magpie 里断开不会动这一项。magpie 没有 Files API,dsh 会把图片按 base64 每轮内联发送,上限是 maxInlineRequestImageBytes(默认 20 MiB,上面设成 64 MiB)。这一行只用 DeepSeek 自己的模型。详见参考文档。

遇到问题,或者有值得分享的配置?来 Discord 聊。想给自己的用户一键添加供应商的厂商,请看 Add to magpie。