dsh-commandcode-provider README

项目的 README,来自 github.com/Mars-Sea/dsh-commandcode-provider。合并为一个 markdown 文件:README.md。

dsh-commandcode-provider

English | 简体中文

Awesome GitHub Repo stars DeepSeek Harness PRs Welcome CI License: MIT npm

Unofficial DeepSeek Harness LLM provider plugin for Command Code, ported from pi-commandcode-provider (MIT).

Community integration. You need your own Command Code account, API key or subscription, and Command Code's terms apply. Not affiliated with Command Code, Inc.

Quick start

Verified engines dsh 0.2.2-rc.1 through 0.2.2-rc.5, and 0.2.3-alpha.2 through alpha.3
Node.js >=24.9 — raised from 22 in 0.16.0, see Node.js 24.9 or newer
Install — web dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@latest
Install — terminal dsh plugin --profile dsh-tui add @mars-sea/dsh-commandcode-provider@latest
Config file $DSH_HOME/settings.yaml → llm-commandcode:
API key env COMMANDCODE_API_KEY
Usage dashboard /commandcode

Features

Screenshots

Model picker — plan tier, deal/FREE, peak/off-peak, Image and context annotations:

Model picker with plan, deal, image and context annotations

Usage dashboard — /commandcode per-account report:

Usage dashboard

Settings page — accounts with live quota, model visibility, privacy switches, connection options:

Command Code settings page with the account usage card

Install

dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@latest

The current source admits DSH >=0.2.2-rc.1 <0.2.3-0 and >=0.2.3-alpha.2 <0.2.4-0. Profiles on previously supported 0.2.1 RC or 0.2.2 alpha versions can use the 0.18.4 maintenance release. If your engine is 0.2.3-alpha.1, update to 0.2.3-alpha.2 first. The seven tested versions are recorded in dsh.compatibility.dshReleases. Engine compatibility and verification

Node.js 24.9 or newer is required

The Node.js floor was raised from 22 to 24.9 in 0.16.0. On Node 22 or 23, upgrade Node before updating this plugin.

The supported DSH release lines require Node.js 24.9 or newer.

nvm install 24 && nvm use 24 (or any Node 24.9+ distribution) resolves it. Node 24 is a current LTS line.

Older dsh releases are no longer supported: the last plugin release for dsh 0.1.7 is 0.11.17, for 0.1.2–0.1.6 it is 0.11.11, and for the 0.5.0-era line 0.9.1 — all installed by exact version, none maintained.

pnpm 11 holds back new releases. minimumReleaseAge defaults to 1440 minutes, so a version published less than a day ago is skipped and @latest resolves to the previous release — silently, with a success exit code. To install a release from the last 24 hours, name it exactly: @mars-sea/[email protected]. This applies to every profile, including the terminal UI below.

Updating

Prefer the Web plugin page. A profile that installed this plugin from the npm registry is marked updatable by dsh: sidebar Plugins → open this plugin → the Versions section below its rows lists newer releases, and Update replaces the installed one. An available update also shows an Updatable badge on the card and Update to in the detail header. The host checks the target first, then removes the old version and installs the target, rolling back to the previous version if that install fails. With HMR the new version starts immediately; without HMR dsh reports that a restart is required. API keys live in the dsh credential store and settings in the profile's cordis.patch.yml, so neither is lost when the package is replaced.

Only registry installs under their own package name get a Versions section. Bundles installed from link: / a local path, a Git address, or a tarball (for example dsh plugin add /path/to/dsh-commandcode-provider during development), and bundles shipped with the installation, do not show it. Use the CLI below for those, or remove the bundle and reinstall with the registry command above. The section recommends the newest non-prerelease, non-deprecated version whose engines.dsh admits the running dsh; prereleases can be revealed manually.

CLI (fallback) — same tag as the install, then restart the web app. Each profile updates separately, because the terminal UI owns its own plugin list:

dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest
dsh plugin --profile dsh-tui update @mars-sea/dsh-commandcode-provider@latest

dsh plugin update is a pnpm passthrough, not the host's plugin-update path; minimumReleaseAge above can silently skip a fresh release there too, so name an exact version when needed.

