Introduction¶
DeepSeek Harness (DSH) follows a design philosophy of “Everything is a plugin.” In practical development, we often need to invoke large language models within local tools (such as VS Code extensions, scripts, or local LLM clients). The standard practice involves copying DeepSeek official or third-party API keys into various tools. This is not only tedious but also introduces the risk of key fragmentation and leakage.
dsh-model-bridge solves this issue. As a DSH plugin, it encapsulates all configured models within the DSH process into a local OpenAI / Anthropic compatible gateway. Other development tools need only point to this local address to use models within DSH directly, without requiring a separate API key entry.
Plugin Overview¶
- Name:
dsh-model-bridge - Function: Exposes all models accessible to DSH as a local OpenAI / Anthropic compatible gateway for use by other development software.
- Maintainer: 438417623wq
- License: MIT
Core Capabilities¶
- Dual Protocol Gateway: Provides an OpenAI-compatible interface (
/v1) and an Anthropic-compatible interface, unified on port 8791. - In-Process Invocation: Directly calls
ctx.llm.stream()without the need for credential handling. Credentials are managed by adapters within DSH; the plugin does not store them. - Zero Configuration: No adapter registration and no configurable provider declarations, avoiding routing conflicts with existing providers.
- Model Support: Supports models like
workbuddy/deepseek-v4.1-flashand supports full tool-calling capabilities. - Security: The key is a local file bound strictly to
127.0.0.1to prevent access from outside the local machine.
Installation & Configuration¶
This plugin is a standard DSH bundle. To install, write its path into the profile’s dependency list and restart DSH.
1. Modify package.json¶
Add the dependency and bundle to the DSH profile configuration file:
// ~/.dsh/profiles/<profile>/package.json
{
"dependencies": {
"dsh-model-bridge": "file:F:/KF/dsh api/dsh-model-bridge"
},
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"dsh-model-bridge"
]
}
}
}
2. Verify Mounting¶
After installation, run the verification script to confirm the plugin is mounted:
node "F:\KF\dsh api\dsh-model-bridge\tools\verify-mount.mjs"
3. Start the Gateway¶
After restarting DSH, the gateway will automatically start and listen on http://127.0.0.1:8791.
Usage Examples¶
Other development software only needs to configure the Base URL and API Key to invoke models within DSH.
Connection Info¶
- OpenAI Compatible Base URL:
http://127.0.0.1:8791/v1 - Anthropic Base URL:
http://127.0.0.1:8791 - API Key: Read from
~/.dsh/model-bridge/key(viewable in the DSH settings page)
Model Name¶
Enter the qualified name, e.g., workbuddy/deepseek-v4.1-flash. The full list of available models can be retrieved via http://127.0.0.1:8791/v1/models.
Client Examples¶
PowerShell (Anthropic Client)
$env:ANTHROPIC_BASE_URL = "http://127.0.0.1:8791"
$env:ANTHROPIC_API_KEY = "<你的 key>"
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8791/v1",
api_key="<你的 key>",
)
reply = client.chat.completions.create(
model="workbuddy/deepseek-v4.1-flash",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "你好"},
],
)
print(reply.choices[0].message.content)
Node.js
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://127.0.0.1:8791/v1",
apiKey: "<你的 key>",
});
const reply = await client.chat.completions.create({
model: "workbuddy/deepseek-v4.1-flash",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "你好" },
],
});
console.log(reply.choices[0].message.content);
curl
curl.exe -H "Authorization: Bearer <你的 key>" http://127.0.0.1:8791/v1/models
Notes¶
- Runtime Dependency: The gateway is only available when DSH is running. Once DSH is closed, port 8791 stops serving. It is not suitable for scenarios requiring 24/7 continuous uptime.
- Key Permissions: The key exists as a local file and theoretically any program on the local machine can read it. However, the gateway enforces binding to
127.0.0.1and validates Host/Origin, preventing access from the LAN or public network. - Message Format Requirements: When using models such as
workbuddy/deepseek-v4.1-flash, the first message must besystem. This is required by upstream security policies; otherwise, a 502 error will be returned. - Token Consumption: These models consume reasoning tokens. It is recommended to set
max_tokensto at least 512; otherwise, the output content may be occupied by the reasoning process. - Model Selection: Models unchecked in the DSH settings page will not appear in
/v1/modelsand cannot be invoked.