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 # これを使う
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:
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.