# dsh-commandcode-provider

> Integrate Command Code with DSH, providing model catalog, inference requests, image input, and account usage viewing capabilities.

## Metadata

- Author: [@Mars-Sea](https://github.com/Mars-Sea)
- Repo: <https://github.com/Mars-Sea/dsh-commandcode-provider.git>
- GitHub: [Mars-Sea/dsh-commandcode-provider](https://github.com/Mars-Sea/dsh-commandcode-provider)
- Stars: 76
- Language: TypeScript
- License: [MIT](https://spdx.org/licenses/MIT.html)
- Homepage: <https://github.com/Mars-Sea/dsh-commandcode-provider>
- Topics: `deepseek-harness`, `dsh`, `dsh-plugin`, `llm`, `llm-provider`, `npm`, `plugin`, `provider`, `typescript`
- Forks: 4
- Open Issues: 0
- Last push: 2026-08-20T02:50:11.000Z
- Added: 2026-08-17T00:00:00.000Z

## Install

```bash
dsh plugin --profile web add github:Mars-Sea/dsh-commandcode-provider
```

## Wiki

## One-line Description

This plugin integrates Command Code into DSH, allowing you to browse and use models provided by Command Code directly from DSH's model selector. It also provides a dedicated settings page, account usage viewing, and model list organization by plan.

## Key Features

- **Integrate Command Code Models**: Register a `commandcode` model provider, converting DSH's conversations, tool calls, and streaming output into Command Code requests.
- **Synchronize Model Catalog**: Fetch real-time model list from Command Code, and use local cache to continue displaying the existing catalog when network is unavailable.
- **Display Model Usage Information**: Mark minimum plan, promotions, image capability, and context window in the model selector, sorted by plan tier.
- **Filter Models by Account Plan**: Hide models not supported by the subscription plan by default; retain full list when billing information is uncertain, actual permissions are still determined by the server.
- **Support Reasoning Intensity and Image Input**: Provide optional reasoning intensity for known models; Vision models can receive images, which are read through DSH's attachment service.
- **View Account Usage**: Check request count, spending, tokens, quotas, time window limits, and subscription information via the `/commandcode` command and the account card in the settings page.

## Technical Implementation

- **Language**: TypeScript
- **Key Dependencies**: `@deepseek-ai/dsh-llm`, `@deepseek-ai/dsh-settings`, `@deepseek-ai/dsh-credentials`, React
- **Architecture Pattern**: DSH bundle registers both Host-side model adapter and configurable provider, and inserts plugin configuration through Cordis patch; Web client additionally registers Command Code settings page. Account usage is obtained by Host-side through Remote gateway, browser does not hold API key directly.
- **Entry Files**: `src/index.ts`; model request and catalog adapter located at `src/adapter.ts`, browser entry at `src/client/index.ts`.

## Use Cases

Suitable for users who want to use Command Code accounts and models in DSH, and view plans and image capabilities in the same model selector. Users who need to understand account quotas, request spending, or 5-hour/weekly window usage can also directly use the settings page or `/commandcode` command.

## Prerequisites and Compatibility

| Dependency | Minimum Version | Description |
|---|---|---|
| DSH Runtime | `^0.1.0-rc.6` peer dependency | Requires DSH's LLM, credentials, settings, client connection and other services; plugin package declares corresponding peer dependencies. |
| Node.js | `>=22` | Required by package.json engines field. |
| React | `^18.2.0` | Web settings page uses React for rendering. |
| Platform | Cross-platform | package.json does not declare `os` or `cpu` restrictions. |
| Native Modules | None | No native module dependencies such as `node-pty`, `node:sqlite` declared. |

## Installation

```bash
dsh plugin --profile web add github:Mars-Sea/dsh-commandcode-provider
```

## Configuration Options

| Option | Type | Description | Default |
|---|---|---|---|
| `apiKeyEnv` | String | Specifies the name for reading API key from DSH credentials service or startup environment. Settings page also uses this reference when saving keys. | `COMMANDCODE_API_KEY` |
| `apiKey` | String | API key directly written to plugin composition config; suitable for host configuration injection, takes priority over credential reference. | Not set |
| `apiBase` | String | Base address for Command Code API, convenient for using endpoints other than the default. | `https://api.commandcode.ai` |
| `workingDir` | String | Submitted to Command Code as project working directory; uses DSH process current directory when empty. | Current working directory |
| `modelsCachePath` | String | Location for saving model catalog cache, used for fallback display when network is temporarily unavailable. | `~/.commandcode/models-cache.json` |
| `requestTimeoutMs` | Number | Maximum wait time to receive first byte of response for generation requests. | `60000` ms |
| `streamIdleTimeoutMs` | Number | When streaming response has continuous no data, connection is considered invalid after exceeding this time. | `300000` ms |
| `filterModelsByPlan` | Boolean | Controls whether model selector hides models beyond account subscription plan; shows full catalog when turned off. | `true` |

## FAQ

**Q: Does this plugin need an API key?**

A: Model catalog can be browsed without a key, but sending requests and viewing account usage require a valid Command Code API key. The plugin first checks direct configuration, then resolves through DSH credentials service; falls back to reading startup environment, and finally to `~/.commandcode/auth.json`.

**Q: What image inputs are supported?**

A: Only models registered as Vision in the source code accept images, and DSH needs to have attachment service enabled. Text models will not silently discard images; instead, they return an unsupported content error.

**Q: Why is a certain model missing from the model list?**

A: The default model selector hides models beyond permissions based on account subscription plan. Opening may fail when billing query fails, plan is unknown, or there's on-demand balance; turning off `filterModelsByPlan` also shows the full catalog, but server may still return plan permission errors.

**Q: What to do when requests interrupt during long thinking?**

A: Default waits 60 seconds for first byte, and allows 300 seconds of stream idle time. When network is slow or model outputs for a long time, you can increase `requestTimeoutMs` or `streamIdleTimeoutMs` in settings page; request connection failures, rate limits, and some server errors retry according to DSH default policy.

**Q: Why does the request return `MODEL_NOT_IN_PLAN`?**

A: This means the selected model is not in the current Command Code plan. You can select a model included in the current plan, or adjust the account plan; plan markers in the model list are only for reference, the server is the ultimate source of permissions.

**Q: Is `stop` sequence supported?**

A: No. Command Code's request format does not have a stop field; requests with this option will explicitly return an unsupported option error.

**Q: Settings page shows unconfigured, but requests still succeed. Why?**

A: The key may come from the official CLI login file `~/.commandcode/auth.json` instead of DSH credential store. Saving the key to settings page will allow settings page to accurately display configured status.

**Q: Will uninstalling the plugin delete the API key?**

A: No. The uninstall command only removes the plugin package and its configuration layer; keys in DSH credential store and `~/.commandcode/auth.json` are retained.

## Learning Curve

Beginner — After installing the plugin, fill in API key and connection parameters mainly through "Settings → Command Code", then select model from model selector; check advanced configuration only when you need to adjust options based on plan or network conditions.

## Known Issues and Limitations

- `stop` sequence is not supported; requests with this option will return `UNSUPPORTED_OPTION`.
- Image input is limited by Vision model list and depends on DSH attachment service; switching to text model in sessions with images will also be rejected by DSH.
- Model capabilities, plans, promotions, and peak/off-peak prices are static snapshots in source code; plugin update is required to fully sync after official catalog or plan changes.
- When model catalog refresh fails, it falls back to local cache; if cache doesn't exist or is invalid, model selector may have no old catalog to display, but explicit model requests are still handled by server.
- Account usage depends on Command Code's account interface and API key; each interface degrades independently; when some interfaces fail, the report retains other available data.
- Default stream idle timeout is 300 seconds; very long reasoning processes or network stalls exceeding this value will still be marked as timeout.
- Plugin only reads the official CLI's `~/.commandcode/auth.json` as the last fallback, and does not read authentication files from other tools like pi/OMP.

---

This document is auto-generated by [deepseek-plugin.org](https://deepseek-plugin.org). HTML page: [dsh-commandcode-provider](https://deepseek-plugin.org/plugins/Mars-Sea/dsh-commandcode-provider)
Wiki generated by AI (model: `MiniMax-M2.7`)
