dsh-model-endpoint: Expose the Current Harness Model as an OpenAI-Compatible HTTP Endpoint

Preface

DeepSeek Harness (DSH) already integrates provider credentials and routing within its chat and “Model” settings, but the Harness itself does not expose an inbound HTTP API externally. If you want to use the openai SDK, LangChain, Cline, shell scripts, or another Harness instance to call “the model currently in use by this profile,” the common approach is to set up another gateway or maintain duplicate keys. The dsh-model-endpoint introduced below is maintained by community maintainer Xxsttb, categorized under model inference; it starts a separate listener on the local machine (or your specified bind address) and exposes the current profile’s model as an OpenAI-compatible endpoint. Clients typically only need to change base_url.

What Is This

dsh-model-endpoint is a DSH plugin (npm package name dsh-model-endpoint, current version 1.0.0, MIT license). It publishes the model currently being used by a DeepSeek Harness profile as an OpenAI-compatible HTTP endpoint; the listener is created independently by the plugin and does not occupy Harness’s web server. Any OpenAI-compatible client pointing to the base URL printed by the plugin can get responses, generally without needing a second set of model credentials—no additional client-side configuration beyond the base URL is required (if you enable API key, Bearer authentication is needed).

Core Features

HTTP Endpoint (Independent Listener)

The default example port is 8787 (can be modified in settings). The main routes are as follows:

Method / Path Purpose
GET /v1/models List models routable by this profile (including provider/model and bare id)
GET /v1/models/<id> Single model object, otherwise 404 model_not_found
POST /v1/chat/completions Chat completions, supporting streaming (SSE) and non-streaming
GET /health, GET / Binding status, reachability, auth mode, current model

The bind address is up to you: 127.0.0.1 is local-only, 0.0.0.0 is for the local network; the same port can be accessed from the public internet via router or NAT forwarding, request paths are independent of the above three topologies.

Model Resolution Order

The endpoint selects the actual model to serve according to priority:

  1. model in the request body (must be routable; accepts provider/model or bare id)
  2. Current selection in the profile (consistent with the chat selector and “Model” settings page; switching models in chat changes the endpoint accordingly)
  3. Fallback provider and model in the plugin settings page
  4. Used as a last resort regardless of whether followSelection is disabled, to avoid directly returning 503 when no model can be routed

If resolution still fails, 503 model_unavailable is returned, with the response body listing each failed candidate and reason. Clients can use model: "auto", "default", or omit the field, indicating use of the current profile selection.

Streaming, Reasoning Effort, and Tools

  • Streaming: When "stream": true, returns via SSE; text in delta.content, reasoning in delta.reasoning_content; tool calls as indexed delta.tool_calls; keep-alive comments during thinking; usage provided in the last chunk along with finish_reason.
  • Reasoning effort: Only effective when the served model declares reasoning_effort, otherwise uses the model default; the settings page provides a default value for requests omitting this field.
  • Caller-supplied tools: tools in the request are forwarded to the model; the endpoint does not execute these tools, results are returned to the caller with finish_reason: "tool_calls".
  • Lending tools (disabled by default): Can lend tools registered in this Harness and individually enabled in settings to the model, executed by the endpoint via the Harness tool runtime and filled back, completing round-trip within a single request, capped at Max tool rounds (default 8), exceeding returns 409 tool_round_limit.

Additionally, several routes are mounted on the Harness web server (not the independent listener) for the settings page to read status, model catalog, reasoning effort, and tool switches, e.g., GET /plugins/model-endpoint.

Settings Page and Security

After installation, configure under Settings → Model endpoint. Fields include: whether to run the endpoint, bind address, port, API key, whether to follow current model, fallback model, reasoning effort, extra system prompt, default max_tokens, request timeout, CORS allowed browser origins, whether to lend tools and per-tool switches, etc. After modification, the listener rebinds; the status block shows the actual bound port and local reachable address.

Security notes (from README original): When bound only to 127.0.0.1, API key can be left blank; when bound outside the local machine without a key, anyone who can connect to that port may consume this profile’s model quota. The endpoint itself has no TLS; public exposure should terminate TLS at a reverse proxy or use tunnels.

Installation and Activation

The README requires using dsh plugin add to install; do not manually modify the profile manifest; also do not first link: then switch to tarball (on Windows this may clear the source directory pointed to by the link).

Install from a checked-out directory or packaged tarball:

dsh plugin --profile desktop add /absolute/path/to/dsh-model-endpoint
# or
pnpm pack --pack-destination dist
dsh plugin --profile desktop add /absolute/path/to/dist/dsh-model-endpoint-1.0.0.tgz

The plugin will self-mount, start the listener, and add a Model endpoint page under “Settings”.

Verification:

curl http://127.0.0.1:8787/health
curl http://127.0.0.1:8787/v1/models

Uninstallation:

dsh plugin --profile desktop remove dsh-model-endpoint

Typical Usage

OpenAI Python SDK

When authentication is disabled, api_key can be any non-empty string (e.g., "unused"):

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="unused")
client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "hello"}],
)

curl (Including Streaming)

curl http://127.0.0.1:8787/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{"model":"auto","messages":[{"role":"user","content":"hello"}],"stream":true}'

Local Network or Public Internet

  1. Set Bind address to 0.0.0.0 and set API key.
  2. Read the Local network URL from the status block on the settings page.
  3. For public access, forward the port on your router to the local machine; clients can use the public address; the endpoint does not need to be aware of the forwarding.

Use Cases and Caveats

For whom: Those who have already configured model routing in DSH and want to use existing OpenAI ecosystem tools or remote machines to call the same profile’s model; local or LAN gateway scenarios requiring SSE streaming, optional Bearer authentication, and CORS.

Runtime permissions: The plugin has the same privileges as the current DSH process; if “Lending tools” is enabled, the model may trigger locally registered tools (including reading/writing files, executing code, accessing the network, etc.). Only enable switches you are willing to execute for potential unauthenticated callers, and always use API key when bound outside the local machine.

Before installation: The community directory SkillHub has no official affiliation with DeepSeek / Quantilla; before installation, you should independently review the GitHub repository source code and MIT license. The README contains a disclaimer: features have been verified by the author against running profiles and test benches, but compatibility with subsequent Harness versions is not guaranteed.

Error responses follow the OpenAI envelope format; common status codes include 401 invalid_api_key, 404 model_not_found, 409 tool_round_limit, 503 model_unavailable, etc. Upstream failures retain Harness-side classifications (such as rate limits, quota, context length exceeded).

Summary

Through the steps above, you can turn the model selected in DSH into a standard OpenAI-compatible HTTP service without needing to configure provider keys repeatedly for each client. For more details, see the Chinese README in the repository; for the plugin entry, see SkillHub directory page, and for the source code, see GitHub — Xxsttb/dsh-model-endpoint.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye