rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
bradleyFrancis/dsh-llm-third-party-native
Route OpenRouter, LiteLLM, and self-hosted Anthropic-compatible endpoints through DeepSeek's native adapter. Comes with thinking budgets, clean reasoning replay, sticky caching, and local SearXNG search - without touching your official DeepSeek route.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:bradleyFrancis/dsh-llm-third-party-native
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Registers a dedicated, first-class provider (dsh-llm-third-party-native) running alongside the official route (deepseek-official), allowing you to use DeepSeek's native adapter (DeepSeekAdapter) for custom Anthropic-compatible Messages endpoints (OpenRouter, LiteLLM, vLLM, self-hosted gateways) instead of routing them through the generic Pi adapter (llm-pi-ai).
Includes wire-compatibility fixes for third-party Messages gateways, an editable deployment persona suffix, and a batteries-included local SearXNG provider on ctx.web.
Because it registers as its own distinct provider, your official DeepSeek configuration (api.deepseek.com and DEEPSEEK_API_KEY) remains completely intact and unmutated.
llm-pi-ai?Both llm-deepseek and llm-pi-ai support Anthropic Messages endpoints, budget_tokens, and session affinity headers (x-session-id / x-session-affinity). The real differences lie in prompt structure, replay handling, and harness integration, which directly affect model behavior on DeepSeek models:
| Capability | Pi Adapter (llm-pi-ai) on Custom Routes |
Native Adapter with dsh-llm-third-party-native |
|---|---|---|
| System & Tool Updates | Hand-declared routes lack catalog compat flags, so mid-conversation system updates become user-role reminders and the full tool list is resent at the start. |
Natively formats developer updates as in-history system turns with incremental tool_addition / tool_removal deltas. |
| Unsigned Thinking Replay | Converts unsigned thinking blocks into visible assistant text blocks, leaking raw internal reasoning into conversation history. |
Drops unsigned thinking blocks so prior turns remain clean without triggering schema rejections. |
| Stop Sequences | GenerateOptions.stop is unsupported. |
Natively maps options.stop to stop_sequences. |
| Image Handling | Accepts images only in user and tool-result messages; no DeepSeek image token math. |
DeepSeek-native image pixel budgeting, resizing targets (imageRequestTarget), and attachment resolution. |
| Error Classification | Relies on regex matching over raw error text (stream.ts) where the underlying SDK hides HTTP status codes. |
Direct fetch transport with exact HTTP status mapping and typed LlmError codes. |
DeepSeekAdapter serializes requests for api.deepseek.com/anthropic (sending thinking.type: "enabled" with output_config.effort, without budget_tokens). Third-party gateways enforce stricter Anthropic schema rules and stateless load balancing. This plugin intercepts the serialized body inside its own adapter's prepareExtensions hook:
Thinking Budgets (thinking.budget_tokens)
budget_tokens whenever thinking.type === "enabled".budget_tokens from output_config.effort on a monotonic ladder:low: 4,096 tokensmedium: 8,192 tokens (default)high: 16,384 tokensxhigh / max: 32,768 tokensReasoning Replay Sanitization
thinking blocks without a native signature (e.g., from imported or cross-provider history) are rejected by strict Messages gateways.thinking blocks before serialization so history degrades cleanly instead of failing the request.Sticky Session Routing (session_id)
session_id to the request body for upstream session affinity.[!NOTE] Wire fixes are scoped strictly to
dsh-llm-third-party-native. Requests sent throughdeepseek-officialare never modified.
Open Settings → Models and expand the Third-party DeepSeek Settings card:
/messages), e.g. https://openrouter.ai/api/v1 or http://localhost:4000/v1.DSH_LLM_THIRD_PARTY_NATIVE_API_KEY).Set a deployment-wide prompt suffix that applies across all agent presets (DEPLOYMENT_PERSONA_SUFFIX). Empty registers nothing.
ctx.web via SearXNG)Independent of the LLM adapter, this bundle registers a ctx.web search provider backed by a local SearXNG container (search/docker-compose.yml) so agents have zero-API-key web search out of the box:
127.0.0.1); SearXNG itself makes outbound queries to upstream search engines.restart: "no", starting lazily on the first search.docker compose spawns during parallel tool calls.searchURL (default http://127.0.0.1:8080, port bound dynamically), searchAutoStart (default true), searchTimeoutMs (default 15000).Requires DeepSeek Harness >=0.2.2-rc.3, Node.js >=20, and Docker (for local SearXNG search). Zero build step required: authored in plain Node.js ESM and browser-native ModuleLoader.
# Validate syntax and compose configuration
node --check index.js && node --check client.js
docker compose -f search/docker-compose.yml config
# Package distribution tarball (.tgz)
npm pack
# Install via DSH CLI (or GUI: Plugins → Add Plugin → Local Directory)
dsh plugin add /path/to/dsh-llm-third-party-native
Or append to your profile's $DSH_HOME/profiles/<name>/cordis.patch.yml:
- insert:
- id: dsh-llm-third-party-native
name: dsh-llm-third-party-native CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。