# deepseek-harness-model-config

> Add a "Model Advanced Configuration" page to DeepSeek Harness Web UI, supporting custom OpenAI/Anthropic endpoints with per-model context and inference intensity settings.

## Metadata

- Author: [@MarvekG](https://github.com/MarvekG)
- Repo: <https://github.com/MarvekG/deepseek-harness-model-config.git>
- GitHub: [MarvekG/deepseek-harness-model-config](https://github.com/MarvekG/deepseek-harness-model-config)
- Stars: 27
- Language: JavaScript
- License: [MIT](https://spdx.org/licenses/MIT.html)
- Topics: `dsh-plugin`, `dsh-plugin-market`, `dsh-plugin-verify`, `dsh-plugins`
- Forks: 1
- Open Issues: 0
- Last push: 2026-08-20T06:55:39.000Z
- Added: 2026-08-16T00:00:00.000Z

## Install

```bash
dsh plugin --profile web add github:MarvekG/deepseek-harness-model-config
```

## Wiki

## One-Line Description
Adds a "Model Advanced Configuration" settings page to the DeepSeek Harness Web UI, enabling creation of custom model endpoints (OpenAI/Anthropic protocols) without restarting DSH, pulling public model lists from endpoints, and configuring capabilities like context windows, max output, and reasoning effort per model.

## Core Features
- Add custom endpoints: Fill in name, URL, API Key and protocol, saved immediately available in session selector
- Support three API protocols: openai-completions, openai-responses, anthropic-messages
- One-click fetch model candidates: Pull candidate list via OpenAI-compatible `GET /models`, provide select all/deselect all/none
- Configure capability parameters by model: context window, max output, input modalities (text/image), reasoning effort
- Auto-complete from models.dev: After pulling, use `https://models.dev/api.json` to auto-complete missing context, max output and reasoning info
- API Key only goes through Harness credential system: will not be written to `settings.yaml`, also won't appear in config preview

## Technical Implementation
- **Language**: JavaScript (ESM `type: "module"`)
- **Key dependencies**: DSH built-in client plugins `@deepseek-ai/dsh-client-runtime` / `@deepseek-ai/dsh-client-ui-settings` / `@deepseek-ai/dsh-client-locale` / `@deepseek-ai/dsh-api-remotes` (injected via `window.__ModuleLoader__.load`)
- **Architecture**: Cordis dual-end plugin, host side only declares Loader name `models-config-plugin`, doesn't register any services, all read/write goes through host's existing settings RPC; client side registers "Advanced model config" page in `settings.section` slot
- **Entry files**: `src/index.js` (Host, 8 lines) + `src/client.js` (Client, 1661 lines React) + `cordis.patch.yml` (bundle injection declaration)

## Use Cases
When you need to connect DSH to a local OpenAI-compatible gateway (like one-api / new-api / self-developed proxy) or Anthropic-compatible service, only want to add/remove models in UI text, unwilling to manually write `settings.yaml`; or when you want certain models to support custom reasoning effort, custom headers, or set default context/max output for endpoints without declared capacity.

## Prerequisites & Compatibility

| Dependency | Min Version | Description |
|---|---|---|
| DeepSeek Harness | Not declared | Plugin uses `dsh.bundle.patch`, requires host to have loaded `llm-pi-ai` adapter and support `settings.section` / `settings.mutate` / `credentials.set` etc extension points |
| Node.js | Not declared | Plugin code only uses `export const` syntax |
| Platform | macOS / Windows / Linux | Cross-platform, no OS / CPU platform checks or native modules in source |
| Native modules | None | Only uses browser-side React and host built-in RPC |

## Installation

```bash
dsh plugin --profile web add github:MarvekG/deepseek-harness-model-config
```

## Configuration Options

| Config | Type | Description | Default |
|---|---|---|---|
| Endpoint Name | string | Display name for provider route and derived credential reference stem, must start with lowercase | None |
| Endpoint URL | string | Root address for provider requests and model discovery, requires `http` or `https` protocol, e.g., `https://gateway.example/v1` | None |
| API Protocol | enum | Options: `openai-completions` / `openai-responses` / `anthropic-messages` | `openai-completions` |
| API Key | string | Written to Harness credential system, won't enter config file | None |
| Custom Header | key/value | Attached when calling models, not attached during `GET /models` | None |
| Default Context Window | integer | Fallback value when model entry and built-in models have no context size | `262144` |
| Default Max Output | integer | Fallback value when model entry and built-in models have no max output | `32768` |
| Default Input Modality | enum | Fallback input type when model not declared (text/image) | `[text]` |
| Default Reasoning Effort | enum | Provider route-level default reasoning effort, from `off` to `max` | None |
| Reasoning Budget | key/value | Set token budget for each level for reasoning services that support budget | None |
| Reasoning Compatibility | object | Only valid for `openai-completions` route, controls `thinkingFormat`, `supportsReasoningEffort` | None |
| Cache Retention | enum | `none` / `short` / `long` | pi-ai default |
| Transport | enum | `sse` / `websocket` / `websocket-cached` / `auto` | pi-ai default |
| Request Timeout | integer(ms) | Provider SDK/HTTP request timeout | `0` (determined by underlying) |
| WebSocket Connection Timeout | integer(ms) | WebSocket handshake timeout | None |
| Stream Idle Timeout | integer(ms) | Max idle time allowed for single provider read | `300000` |
| Retry Strategy | object | Includes retry mode, retryable status codes, max attempts, backoff initial/ceiling, jitter ratio | `dsh-llm-retry` default |
| Per-Model Context | integer | Max context this model can carry | Inherited from route default or built-in model |
| Per-Model Max Output | integer | Model's max output capability, also used as default `maxTokens` for model requests | Inherited from route default or built-in model |
| Per-Model Input Modality | enum | Supported input type list (text/image) | Inherited from route default or built-in model |
| Per-Model Reasoning Effort | map | Select level from `off`/`minimal`/`low`/`medium`/`high`/`xhigh`/`max` and set corresponding "network spelling" | From models.dev match or user manual declaration |

> See `docs/llm-pi-ai-parameters.md` for complete field table of endpoint advanced parameters and per-model parameters.

## FAQ

**Q: Does this plugin conflict with DSH's built-in Models settings page?**

A: Under standard Web profile, both will be visible simultaneously. DSH design explicitly makes them mutually exclusive. This plugin can run independently after disabling the `ui-settings-models` line at profile level, otherwise two UIs will modify the same config (`src/client.js:1232`, `docs/model-config-plugin-design.md:188`).

**Q: Where is the API Key written, will it leak to `settings.yaml`?**

A: No. The plugin only writes credential references (like `MY_ENDPOINT_API_KEY`) through Harness's `credentials` service. The real key is only submitted once in memory and won't appear in plain text in `settings.yaml` or config preview (`package.json:5-7`, `README.md:18`).

**Q: Which API protocols are supported?**

A: Currently provides three dropdown options: `openai-completions`, `openai-responses`, `anthropic-messages`. When fetching model candidates, `anthropic-messages` will automatically be switched to OpenAI-compatible GET /models because model lists are generally in OpenAI format (`src/client.js:1375-1377`, `1181`).

**Q: Can it work normally when models.dev is unreachable?**

A: Yes. Endpoint-returned models can still be manually checked and edited, but context, output, input modality, and reasoning capabilities won't be auto-completed. After submission, it will prompt "Endpoint results still editable" (`src/client.js:136, 270, 1184`, `README.md:37`).

**Q: When editing a saved endpoint, if the API Key field is left blank, will it overwrite the original Key?**

A: No. Leaving blank means "continue using existing credentials". Only when a new value is filled will `credentials.set` be called to update (`docs/model-config-plugin-design.md:140`).

**Q: How to uninstall and update?**

A: Both require first remove then add:

```bash
dsh plugin --profile web remove dsh-models-config-plugin
dsh plugin --profile web add github:MarvekG/deepseek-harness-model-config
dsh web
```

(`README.md:62-77`)

**Q: When re-fetching models, will already checked ones be cleared?**

A: No. Already checked models keep their check status, newly appearing models are unchecked by default, models no longer returned by endpoint will also remain displayed to avoid accidental deletion during refresh (`src/client.js:1171-1174`, `README.md:13`).

**Q: Can I configure global custom Headers for an endpoint? Will they also be included when fetching models?**

A: Custom Headers can be added in endpoint advanced parameters, but Headers are only attached when calling models, not in GET /models requests (`README.md:30`, `docs/llm-pi-ai-parameters.md:37`).

## Difficulty
Beginner — Just fill in the form in Web UI, no manual YAML writing needed; understanding DSH's profile / plugin concepts and having a ready OpenAI/Anthropic-compatible gateway address is enough to get started.

## Known Issues & Limitations
- Model fetching only covers OpenAI-compatible `GET /models`; model lists for other protocols (like pure Anthropic protocol endpoints) require manual editing (`docs/model-config-plugin-design.md:225`)
- When models.dev doesn't provide reasoning info for a model, the UI won't guess capabilities for users; users need to add reasoning levels themselves (`docs/model-config-plugin-design.md:226`)
- Independent plugin form is mutually exclusive with DSH's built-in `ui-settings-models`: when enabling this plugin in profile, should disable the original Models settings line, otherwise both UIs will modify the same config simultaneously (`docs/model-config-plugin-design.md:188, 227`)
- Model discovery has a 4MB receive limit; 401/403 are attributed to credential issues, unreachable/non-JSON are categorized as "fetch failed" (`docs/model-config-plugin-design.md:198`)

---

This document is auto-generated by [deepseek-plugin.org](https://deepseek-plugin.org). HTML page: [deepseek-harness-model-config](https://deepseek-plugin.org/plugins/MarvekG/deepseek-harness-model-config)
Wiki generated by AI (model: `MiniMax-M2.5`)
