@mofeng2223/dsh-claude-provider 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -56
- package/README.zh-CN.md +77 -20
- package/cordis.patch.yml +0 -9
- package/lib/client.js +312 -217
- package/package.json +3 -3
- package/src/index.js +2 -241
package/README.md
CHANGED
|
@@ -2,83 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
`@mofeng2223/dsh-claude-provider`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
~~DeepSeek Harness's general-purpose reasoning controls did not fully match the request parameters required by newer Claude models. As a result, selecting a reasoning level could either produce an HTTP 400 error or be silently mapped by the adapter to a different effective level—for example, Max in the interface could actually be sent as High. `@mofeng2223/dsh-claude-provider` added an explicit Claude provider type and sent the correct reasoning parameters for each Claude model.~~
|
|
6
|
+
|
|
7
|
+
DeepSeek Harness 0.1.0-rc.8 now supports reasoning-effort parameters for Claude models, but they still need to be configured manually in `settings.yaml`. Therefore, this plugin no longer intercepts or rewrites model requests at runtime. Instead, it writes the corresponding native settings to `settings.yaml` when a Claude provider is saved through the front end.
|
|
8
|
+
|
|
9
|
+
The plugin retains its dedicated Claude provider configuration page, so users do not need to edit `settings.yaml` manually. Anthropic-native model discovery, automatic defaults for common Claude models, and other features not yet available in DeepSeek Harness are also retained.
|
|
10
|
+
|
|
11
|
+
## What this plugin does
|
|
12
|
+
|
|
13
|
+
1. **Adds a dedicated Claude provider type**
|
|
14
|
+
|
|
15
|
+
The Models settings page gains a separate **Claude Provider** form. You can create multiple Provider IDs under this type without mixing them with generic custom providers.
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="./docs/images/provider-entry.en.jpg" alt="Add Claude Provider entry in DeepSeek Harness" width="580">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
Selecting **Add Claude Provider** opens the dedicated Anthropic Messages form:
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="./docs/images/claude-provider-form.en.jpg" alt="Claude Provider form in DeepSeek Harness" width="580">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
2. **Adds model-specific reasoning modes**
|
|
28
|
+
|
|
29
|
+
Each model can use one of three configurable mode sets:
|
|
30
|
+
|
|
31
|
+
- Five levels: Low, Medium, High, XHigh, and Max
|
|
32
|
+
- Four levels: Low, Medium, High, and Max
|
|
33
|
+
- Toggle: On or Off
|
|
34
|
+
|
|
35
|
+
New models default to five levels, and Claude providers default to High.
|
|
36
|
+
|
|
37
|
+
~~For adaptive thinking models, the plugin converted the selected level into Claude's `thinking.type: adaptive` and `output_config.effort` request format, preventing adapter rejections or silent downgrades.~~
|
|
38
|
+
|
|
39
|
+
For adaptive thinking models, the plugin writes the selected level to DSH's native configuration when saved.
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<img src="./docs/images/model-defaults.en.jpg" alt="Claude model capacity defaults and reasoning modes" width="580">
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
3. **Adds native Anthropic model discovery**
|
|
46
|
+
|
|
47
|
+
DeepSeek Harness's generic custom provider cannot list models for the `anthropic-messages` protocol. This plugin adds model discovery for Claude providers through the provider's native Anthropic-compatible `GET /v1/models` endpoint, including cursor pagination.
|
|
48
|
+
|
|
49
|
+
4. **Fills known Claude model defaults after discovery**
|
|
50
|
+
|
|
51
|
+
When a discovered model matches a recorded Claude model ID, the plugin automatically fills its context window, maximum output length, and reasoning-mode set. Models entered manually remain fully editable and are not overwritten by this lookup.
|
|
52
|
+
|
|
53
|
+
5. **Uses native RC8 settings without request rewriting**
|
|
54
|
+
|
|
55
|
+
Discovery, defaults, and reasoning controls are limited to Provider IDs explicitly created as **Claude Providers**. The saved provider remains a standard `llm-pi-ai` route; the plugin neither replaces global `fetch` nor modifies RC8's model adapter.
|
|
34
56
|
|
|
35
57
|
## Install
|
|
36
58
|
|
|
37
|
-
|
|
38
|
-
|
|
59
|
+
### Published package
|
|
60
|
+
|
|
61
|
+
Install the Web profile for the browser interface:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Install the Headless profile for command-line runs without the Web interface:
|
|
39
68
|
|
|
40
69
|
```sh
|
|
70
|
+
npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Restart the corresponding DeepSeek Harness process after installation.
|
|
74
|
+
|
|
75
|
+
### From source
|
|
76
|
+
|
|
77
|
+
Build and package the repository first:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
git clone https://github.com/MoFeng2223/dsh-claude-provider.git
|
|
81
|
+
cd dsh-claude-provider
|
|
82
|
+
npm install
|
|
41
83
|
npm run build
|
|
84
|
+
mkdir -p dist
|
|
42
85
|
npm pack --pack-destination dist
|
|
43
86
|
```
|
|
44
87
|
|
|
45
|
-
Install the
|
|
88
|
+
Install the generated package into the Web profile:
|
|
46
89
|
|
|
47
90
|
```sh
|
|
48
|
-
npx @deepseek-ai/dsh plugin --profile web add
|
|
49
|
-
npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
|
|
91
|
+
npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
|
|
50
92
|
```
|
|
51
93
|
|
|
52
|
-
|
|
94
|
+
Or install it into the Headless profile:
|
|
53
95
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Archive installs are package-manager-owned and uninstall without those stale
|
|
58
|
-
links.
|
|
96
|
+
```sh
|
|
97
|
+
npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
|
|
98
|
+
```
|
|
59
99
|
|
|
60
|
-
|
|
61
|
-
each rewritten request. The diagnostic contains only provider, model, and
|
|
62
|
-
selected effort.
|
|
100
|
+
## Uninstall
|
|
63
101
|
|
|
64
|
-
|
|
102
|
+
Run the command for each profile where the plugin was installed:
|
|
65
103
|
|
|
66
104
|
```sh
|
|
67
105
|
npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
|
|
68
106
|
npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
|
|
69
107
|
```
|
|
70
108
|
|
|
71
|
-
|
|
72
|
-
alone. Existing Claude-type providers therefore remain visible as ordinary custom
|
|
73
|
-
`anthropic-messages` routes, but lose this plugin's Claude badge, per-model
|
|
74
|
-
thinking-mode controls, native Anthropic model discovery, and adaptive request
|
|
75
|
-
rewrite.
|
|
109
|
+
Uninstalling the plugin does not delete `~/.dsh/settings.yaml` or stored credentials. Existing Claude providers remain ordinary custom `anthropic-messages` routes. Their `reasoningEfforts`, default `reasoning`, and `compat.forceAdaptiveThinking` fields are native RC8 settings, so adaptive thinking and the front-end reasoning-effort selector continue to work. Only the dedicated Claude add/edit UI, model discovery, and recorded defaults disappear.
|
|
76
110
|
|
|
77
|
-
|
|
78
|
-
typed into the form or resolves the existing route's credential through DSH;
|
|
79
|
-
the value is sent only to that route's Anthropic Models API. Its request
|
|
80
|
-
transformer runs only inside `llm/stream` calls for Provider IDs explicitly
|
|
81
|
-
registered under this plugin's type and leaves every other provider untouched.
|
|
111
|
+
## License
|
|
82
112
|
|
|
83
|
-
|
|
84
|
-
its local path; no source build or platform-specific dependency is required.
|
|
113
|
+
[MIT](./LICENSE)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,55 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
~~DeepSeek Harness 的通用推理强度控制与新版 Claude 模型要求的请求参数并不完全匹配,因此选择某个档位后,可能直接出现 HTTP 400,也可能被适配器静默映射成另一个实际档位,例如界面选择 Max,实际请求却只相当于 High。`@mofeng2223/dsh-claude-provider` 增加了一个明确的 Claude 提供方类型,并按照每个 Claude 模型的配置发送正确的推理参数。~~
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
DeepSeek Harness 0.1.0-rc.8 已支持 Claude 系列模型的推理强度参数,但仍需要在 `settings.yaml` 中手动配置。因此,本插件不再在运行时拦截或改写模型请求,而是在用户通过前端保存 Claude 提供方时,将相应的原生配置正确写入 `settings.yaml`。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
插件仍保留专用的 Claude 提供方配置页面,用户无需手动编辑 `settings.yaml`。Anthropic 原生模型探测、常用 Claude 模型参数自动填写等官方尚未实现的功能也继续保留。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## 插件功能
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. **增加独立的 Claude 提供方类型**
|
|
14
|
+
|
|
15
|
+
模型设置页面会增加单独的“Claude 提供方”表单。你可以在这个类型下创建多个 Provider ID,不会与普通自定义提供方混在一起。
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="./docs/images/provider-entry.jpg" alt="DeepSeek Harness 中新增的 Claude 提供方入口" width="580">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
点击“添加 Claude 提供方”后,会打开独立的 Anthropic Messages 配置表单:
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="./docs/images/claude-provider-form.jpg" alt="DeepSeek Harness 中的 Claude 提供方表单" width="580">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
2. **增加按模型设置的推理模式**
|
|
28
|
+
|
|
29
|
+
每个模型可以单独选择以下三种档位配置之一:
|
|
30
|
+
|
|
31
|
+
- 五档:Low、Medium、High、XHigh、Max
|
|
32
|
+
- 四档:Low、Medium、High、Max
|
|
33
|
+
- 开关:On、Off
|
|
34
|
+
|
|
35
|
+
新增模型默认使用五档,Claude 提供方默认选择 High。
|
|
36
|
+
|
|
37
|
+
~~对于 adaptive thinking 模型,插件会把所选档位转换成 Claude 使用的 `thinking.type: adaptive` 与 `output_config.effort` 请求格式,避免适配器拒绝请求或把档位降级。~~
|
|
38
|
+
|
|
39
|
+
对于 adaptive thinking 模型,插件会在保存时将所选档位写入 dsh 原生配置。
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<img src="./docs/images/model-defaults.jpg" alt="Claude 模型容量预填与思考模式设置" width="580">
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
3. **补充 Anthropic 原生模型探测**
|
|
46
|
+
|
|
47
|
+
DeepSeek Harness 的普通自定义提供方在使用 `anthropic-messages` 协议时无法获取模型列表。本插件为 Claude 提供方增加了基于 Anthropic 兼容 `GET /v1/models` 接口的模型探测,并支持游标分页。
|
|
48
|
+
|
|
49
|
+
4. **探测后自动填写常用 Claude 模型参数**
|
|
50
|
+
|
|
51
|
+
探测到的模型 ID 如果与插件已经记录的 Claude 模型匹配,插件会自动填写上下文窗口、最大输出长度和推理模式。用户手动添加的模型仍然可以自由编辑,不会被这项自动匹配覆盖。
|
|
52
|
+
|
|
53
|
+
5. **使用 RC8 原生配置,不改写请求**
|
|
54
|
+
|
|
55
|
+
模型探测、参数预填和推理档位只对明确创建为“Claude 提供方”的 Provider ID 生效。保存后的提供方仍是标准 `llm-pi-ai` 路由;插件不会替换全局 `fetch`,也不会修改 RC8 的模型适配器。
|
|
14
56
|
|
|
15
57
|
## 安装
|
|
16
58
|
|
|
17
|
-
|
|
59
|
+
### 安装已发布的版本
|
|
60
|
+
|
|
61
|
+
浏览器界面使用 Web Profile:
|
|
18
62
|
|
|
19
63
|
```sh
|
|
20
64
|
npx @deepseek-ai/dsh plugin --profile web add @mofeng2223/dsh-claude-provider
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
不使用 Web 界面的命令行运行使用 Headless Profile:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
21
70
|
npx @deepseek-ai/dsh plugin --profile headless add @mofeng2223/dsh-claude-provider
|
|
22
71
|
```
|
|
23
72
|
|
|
24
|
-
|
|
73
|
+
安装后需要重启对应的 DeepSeek Harness 进程。
|
|
25
74
|
|
|
26
|
-
|
|
75
|
+
### 从源码安装
|
|
76
|
+
|
|
77
|
+
先克隆、构建并打包项目:
|
|
27
78
|
|
|
28
79
|
```sh
|
|
80
|
+
git clone https://github.com/MoFeng2223/dsh-claude-provider.git
|
|
81
|
+
cd dsh-claude-provider
|
|
82
|
+
npm install
|
|
29
83
|
npm run build
|
|
84
|
+
mkdir -p dist
|
|
30
85
|
npm pack --pack-destination dist
|
|
31
86
|
```
|
|
32
87
|
|
|
33
|
-
|
|
88
|
+
将生成的包安装到 Web Profile:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npx @deepseek-ai/dsh plugin --profile web add ./dist/mofeng2223-dsh-claude-provider-*.tgz
|
|
92
|
+
```
|
|
34
93
|
|
|
35
|
-
|
|
94
|
+
或者安装到 Headless Profile:
|
|
36
95
|
|
|
37
|
-
|
|
96
|
+
```sh
|
|
97
|
+
npx @deepseek-ai/dsh plugin --profile headless add ./dist/mofeng2223-dsh-claude-provider-*.tgz
|
|
98
|
+
```
|
|
38
99
|
|
|
39
100
|
## 卸载
|
|
40
101
|
|
|
102
|
+
插件安装在哪个 Profile,就执行对应的卸载命令:
|
|
103
|
+
|
|
41
104
|
```sh
|
|
42
105
|
npx @deepseek-ai/dsh plugin --profile web remove @mofeng2223/dsh-claude-provider
|
|
43
106
|
npx @deepseek-ai/dsh plugin --profile headless remove @mofeng2223/dsh-claude-provider
|
|
44
107
|
```
|
|
45
108
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## 安全与隐私
|
|
49
|
-
|
|
50
|
-
插件不会存储或记录 API 密钥。获取模型列表时,插件会使用表单中临时输入的密钥,或者通过 DSH 解析现有路由保存的凭据。密钥只会发送到该路由对应的 Anthropic Models API。
|
|
51
|
-
|
|
52
|
-
请求转换器只会在明确登记到本插件类型的 Provider ID 所对应的 `llm/stream` 调用中运行,不会修改任何其他提供方。
|
|
109
|
+
卸载插件不会删除 `~/.dsh/settings.yaml` 或已经保存的凭据。已有的 Claude 提供方会继续作为普通的 `anthropic-messages` 自定义路由保留;`reasoningEfforts`、默认 `reasoning` 和 `compat.forceAdaptiveThinking` 都是 RC8 原生字段,因此自适应思考和前端推理等级选择仍然有效。卸载后只会失去 Claude 专用的添加/编辑界面、模型探测和参数预填。
|
|
53
110
|
|
|
54
|
-
##
|
|
111
|
+
## 许可证
|
|
55
112
|
|
|
56
|
-
|
|
113
|
+
[MIT](./LICENSE)
|
package/cordis.patch.yml
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
- insert:
|
|
2
2
|
- id: claude-provider
|
|
3
3
|
name: '@mofeng2223/dsh-claude-provider'
|
|
4
|
-
config:
|
|
5
|
-
debug: !!js process.env.DSH_CLAUDE_PROVIDER_DEBUG === '1'
|
|
6
|
-
effortMap:
|
|
7
|
-
minimal: low
|
|
8
|
-
low: low
|
|
9
|
-
medium: medium
|
|
10
|
-
high: high
|
|
11
|
-
xhigh: xhigh
|
|
12
|
-
max: max
|
|
13
4
|
- id: ui-settings-models
|
|
14
5
|
disabled: true
|