Get an API key and verify it works

Easiest via the official CLI (Node.js 22+):

npm i -g command-code@latest
cmd login        # macOS/Linux; native Windows: cmdc login

Or skip the CLI: click Sign in to Command Code under Settings → Command Code — the browser opens the commandcode.ai authorization page (the same flow cmd login runs) and the key is stored locally once you approve. You can also create a key on the Keys page and paste it, or export COMMANDCODE_API_KEY="user_...".

The sign-in flow needs the Host and your browser on the same machine (loopback callback). With a remote Host, paste the key manually; a literal composition-level apiKey, if set, still takes precedence over a signed-in credential.

To verify: after restart, enter your API key in Settings → Command Code and save. Settings → Models shows a Command Code card, and the model picker lists the live catalog under commandcode. Send a message with a model your plan includes.

Terminal UI (dsh-TUI)

Each dsh profile owns its own plugin list, so the web install does not reach the terminal — add the plugin to the dsh-tui profile as well, pinned to an exact version (within 24 hours of a release a bare name resolves to the previous build, leaving a fresh install with no /settings → Command Code page and no commandcode models):

dsh plugin --profile dsh-tui add @mars-sea/dsh-commandcode-provider@latest

Then pick the provider in the model selector, or name it directly:

/model commandcode/deepseek/deepseek-v4.1-flash

/model lists every registered provider, with the live catalog and its plan/deal/context annotations; the /commandcode dashboard works there too.

