Ollama provider for DeepSeek Harness with model management, health checks, rule-based local routing, and cloud fallback.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-local-ai
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:PerryLink/dsh-local-ai
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
npm package: dsh-local-ai@0.2.28 (released 2026-11-18).
dsh-local-ai
Current version 0.2.31.
Hook Ollama into DeepSeek Harness so local models become a routable first-class provider — requests go local by rule and fall back to the cloud when they fail.
A headless, pure-host plugin: discover, pull, remove, and inspect local models, route by task type or keyword, and get a one-shot status overview from /ollama — all in one bundle.
Last verified on DeepSeek Harness dsh-v0.2.3-alpha.1 (2026-11-22).
Install · Configuration · FAQ · 简体中文 · English · Español · Português · हिन्दी
dsh plugin --profile <name> add dsh-local-ai
Community plugin, not affiliated with DeepSeek. Canonical repository: https://github.com/PerryLink/dsh-local-ai (Gitee is a mirror).
What it is
, dsh-local-ai makes Ollama a first-class local provider inside DeepSeek Harness: it registers the ollama provider route, routes requests to local models by task type or keyword, and falls back to the cloud automatically when a local route fails before producing content. Five tools cover model discovery, pulling, removal, inspection, and health; /ollama gives a one-screen status overview. Everything talks to Ollama's HTTP API (the CLI is used only for the process probe); no model files are bundled and no new model-visible input is invented.
Three-step setup
Install (pick one channel):
# git channel (latest main; equivalent to git+https://github.com/PerryLink/dsh-local-ai.git) dsh plugin --profile web add github:PerryLink/dsh-local-ai # npm channel (published releases) dsh plugin --profile web add dsh-local-ai # tarball channel: pnpm pack in this repo, then dsh plugin --profile web add ./dsh-local-ai-<version>.tgzThe
preparescript builds with production dependencies only. If pnpm reportsERR_PNPM_IGNORED_BUILDSfor this package, addallowBuilds: { esbuild: true }to yourpnpm-workspace.yaml— thedshCLI prints the exact snippet.Minimal routing config (
routeships commented out incordis.patch.yml; make sure Ollama is running athttp://127.0.0.1:11434first):- insert: - id: dsh-local-ai name: dsh-local-ai config: route: - model: llama3.2 keywords: ["confidential", "offline"]Verify it mounts:
dsh --profile web --dump-config | grep -A2 'id: dsh-local-ai'> /ollama
Uninstall: dsh plugin --profile web remove dsh-local-ai (or remove the row from the profile patch).
Every PerryLink plugin is listed in the built-in DSH Desktop market: Market → Sources → Add source → paste https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → select. Installation still requires the market's npm identity check and your confirmation.
Core capabilities
dsh-v0.2.2-rc.4(2026-11-18);dsh-local-ai makes Ollama a first-class local provider in DeepSeek Harness:
- Discovery & management —
ollama_list(installed models, running models, disk usage),ollama_show(parameter size, quantization, context length),ollama_pull, andollama_remove. - Health check — process liveness (via the
ollamaCLI) and API responsiveness (via/api/version), reported as two independent signals. - Official adapter — the
ollamaprovider route is registered throughctx.llm.registerAdapter(LlmAdapter), with configurable model mapping and temperature / max-tokens / stop translation. - OpenAI-compatible backends — LM Studio, vLLM, and llama.cpp
--servereach register as their ownopenai:<name>provider through the sameLlmAdapterseam, reusing one OpenAI/v1/chat/completionsadapter (text-only route). - Local routing —
model_routerules route requests to a local model by task type (purpose), case-insensitive keyword, oralways, with automatic fallback to the cloud when the local route fails before producing content. /ollamacommand — a one-shot status overview: models, disk usage, health, and suggestions.- Zero dependencies, HTTP first — everything talks to Ollama's HTTP API (the CLI is used only for the process probe); no model files are bundled.
request (loop)
│ llm/stream waterfall
├─ rule matches? ──▶ route to ollama ──▶ Ollama /api/chat (NDJSON stream)
│ └─▶ route to openai:<name> ─▶ /v1/chat/completions (SSE)
│ └─ fails first ─▶ fall back to cloud (next())
└─ no match ──▶ cloud provider
tools ──▶ /api/tags · /api/ps · /api/show · /api/pull · /api/delete
health ──▶ /api/version (API) + ollama list (process)
Commands & tools surface
| Surface | Kind | What it does |
|---|---|---|
ollama_list |
tool | List installed models, running models, and disk usage |
ollama_show |
tool | Show parameter size, quantization, context length, family, format |
ollama_pull |
tool | Pull (download) a model |
ollama_remove |
tool | Remove a model |
ollama_health |
tool | Process liveness + API responsiveness |
/ollama |
command | One-shot status overview (models + health + suggestions) |
Consumes the public host services ctx.llm (registerAdapter), ctx.tools, ctx.subprocess (CLI probe), and ctx.commands. It registers no llm/stream short-circuit by default — the routing listener passes through (next()) unless a rule matches.
Examples

Animated replay of a real run recorded in this repository.
These are the plugin's real entry points; install once, then call one.
Detailed example — tool ollama_list, input:
{}
Output:
1 local model(s), 100 B on disk
- llama3.2 (3B) — 100 B
Observed from plugins/dsh-local-ai/src/index.ts:83-90 (renderer); fixture/assertion at plugins/dsh-local-ai/test/index.spec.ts:31-35,68-82
Failure branch — input:
{} (baseURL http://127.0.0.1:11434; nothing listening; no ollama binary on PATH)
Output:
{
"api": {
"ok": false,
"error": "connection refused"
},
"process": {
"present": false,
"error": "\"ollama\" not found: subprocess-local: command \"ollama\" was not found on PATH"
}
}
Observed from plugins/dsh-local-ai/src/health.ts:52-66,79-92; plugins/dsh-local-ai/test/health.spec.ts:23-28,52-57
Brief examples: ollama_show · ollama_pull
Configuration
All tunables are Schemastery Config fields (changeable from cordis.yml). An id-targeted override replaces the whole row — restate every key you need. cordis.patch.yml documents each key inline.
Most-used keys:
| Key | Default | Meaning |
|---|---|---|
baseURL |
http://127.0.0.1:11434 |
Ollama HTTP API base URL; /api/* paths are appended |
requestTimeoutMs |
30000 |
Per-request HTTP timeout (milliseconds) |
defaultContextWindow |
8192 |
Context capacity used when a model has no exact value |
maxTokens |
4096 |
Per-request output cap used when a model has no exact value |
vision |
true |
Declare and serialize image support when the model reports vision; false keeps the route text-only |
dsh-v0.2.2-rc.4(2026-11-18);models |
[] |
Harness-visible → Ollama model mappings |
backends |
[] |
OpenAI-compatible local backends (LM Studio / vLLM / llama.cpp) |
route |
[] |
Local-model routing rules (first match wins) |
| Key | Default | Meaning |
|---|---|---|
baseURL |
http://127.0.0.1:11434 |
Ollama HTTP API base URL; /api/* paths are appended |
requestTimeoutMs |
30000 |
Per-request HTTP timeout (milliseconds) |
graceMs |
15000 |
Subprocess terminate grace for the health-check CLI probe |
defaultContextWindow |
8192 |
Context capacity used when a model has no exact value |
maxTokens |
4096 |
Per-request output cap used when a model has no exact value |
temperature |
(none) | Default sampling temperature (0..2); omitted leaves the provider default |
vision |
true |
Declare and serialize image support when the model reports vision; false keeps the route text-only |
visionCacheTtlMs |
30000 |
Milliseconds a /api/show capability probe stays cached (0 disables caching; a pull or remove invalidates that model) |
dsh-v0.2.2-rc.4(2026-11-18);models |
[] |
Harness-visible → Ollama model mappings |
dsh-v0.2.2-rc.4(2026-11-18);models[].name |
(required) | Harness-visible model name (GenerateOptions.model) |
models[].model |
= name |
Ollama model id |
models[].contextWindow |
(none) | Per-model context capacity |
models[].maxTokens |
(none) | Per-model output cap |
models[].temperature |
(none) | Per-model sampling temperature |
backends |
[] |
OpenAI-compatible local backends (LM Studio / vLLM / llama.cpp) |
backends[].name |
(required) | Backend name; registers provider id openai:<name> |
backends[].baseURL |
(required) | Backend base URL including /v1, e.g. http://127.0.0.1:1234/v1 |
backends[].apiKey |
(none) | Optional bearer API key (most local servers leave it empty) |
dsh-v0.2.2-rc.4(2026-11-18);backends[].models |
[] |
Harness-visible → backend model mappings |
backends[].maxTokens |
4096 |
Per-backend output cap used when a model has no exact value |
backends[].temperature |
(none) | Per-backend sampling temperature |
route |
[] |
Local-model routing rules (first match wins) |
route[].model |
(required) | Target local model name |
route[].provider |
ollama |
Target provider id: ollama or openai:<name> |
route[].purpose |
(none) | Task type match: compaction / session-title |
route[].keywords |
[] |
Case-insensitive request keywords |
route[].always |
false |
Route every eligible request to this model |
Example override in your profile patch:
- insert:
- id: dsh-local-ai
name: dsh-local-ai
config:
backends:
- name: lmstudio
baseURL: http://127.0.0.1:1234/v1
route:
- model: llama3.2
keywords: ["confidential", "offline"]
- model: qwen2.5-7b
provider: openai:lmstudio
always: true
FAQ
No. The routing listener falls back to the cloud (next()) when a local route fails before producing its first token, so a dead Ollama never blocks a conversation; the /ollama overview is best-effort and never throws on a down server. One carve-out: a failure carrying IMAGE_OFFLOAD_REQUIRED is rethrown instead of retried on the cloud (see "Security boundaries"); a failure after the first token is forwarded verbatim and cannot be retracted.
It only makes network:outbound requests to the endpoints you configure in baseURL / backends[].baseURL. It performs no filesystem access, creates no storage, and stores no credentials. Every model list/detail, health fact, and error message shown to the model or the user is sanitized first — endpoint userinfo and secret query params are dropped, control characters stripped, and lengths bounded. Tool and command results are logged by the harness's own tool/command seams.
No. The route list is empty by default; a request reaches a local model only through an explicit matching rule or an explicit ollama / openai:<name> provider selection.
No. llm/stream is a Cordis broadcast event: every listener runs and none can starve another; this plugin's listener always delegates through next() and short-circuits only when a local route is actually serving. It provides no service key, registers no webServer prefix, and mutates no globals. The point-by-point argument is in "Interoperability with other DSH plugins".
Yes, when the model reports the capability: a model whose /api/show capabilities include vision declares inputModalities: ["text","image"] and carries base64 image payloads on user messages (opt out with vision: false); text-only models still reject image content (UNSUPPORTED_CONTENT).
Security boundaries
- No re-routing by default — the
routelist is empty unless you opt in; a request reaches a local model only through an explicit rule or an explicitollamaprovider selection. - Sanitize before display — endpoint addresses and local paths are sanitized before they reach tool output, the
/ollamacommand, or error messages. - Zero bundled models — downloads and storage are Ollama's own responsibility; nothing is shipped in the package.
- Failure loud, failure contained — invalid config fails the mount; a local route that fails before producing content falls back to the cloud (
next()), so a down Ollama never bricks a conversation. One carve-out: a failure carryingIMAGE_OFFLOAD_REQUIREDis rethrown instead of retried on the cloud — that code is the official offload circuit asking this same local route to drop retained images, and falling back would skip the circuit while silently sending a local-only request to a remote provider. - Model-visible ⟺ logged — routing only changes which provider serves a request (the assistant message is logged with its
ollamaprovenance); no new model-visible input is invented.
Permissions & data
- Permissions:
network:outboundto the Ollama endpoint you configure; no native code, no filesystem access, no storage. - Data: every model list/detail, health fact, and error message shown to the model or the user is sanitized (endpoint userinfo and secret query params dropped, control characters stripped, lengths bounded) before display. Tool and command results are logged by the harness's own tool/command seams.
- Credentials: the plugin stores and reads no credentials. It only issues HTTP requests to the endpoint you configure, plus the local
ollama listprocess probe.
Known limitations
- npm 0.2.0-rc.2 — developed and tested against
@deepseek-ai/dsh@0.2.0-rc.2; newer harness baselines are expected to work but are verified by the monthly compat workflow. - Vision when the model reports it — models whose
/api/showcapabilities includevisiondeclareinputModalities: ["text","image"]and carry base64 image payloads on user messages (opt out withvision: false); text-only models still reject image content (UNSUPPORTED_CONTENT). - Mid-stream fallback — once a local route has started producing content, a later failure is forwarded (not retracted); only a failure before the first token falls back to the cloud.
Interoperability with other DSH plugins
Verified against DSH 0.2.0-rc.2 (the runtime this README ships for) and the high-star plugin set surveyed on 2026-10-05.
This plugin does not interfere with other plugins, including the widely installed high-star ones:
- No tool-name collision. Every tool is namespaced; no bare name owned by a shipped tool or another plugin is registered.
- No service-key collision. It provides no service key at all, so it cannot collide on one.
- No slot collision. It registers no client slot key, so it cannot contend for a
shadows-shipped-uiseat. - No HTTP route collision. It registers no
webServerprefix. - No patch-layer collision. The bundle patch only
inserts its own row; it never overrides a built-in row'sconfig. - No global mutation. It does not patch prototypes, rewrite
process.env, or replace the global fetch dispatcher.
Shared event listeners are non-interfering by construction. It observes the ordering-sensitive event llm/stream with ctx.on() — Cordis's broadcast registration, where every listener runs and none can starve another. Every listener here delegates through next(), so the chain is never short-circuited, and a mutation is applied to the value next() produced rather than returned in its place:
llm/stream— also used bydsh-routing-suite(7000★).
Static evidence: dsh-plugin-doctor K10–K13 report pass for every check on this repository.
Compatibility
| Surface | Status |
|---|---|
| Harness | DeepSeek Harness dsh-v0.2.2-rc.4 (verified 2026-11-18: three typecheck rulers (installed, CI, checkout) + 142 tests + self-contained/artifacts gates; the 0.1.7 content-block union is adapted — a tool result is a first-class tool-role message, and a pre-0.1.7 tool-result wrapper is still read for old logs). The peer range admits every supported line: >=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0 || >=0.1.7-0 <0.2.0 || >=0.2.0-0 <0.3.0 || >=0.2.1-0 <0.3.0 || >=0.2.2-0 <0.3.0; dev/test pins are 0.2.0-rc.2. |
| Node | ^22.19.0 || >=24.9.0 |
| Backend | Ollama (local HTTP API + CLI probe) |
| Model | Text-only route (inputModalities: ['text']); tool calls and tool results are supported |
Ecosystem & quality
- Gitee mirror (sync mirror; GitHub is canonical)
- dshfind plugin page (installs and ranking)
- OpenSSF Scorecard report (driven by .github/workflows/scorecard.yml)
- dsh-plugin-doctor verification report (K10–K13 all
pass) - DSH Market (listed)
- 1024 store channel:
npm i -g dsh1024once, thendsh1024 plugin --profile web add dsh-local-ai(counts toward the deepseek1024.com install ranking) - Ecosystem knowledge base — measured data, not marketing: plugin development guide · plugin-selection data · maintenance criteria
Development
pnpm install # node ^22.19 || >=24
pnpm run typecheck # tsc: src + tests against the published 0.2.0-rc.2 types
pnpm run typecheck:ci # strict tsc against published rc.2 types (skipLibCheck off)
pnpm test # vitest: real Context/LlmRuntime/ToolRuntime/CommandRuntime/subprocess seams
pnpm run test:coverage # coverage gate (90/80/90/90)
pnpm run build # tsdown bundle + tsc declarations (lib/)
pnpm run verify:self-contained # dependency specs resolve from the registry
pnpm run verify:artifacts # built ESM face + bundle patch present
node scripts/check-readme-sync.mjs # five-language README sync gate
node scripts/check-endpoints.mjs # M3 endpoint-liveness probe (Ollama /api/version)
pnpm pack # the published tarball
The build output is lib/ (pnpm run build bundles with tsdown and emits tsc declarations). The README images are generated programmatically by scripts/gen-readme-assets.py (Python + Pillow) and are safe to re-run.
Topics: dsh, dsh-plugin, deepseek-harness, deepseek, cordis, ollama, local-llm, local-models, offline, privacy, model-routing
Family & thanks
This project is part of the DeepSeek Harness plugin family from PerryLink (99 plugins, all Apache-2.0). If it is useful, a star helps the next person find it — nothing is gated behind it.
- @PerryLink — creator and maintainer: adapter, routing, tools, health check, sanitization, and the five-language docs.
- @LABEST-IA — tool-call CallId fix (PR #2), and the tool-call slot and vision-support reports (issues #1, #3, #5).
License
LICENSE (Apache License 2.0) © 2026 dsh-local-ai contributors
Links
More in this category
Ebony-Vinyl/dsh-our-free-model★ 89228
Adds free model lanes to DeepSeek Harness — DeepSeek V4.1 Flash, Kimi K3 and others — with no login, sign-up or API key, plus a local OpenAI-compatible gateway, fallback routing and a usage dashboard.
dingminhua/dsh-connect-workbuddy★ 2083
Connects locally signed-in WorkBuddy models, CN and international alike, to DSH, reading each model's credit multiplier from the upstream catalog on every refresh, with per-model image input toggles, account switching backed by an auto-failing-over pool, manual daily check-in, and read-only credit overviews shown as compact pills on the card and in the composer.
Alice-Marx/dsh-model-router★ 1023
Routes DeepSeek Harness work across configured model APIs and supported vendor CLIs with dependency-aware packages and cost previews.
V1ki/dsh-plugin-subscriptions★ 644
Use ChatGPT (Codex), Claude, and Grok subscriptions as DeepSeek Harness LLM providers, with Settings login, model catalogs, usage, plus image_generate, video_generate, and x_search tools.
XDTrees/dsh-workbuddy-xdpool★ 631
Merge every locally signed-in WorkBuddy account into DeepSeek Harness as one auto-failing-over model pool (multi-account rotation, live credits, and a model catalog showing per-model credit multipliers and free/night-discount tags).
XDTrees/dsh-xdpool★ 631
Merge every locally signed-in WorkBuddy account into DeepSeek Harness as one auto-failing-over model pool: multi-account rotation, 429 cooldowns, live credits, a model catalog with per-model credit multipliers and free/night-discount tags, QR-code login for 13 vendors, and aggregate free-tier channels. Accounts persist across restarts.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.