dsh-local-model: Enabling Direct Connection of DeepSeek Harness to Local Inference Service

Preface

DeepSeek Harness (DSH) completes conversations and Agent tool calls via cloud APIs by default. If you have already deployed inference backends such as Ollama, LM Studio, llama.cpp server, or vLLM on your local machine, continuing to use the cloud will consume account tokens and contradicts the requirement for “data not leaving the local machine.” The community plugin dsh-local-model (maintained by songzhiyin) registers a provider route local within Harness to forward model requests to local endpoints. It does not access api.deepseek.com nor read account credentials. The following section describes its capabilities, installation methods, and typical usage.

What is this

dsh-local-model is a DSH plugin categorized under “Model Inference.” The npm package name is dsh-local-model, the current version is 1.0.0, the license is MIT, and it requires Node >= 20 and DSH ^0.2.0-rc.2. It registers a custom LLM adapter in Harness, compatible with the OpenAI protocol (e.g., Ollama /v1, LM Studio, llama.cpp, vLLM / SGLang, etc.) and the Ollama native API. It also includes a “Local Model” card in the “Settings → Model” page for testing connections and viewing the list of local models.

Core Features

Routing and Protocols

The plugin registers an adapter via ctx.llm.registerAdapter(["local"], adapter), converting Harness’s GenerateOptions into target protocol requests, and then mapping streaming responses to StreamChunk (including text, reasoning, tool call blocks). It supports two transport methods:

Mode api Value Typical baseURL
OpenAI Compatible openai e.g., http://127.0.0.1:11434/v1 (Ollama), http://localhost:1234/v1 (LM Studio)
Ollama Native ollama http://127.0.0.1:11434

The README suggests: prioritize openai if the backend already has an OpenAI-compatible endpoint; use ollama if native Ollama thinking / reasoning is required.

Tool Calling and Fallback

The adapter converts Harness tool calls and tool result history, allowing Agent tools like bash, file operations, and sub-agents to function normally. Some local models may write tool calls as plain text JSON; the plugin has a built-in fallback that recognizes {...} JSON, <tool_call>...</tool_call>, and JSON within markdown code blocks, converting them into real tool calls when the tool name matches. When running Agents, the README recommends selecting models that natively support function calling (e.g., qwen3-coder, llama3.1, devstral).

Model Discovery and Config Hot-reload

It can automatically fetch the model list from local endpoints (Ollama /api/tags, OpenAI /v1/models). Configuration fields are volatile, meaning changes take effect without restarting Harness. If the endpoint does not support list queries, models can be declared statically in the models array.

Visual Configuration

The client registers the Local Model card to the settings.models.provider-card extension slot in “Settings → Model”: it allows switching between openai / ollama, filling in endpoints, executing “Test Connection,” and displaying discovered models; complete configuration items are completed in the plugin configuration form or the same settings page.

Connectivity Details

“Test Connection” prioritizes detection via the host process ctx.remote.llm.discoverModels() to avoid issues such as browser CORS and failures caused by localhost resolving to IPv6. Default endpoints use 127.0.0.1 instead of localhost, and automatic fallback retries are performed for loopback addresses.

Installation and Activation

Command line installation (Recommended by README, where web is the profile name; common desktop versions use desktop):

dsh plugin --profile web add dsh-local-model

You can also search for dsh-local-model in Harness Settings → Plugin Marketplace (or Plugins page) for one-click installation; usually, refreshing the page is sufficient to activate it.

Install from GitHub (Command from original source):

dsh plugin --profile web add github:<songzhiyin>/dsh-local-model

After installation, fill in the endpoint and protocol in Plugins Page → dsh-local-model → Configuration or Settings → Model → Local Model.

Typical Usage (Ollama)

First, start the inference service on your local machine and pull the model (the example uses a model with tool capabilities):

ollama serve
ollama pull qwen2.5-coder:14b

Install the plugin:

dsh plugin --profile web add dsh-local-model

In Harness:

  1. Open Settings → Model, find Local Model, and confirm the endpoint (Default for OpenAI mode is http://127.0.0.1:11434/v1);
  2. Switch the provider to Local Model in the session’s model selector and select a model;
  3. Start the conversation; inference is completed entirely on the local machine.

If long conversations are truncated, pay attention to the context limit of the local service (e.g., Ollama can be adjusted via environment variables like OLLAMA_CONTEXT_LENGTH=32768 ollama serve; see README FAQ for details).

Main Configuration Items

These can be adjusted in the plugin configuration or Local Model settings (Excerpt, default values subject to README):

Field Type Default Description
api "openai" \| "ollama" "openai" Transport protocol
baseURL string http://127.0.0.1:11434/v1 Local endpoint root address
apiKey string "" Fill in if the local service requires authentication
defaultModel string "" Fallback name when unable to enumerate models
contextWindow integer 8192 Default context window
maxTokens integer 2048 Default max output tokens per request
temperature number 0.7 Sampling temperature
streamIdleTimeoutMs number 300000 Streaming idle timeout (ms)
models array [] Static model list

Example of models:

[
  { "id": "qwen2.5-coder:14b", "name": "Qwen2.5-Coder 14B", "contextWindow": 32768, "maxTokens": 4096 }
]

Use Cases and Notes

Who it is for: Developers who have already deployed OpenAI-compatible or Ollama inference services on their local machine or intranet, and wish to use DSH’s Agent and tool capabilities without logging into a DeepSeek account or consuming cloud tokens.

Notes before use:

  • The plugin runs under the current DSH process permissions. Before installation, please read the source code and MIT license of the GitHub repository to ensure the behavior complies with your security policy.
  • Community plugin directories (such as skillhub.cn) are independent ecosystem sites and have no official affiliation with DeepSeek / High-Flyer; installation sources should be based on npm, the plugin marketplace, or GitHub addresses you trust.
  • Tool call stability depends on the selected local model; plain text JSON tool output relies on the plugin fallback. If it remains unstable, you should switch models.

Conclusion

dsh-local-model connects Harness’s local provider to local OpenAI-compatible endpoints or the Ollama native API. Combined with model discovery, tool history conversion, and settings page connectivity testing, it is suitable for a local-first Agent development workflow. For further information, please visit the Plugin Directory Page and the GitHub README.

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

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

Xiaoye