Entering the key. The TUI has no web Models page, so the plugin declares its own page — /settings → Command Code — with the API key, API base, out-of-plan filter, active account and command language. The key field is write-only: it shows whether a key is configured and writes what you type to the credential store, never to a settings document. The same page lists the whole catalog as checkboxes grouped by plan tier, free models first; everything starts checked, and the choice is stored as per-model overrides next to the visibleModels list the web page edits. Custom display names (modelNames) are configurable on the Web settings page only for now; the terminal settings page does not expose them yet (the same boundary as contextWindow, issue #86).

Alternatively set the key outside the TUI. The first match wins:

export COMMANDCODE_API_KEY="user_..."   # launching environment
cmd login                               # writes ~/.commandcode/auth.json

Making Command Code the default. dsh-TUI pins its own agent route, so its agent-default-model setting does not override it. Override the agent-loop row in your profile patch ($DSH_HOME/profiles/dsh-tui/cordis.patch.yml):

- id: agent-loop
  inject: [tuiStartup]
  config:
    agents:
      - id: main
        provider: commandcode
        model: deepseek/deepseek-v4.1-flash
        reasoningEffort: max
        cwd: !!js process.cwd()

Usage dashboard

The plugin registers a /commandcode slash command showing per-account usage:

/commandcode        (or /commandcode status)

Its copy follows the shell's locale: explicit lang: 'en' | 'zh' in the llm-commandcode plugin config wins, otherwise LC_ALL/LANG is read, otherwise it falls back to zh. The web settings page is independent — it follows the browser's language preference.

Account rotation

With several Command Code subscriptions, the plugin switches to the next account automatically when one hits its usage limit:

Each account row shows its plan, status and 5-hour/weekly meters; expand it for the full report, or run /commandcode. When a refreshed report shows a spent window, that account also leaves automatic selection until the window resets. The equivalent YAML is in Configure.

Configure

Provider ID. This plugin registers the commandcode model route. If you also configure Command Code under llm-pi-ai.config.providers in your profile's cordis.patch.yml, give that entry a distinct key such as commandcode-pi. A duplicate commandcode key can prevent pi-ai from registering its providers and disable Add model provider. To recover, rename the pi-ai entry, update any model selections that reference it, and reload the profile or restart DSH. See issue #129.

Settings → Command Code groups the options as Accounts (keys, sign-in, live quota, pinning, dedicated models), Models & context (out-of-plan filter, visible models, context length, output limit), Privacy & security (zero data retention), Integrations & display (web search, sidebar quota card) and Advanced (API base URL, timeouts, transport retries, image offload). The same options live in $DSH_HOME/settings.yaml and apply immediately, without a restart:

llm-commandcode:
  apiKeyEnv: COMMANDCODE_API_KEY        # first (default) account
  activeAccount: COMMANDCODE_API_KEY_2   # optional: pin the active account
  accounts:                              # optional: rotation order after it
    - label: Go #2
      apiKeyEnv: COMMANDCODE_API_KEY_2
  modelAccountRules:                     # optional: route models to accounts (first match wins)
    - models:                            # catalog model ids (multi-select)
        - deepseek/deepseek-v4-pro
      account: COMMANDCODE_API_KEY_2
  visibleModels:                         # optional: only these models in pickers; unset shows all
    - deepseek/deepseek-v4-pro
  apiBase: https://api.commandcode.ai
  workingDir: /path/to/project           # optional
  modelsCachePath: ~/.commandcode/models-cache.json
  requestTimeoutMs: 300000              # default 300s (the official CLI's own budget)
  streamIdleTimeoutMs: 300000           # default 300s
  # offloadSeenImagesForCache: true     # opt in to CLI cache mitigation
  showSidebarQuota: true                 # optional: sidebar plans & quota card (default off)
  zdr: true                              # optional: zero-data-retention upstreams only (default off)
  # contextWindow: 131072                # optional: custom context length for every model
  # contextWindowOverrides:              # optional: per-model context lengths; wins over contextWindow
  #   deepseek/deepseek-v4-pro: 65536
  # maxOutputTokens: 65536               # optional: per-turn output limit; 0 sends no max_tokens
  # modelNames: { "deepseek/deepseek-v4.1-flash": "DeepSeek V4.1 Flash" }   # optional: display-name overrides by catalog id

Context, output and image tuning

Option Effect
contextWindow, contextWindowOverrides Replace the catalog context_length the harness meters and compacts on (issue #86). Use it when the catalog over-reports the window (sessions then fail with context_length_exceeded) or under-reports it (sessions compact too early). Whole tokens in 1 – 10,000,000; 32K/1M shorthand accepted.
maxOutputTokens Per-turn max_tokens cap. Every request already carries max_tokens, resolved as the smallest of the model's published ceiling, the runtime-learned ceiling and the gateway cap of 131,072 — a passive hard limit that cuts the answer with no warning to the model. A positive number can only tighten it; 0 sends no field at all, which is the fix for answers cut off mid-sentence (0 affects the CLI and OpenAI transports only; Claude's Anthropic Messages endpoint requires the field). An empty field clears the setting — it is not the same as writing 0.
offloadSeenImagesForCache On the CLI transport a new image can make the reported prompt cache retreat to the first historical image even when every previous request message is byte-identical. Enabling it replaces an older image with a stable text placeholder once this model has answered with it, so later text stays cached without replaying old pixels. It mitigates the cost spike but does not repair Command Code's multimodal cache behavior, and the model cannot inspect an offloaded image again without rereading the source file. Off by default. Live evidence.
modelNames Optional map of catalog model id → custom display name; only the picker label (LlmModelInfo.name) changes, so external tools that match on the model name string (peak-hour reminders, cache-pricing plugins) can be made to line up — our default (CC) suffix and upstream's (latest) suffix are what break them. Unset or empty (the default) keeps the name exactly as today: ${catalogName} (CC), with any upstream (latest) preserved; an unknown model with no catalog row still shows the bare id. The model id, request body, pricing, peak labels, price table, commandcode/prices wire and Remote descriptor count are unchanged; sorting still uses the catalog original name, so renaming never reorders the picker. Configurable on the Web settings page only for now — the terminal settings page is not wired up.

When your deployment mounts the web capability (@deepseek-ai/dsh-web + @deepseek-ai/dsh-tool-web), the model's web_search tool is served by this plugin's commandcode search provider — it calls the Command Code Provider API's /alpha/web-search endpoint with the same API key and base URL as chat, so no separate search key, endpoint or model is needed.

On by default. The "Serve dsh web search with Command Code" toggle (webSearch) selects commandcode as the active search backend; turning it off hands the selection back to whichever backend was there before (a sibling search plugin such as modsearch keeps working). The change takes effect on the next search — no restart.

This reuses the Command Code Provider API directly (like the official CLI's built-in web_search), so it is distinct from a DeepSeek-native search backend.

Zero data retention (ZDR)

Command Code can serve a request only through upstreams that retain no prompts or completions and never train on them — the same opt-in the official CLI exposes as CMD_ZDR=1, and the x-cmd-zdr: 1 header on the Provider API (official docs).

Off by default. Turn it on with the "Zero data retention (ZDR)" toggle (zdr) in the Privacy & security card, or in your profile config.

Notes & limitations

Permissions & privacy

The plugin only communicates between your local dsh profile and your Command Code account: locally it touches only the credential store and the models cache (plus ~/.commandcode/auth.json as a last-resort fallback); on the network it calls only the Command Code API. No telemetry. With zero data retention on, chat requests require a ZDR upstream; models without one fail instead of running without the protection.

Disabling / uninstalling

Development

npm install
npm run typecheck   # tsc --noEmit
npm run build       # tsdown -> lib/

To try a local build in a profile: dsh plugin --profile web add /path/to/dsh-commandcode-provider. After changing src/, re-run npm run build and restart the app.

The package exports the plugin root, /client, /locale/*.json, and /package.json. Source remains in the repository; the unpackaged ./src/* export was removed. npm run test:pack checks declared entry points against the actual packed file list.

Reference docs

The engineering detail behind this README lives under docs/agent-reference/:

Community & feedback

GitHub Repository · GitHub Releases · npm Package · Linux.do 社区

License

MIT — see LICENSE. Portions ported from pi-commandcode-provider (MIT).

dsh-commandcode-provider (Mars-Sea/dsh-commandcode-provider)

正在搜索数据库…

这是什么?这是一个非官方插件,把 Command Code 添加为 DeepSeek Harness(dsh)内的一个 LLM 提供商,让 dsh 能使用 Command Code 的实时模型目录、基于套餐的模型选择、推理力度控制、图像输入、网页搜索和多账户支持。
怎么把它装进我的 dsh profile?用 'dsh plugin add' 把它安装到任意 dsh profile,并选择与你的 dsh 版本匹配的发布线:dsh 0.1.2+ 直接用 @latest 安装,老的 0.5.0 时代 Harness 线则要显式固定为 @0.9.1。
使用之前需要有自己的 Command Code 账户吗?需要——你需要一个带 API 密钥或订阅的 Command Code 账户、一个用于承载插件的现有 dsh 安装;如果要用官方 CLI 获取密钥,还需要 Node.js 22+。
这个插件做不到什么?完全不支持停止序列(携带停止序列的请求会失败),图像输入只对带 Vision 标记的模型有效,而且在旧的 /alpha/generate 传输通道上,之前轮次的推理内容不会回放到后续轮次。
我的 API 密钥和聊天数据会去哪里?插件只在你本地的 dsh profile 和 Command Code API 之间通信:在本地它会接触凭据存储、模型缓存以及一个备用的 ~/.commandcode/auth.json,并且不发送任何遥测数据。
多账户轮换是怎么工作的?你在 Account rotation 设置卡片里添加多个带标签和 API 密钥的 Command Code 账户;当当前账户达到用量上限时,请求会自动回落到下一个账户,等原账户的用量窗口重置后再切回原来的账户。
它会取代 dsh 内置的网页搜索吗?当 dsh 的网页能力被挂载时,插件的搜索开关(默认开启)会把 websearch 工具切换到 Command Code 的 /alpha/web-search 端点(使用同一个 API 密钥),而不是 dsh 自带的 DeepSeek 搜索后端。
可以控制推理力度或给模型发图片吗?提供可选推理力度档位的模型会在模型选择器中显示这些档位,具备视觉能力的模型可以在聊天中直接接受图像输入;纯文本模型则会拒绝图片。
README 为什么提到要固定确切的旧版本?dsh 0.5.0 及更早版本使用的是不同的 rc 时期 Host/浏览器 API,所以这条老版本线上的用户必须安装确切为 @0.9.1 版本的插件,而不是 @latest——后者现在只面向 dsh 0.1.2+。
作者
Mars-Sea
大小
9.5 MB
星标
487
时长
3个月
提交 · 90 天