cheap-llm-mcp 0.1.1 → 0.1.3
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/.env.example +3 -1
- package/CHANGELOG.md +16 -0
- package/README.en.md +210 -0
- package/README.md +154 -199
- package/README.zh-CN.md +36 -10
- package/codex-config.example.toml +3 -1
- package/dist/chat.js +3 -3
- package/dist/chat.js.map +1 -1
- package/dist/providers.d.ts +7 -0
- package/dist/providers.js +31 -14
- package/dist/providers.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/setup.d.ts +7 -0
- package/dist/setup.js +86 -8
- package/dist/setup.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +5 -4
package/.env.example
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
CHEAP_LLM_API_KEY=sk-...
|
|
2
2
|
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
3
|
-
CHEAP_LLM_MODEL=deepseek-
|
|
3
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
4
4
|
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
5
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
6
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
5
7
|
|
|
6
8
|
SIMPLE_LLM_CHINESE_DEFAULT=true
|
|
7
9
|
SIMPLE_LLM_STABILITY_DEFAULT=true
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
- Made the GitHub homepage README Chinese-first with a separate English docs link.
|
|
6
|
+
- Added an optional tiny public API connectivity test to the setup wizard.
|
|
7
|
+
- Added Qwen / Alibaba Cloud Bailian to the setup wizard and documented it as a first-class domestic model preset.
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
- Added explicit DeepSeek and Xiaomi MiMo setup presets.
|
|
12
|
+
- Added configurable API-key auth headers for providers that use `api-key` instead of `Authorization: Bearer`.
|
|
13
|
+
- Updated docs and examples to separate tested presets from generic OpenAI-compatible endpoints.
|
|
14
|
+
|
|
15
|
+
## 0.1.1
|
|
16
|
+
|
|
17
|
+
- Redacted API keys in setup command previews, running logs, and fallback config output.
|
|
18
|
+
|
|
3
19
|
## 0.1.0
|
|
4
20
|
|
|
5
21
|
- Initial productized MCP server.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# cheap-llm-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/cheap-llm-mcp)
|
|
4
|
+
[](https://github.com/stBlackCat/cheap-llm-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
Still worried about GPT Plus limits? Still watching your Claude subscription tokens burn on tiny chores?
|
|
9
|
+
|
|
10
|
+
`cheap-llm-mcp` solves a big chunk of that pain: use cheap AI for cheap work, while your premium model stays in charge.
|
|
11
|
+
|
|
12
|
+
[Chinese homepage](README.md)
|
|
13
|
+
|
|
14
|
+
This is a local stdio MCP server for Claude Code, Codex, and other MCP clients. It routes simple, low-risk, self-contained tasks to tested DeepSeek, Xiaomi MiMo, and Qwen / Alibaba Cloud Bailian presets, or to a custom OpenAI-compatible chat completions API. Your main AI still plans, reviews, edits, and decides. The cheap model just handles small drafts.
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
|
|
18
|
+
Install the MCP server first:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx -y cheap-llm-mcp@latest setup
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then fill in one OpenAI-compatible endpoint. The setup wizard can also send a tiny public connectivity test after you enter the API key.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
28
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
29
|
+
CHEAP_LLM_API_KEY=sk-...
|
|
30
|
+
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
31
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
32
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
DeepSeek, Xiaomi MiMo, and Qwen are first-class presets. Other OpenAI-compatible providers may work when they expose a compatible chat completions endpoint and use a supported API-key header.
|
|
36
|
+
|
|
37
|
+
Check your setup:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx -y cheap-llm-mcp@latest doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Print manual config:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx -y cheap-llm-mcp@latest config
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Claude Code
|
|
50
|
+
|
|
51
|
+
The setup wizard can run this after confirmation:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude mcp add --transport stdio --scope user \
|
|
55
|
+
--env CHEAP_LLM_API_KEY=sk-... \
|
|
56
|
+
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
57
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
58
|
+
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
59
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
60
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
61
|
+
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
62
|
+
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
63
|
+
cheap-llm -- npx -y cheap-llm-mcp@latest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Restart Claude Code and run:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
/mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Codex
|
|
73
|
+
|
|
74
|
+
The setup wizard can run this after confirmation:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
codex mcp add cheap-llm \
|
|
78
|
+
--env CHEAP_LLM_API_KEY=sk-... \
|
|
79
|
+
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
80
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
81
|
+
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
82
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
83
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
84
|
+
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
85
|
+
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
86
|
+
-- npx -y cheap-llm-mcp@latest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Restart Codex and verify:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
codex mcp list
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If `codex mcp add` is unavailable, run:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx -y cheap-llm-mcp@latest config
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then paste the printed TOML into `~/.codex/config.toml`.
|
|
102
|
+
|
|
103
|
+
## What should be delegated?
|
|
104
|
+
|
|
105
|
+
Good cheap-model tasks:
|
|
106
|
+
|
|
107
|
+
- summarize a short note
|
|
108
|
+
- translate or rewrite text
|
|
109
|
+
- classify a small snippet
|
|
110
|
+
- extract fields into JSON
|
|
111
|
+
- draft a regex
|
|
112
|
+
- explain a short command
|
|
113
|
+
- produce a tiny isolated code snippet
|
|
114
|
+
|
|
115
|
+
Bad cheap-model tasks:
|
|
116
|
+
|
|
117
|
+
- decide architecture
|
|
118
|
+
- edit your repo directly
|
|
119
|
+
- review security-sensitive code
|
|
120
|
+
- reason over a full private codebase
|
|
121
|
+
- handle secrets or sensitive data
|
|
122
|
+
- debug complex cross-file behavior
|
|
123
|
+
|
|
124
|
+
## Stability Without Wasting Tokens
|
|
125
|
+
|
|
126
|
+
Cheap models are useful, but they are not the boss.
|
|
127
|
+
|
|
128
|
+
`cheap-llm-mcp` adds a compact default instruction that tells the cheap model to return a concise draft only, avoid final decisions, avoid pretending it edited files, avoid guessing missing facts, and say `UNCERTAIN` when the task is ambiguous.
|
|
129
|
+
|
|
130
|
+
The MCP tool description also tells the host AI to lightly review the result against the original task before using it. This keeps the premium model in control without asking the cheap model to produce long self-review reports.
|
|
131
|
+
|
|
132
|
+
## OpenAI-Compatible Config
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
CHEAP_LLM_BASE_URL=https://your-provider.example/v1
|
|
136
|
+
CHEAP_LLM_MODEL=your-cheap-model
|
|
137
|
+
CHEAP_LLM_API_KEY=your-api-key
|
|
138
|
+
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
139
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
140
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Tested presets:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# DeepSeek
|
|
147
|
+
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
148
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
149
|
+
|
|
150
|
+
# Xiaomi MiMo
|
|
151
|
+
CHEAP_LLM_BASE_URL=https://api.xiaomimimo.com/v1
|
|
152
|
+
CHEAP_LLM_MODEL=mimo-v2.5-pro
|
|
153
|
+
|
|
154
|
+
# Qwen / Alibaba Cloud Bailian
|
|
155
|
+
CHEAP_LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
|
|
156
|
+
CHEAP_LLM_MODEL=qwen-plus
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Xiaomi MiMo also documents an `api-key` header. To switch to that form:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
CHEAP_LLM_API_KEY_HEADER=api-key
|
|
163
|
+
CHEAP_LLM_API_KEY_PREFIX=none
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Qwen / Alibaba Cloud Bailian uses the DashScope OpenAI-compatible endpoint: `https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions`, with `qwen-plus` as the default model.
|
|
167
|
+
|
|
168
|
+
Reference docs: [DeepSeek API](https://api-docs.deepseek.com/zh-cn/), [Xiaomi MiMo first API call](https://platform.xiaomimimo.com/docs/zh-CN/quick-start/first-api-call), and [Alibaba Cloud Model Studio Qwen API](https://www.alibabacloud.com/help/en/model-studio/use-qwen-by-calling-api).
|
|
169
|
+
|
|
170
|
+
## Token Savings
|
|
171
|
+
|
|
172
|
+
Run the MCP tool `get_token_savings` to see how many provider-reported tokens were handled by cheap models during the current MCP server session.
|
|
173
|
+
|
|
174
|
+
For a persistent audit trail, set:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
SIMPLE_LLM_USAGE_LOG=/path/to/cheap-llm-usage.jsonl
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The usage log records provider, model, token counts, and timestamp only. It does not record prompts or model outputs.
|
|
181
|
+
|
|
182
|
+
## Safety Defaults
|
|
183
|
+
|
|
184
|
+
- Calls require `approvedForExternalApi=true`.
|
|
185
|
+
- Calls require `dataClassification`.
|
|
186
|
+
- `dataClassification=sensitive` is rejected.
|
|
187
|
+
- Common secret patterns are rejected.
|
|
188
|
+
- HTTP providers are rejected unless `SIMPLE_LLM_ALLOW_HTTP=true`.
|
|
189
|
+
- Prompt size is capped by `SIMPLE_LLM_MAX_PROMPT_CHARS` (default: `12000`).
|
|
190
|
+
- Requests time out via `SIMPLE_LLM_TIMEOUT_MS` (default: `60000`).
|
|
191
|
+
- Provider errors are redacted before being returned.
|
|
192
|
+
|
|
193
|
+
## Chinese Default
|
|
194
|
+
|
|
195
|
+
Chinese-first output is enabled by default:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
SIMPLE_LLM_CHINESE_DEFAULT=true
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Development
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm install
|
|
205
|
+
npm run ci
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,243 +1,198 @@
|
|
|
1
|
-
# cheap-llm-mcp
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/cheap-llm-mcp)
|
|
4
|
-
[](https://github.com/stBlackCat/cheap-llm-mcp/actions/workflows/ci.yml)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
# cheap-llm-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/cheap-llm-mcp)
|
|
4
|
+
[](https://github.com/stBlackCat/cheap-llm-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
[English docs](README.en.md)
|
|
9
|
+
|
|
10
|
+
还在为 GPT Plus 的额度发愁?还在心疼自己的 Claude 会员 token 太贵?
|
|
11
|
+
|
|
12
|
+
这个 MCP 可以解决你的大部分小任务成本问题:用便宜的 AI 做便宜的事情,让贵的主模型继续负责统筹、审查和最终决策。
|
|
13
|
+
|
|
14
|
+
`cheap-llm-mcp` 是一个本地 stdio MCP server,适用于 Claude Code、Codex 和其他 MCP 客户端。它可以把摘要、翻译、分类、抽取、小段代码等低风险任务交给国产低成本模型分流处理。内置预设包括 DeepSeek、Xiaomi MiMo 和 Qwen / 阿里云百炼,也可以接入你自己填写的 OpenAI-compatible API。
|
|
15
|
+
|
|
16
|
+
## 快速开始
|
|
17
|
+
|
|
18
|
+
先一键安装 MCP:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npx -y cheap-llm-mcp@latest setup
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
向导会让你选择客户端、provider 预设、模型和 API key。填完 API key 后,它可以立刻发一个极小的公开 ping 测试接口连通性,不发送你的项目内容。
|
|
25
|
+
|
|
26
|
+
手动配置时,核心就是这几项:
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
29
|
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
28
|
-
CHEAP_LLM_MODEL=deepseek-
|
|
30
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
29
31
|
CHEAP_LLM_API_KEY=sk-...
|
|
30
32
|
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
33
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
34
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
DeepSeek、Xiaomi MiMo 和 Qwen 是明确支持的国产模型预设;其他平台只要提供兼容 chat completions 的接口,并且鉴权头能按下面的格式配置,就可以按自定义 OpenAI-compatible 接口尝试。
|
|
38
|
+
|
|
39
|
+
检查配置:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx -y cheap-llm-mcp@latest doctor
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
打印手动配置:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx -y cheap-llm-mcp@latest config
|
|
31
49
|
```
|
|
32
50
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npx -y cheap-llm-mcp@latest doctor
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Print manual config:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npx -y cheap-llm-mcp@latest config
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Claude Code
|
|
48
|
-
|
|
49
|
-
The setup wizard can run this after confirmation:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
51
|
+
## Claude Code
|
|
52
|
+
|
|
53
|
+
向导会在你确认后执行类似命令:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
52
56
|
claude mcp add --transport stdio --scope user \
|
|
53
57
|
--env CHEAP_LLM_API_KEY=sk-... \
|
|
54
58
|
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
55
|
-
--env CHEAP_LLM_MODEL=deepseek-
|
|
59
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
56
60
|
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
61
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
62
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
57
63
|
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
58
64
|
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
59
|
-
cheap-llm -- npx -y cheap-llm-mcp@latest
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```text
|
|
65
|
-
/mcp
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Codex
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```bash
|
|
65
|
+
cheap-llm -- npx -y cheap-llm-mcp@latest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
重启 Claude Code 后运行:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
/mcp
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Codex
|
|
75
|
+
|
|
76
|
+
向导会在你确认后执行类似命令:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
73
79
|
codex mcp add cheap-llm \
|
|
74
80
|
--env CHEAP_LLM_API_KEY=sk-... \
|
|
75
81
|
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
76
|
-
--env CHEAP_LLM_MODEL=deepseek-
|
|
82
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
77
83
|
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
84
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
85
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
78
86
|
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
79
87
|
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
80
|
-
-- npx -y cheap-llm-mcp@latest
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
If `codex mcp add` is unavailable, run:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npx -y cheap-llm-mcp@latest config
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Then paste the printed TOML into `~/.codex/config.toml`.
|
|
96
|
-
|
|
97
|
-
## What should be delegated?
|
|
98
|
-
|
|
99
|
-
Good cheap-model tasks:
|
|
100
|
-
|
|
101
|
-
- summarize a short note
|
|
102
|
-
- translate or rewrite text
|
|
103
|
-
- classify a small snippet
|
|
104
|
-
- extract fields into JSON
|
|
105
|
-
- draft a regex
|
|
106
|
-
- explain a short command
|
|
107
|
-
- produce a tiny isolated code snippet
|
|
108
|
-
|
|
109
|
-
Bad cheap-model tasks:
|
|
110
|
-
|
|
111
|
-
- decide architecture
|
|
112
|
-
- edit your repo directly
|
|
113
|
-
- review security-sensitive code
|
|
114
|
-
- reason over a full private codebase
|
|
115
|
-
- handle secrets or sensitive data
|
|
116
|
-
- debug complex cross-file behavior
|
|
117
|
-
|
|
118
|
-
## Stability without wasting tokens
|
|
119
|
-
|
|
120
|
-
Cheap models are useful, but they are not the boss.
|
|
121
|
-
|
|
122
|
-
`cheap-llm-mcp` adds a compact default instruction that tells the cheap model to:
|
|
123
|
-
|
|
124
|
-
- return a concise draft only
|
|
125
|
-
- avoid final decisions
|
|
126
|
-
- avoid pretending it edited files
|
|
127
|
-
- avoid guessing missing facts
|
|
128
|
-
- say `UNCERTAIN` when the task is ambiguous
|
|
129
|
-
|
|
130
|
-
The MCP tool description also tells the host AI to lightly review the result against the original task before using it. This keeps the premium model in control without asking the cheap model to produce long self-review reports.
|
|
131
|
-
|
|
132
|
-
Disable this default only if you know what you are doing:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
SIMPLE_LLM_STABILITY_DEFAULT=false
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## 30-second demo
|
|
139
|
-
|
|
140
|
-
1. Run `npx -y cheap-llm-mcp@latest setup`.
|
|
141
|
-
2. Restart Claude Code or Codex.
|
|
142
|
-
3. Ask: "Use the cheap LLM MCP to summarize this short text."
|
|
143
|
-
4. Your host AI delegates the small task, then checks the draft before using it.
|
|
144
|
-
|
|
145
|
-
Available tools:
|
|
146
|
-
|
|
147
|
-
- `ask_simple_model`: call a configured cheap model for a self-contained task.
|
|
148
|
-
- `list_simple_model_providers`: show configured providers without leaking API keys.
|
|
149
|
-
- `check_simple_model_setup`: validate local provider configuration without making a model request.
|
|
150
|
-
- `get_token_savings`: show how many provider-reported tokens were routed to cheap models.
|
|
151
|
-
|
|
152
|
-
## OpenAI-compatible config
|
|
153
|
-
|
|
154
|
-
The recommended config is intentionally boring:
|
|
88
|
+
-- npx -y cheap-llm-mcp@latest
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
如果命令不可用,运行 `npx -y cheap-llm-mcp@latest config`,把输出的 TOML 写入 `~/.codex/config.toml`。
|
|
92
|
+
|
|
93
|
+
## 配置格式
|
|
94
|
+
|
|
95
|
+
推荐路径就是这几项:
|
|
155
96
|
|
|
156
97
|
```bash
|
|
157
98
|
CHEAP_LLM_BASE_URL=https://your-provider.example/v1
|
|
158
99
|
CHEAP_LLM_MODEL=your-cheap-model
|
|
159
100
|
CHEAP_LLM_API_KEY=your-api-key
|
|
160
101
|
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
102
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
103
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
161
104
|
```
|
|
162
105
|
|
|
163
|
-
|
|
106
|
+
已明确支持的预设:
|
|
164
107
|
|
|
165
108
|
```bash
|
|
166
109
|
# DeepSeek
|
|
167
110
|
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
168
|
-
CHEAP_LLM_MODEL=deepseek-
|
|
111
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
169
112
|
|
|
170
|
-
#
|
|
113
|
+
# Xiaomi MiMo
|
|
114
|
+
CHEAP_LLM_BASE_URL=https://api.xiaomimimo.com/v1
|
|
115
|
+
CHEAP_LLM_MODEL=mimo-v2.5-pro
|
|
116
|
+
|
|
117
|
+
# Qwen / 阿里云百炼
|
|
171
118
|
CHEAP_LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
|
|
172
119
|
CHEAP_LLM_MODEL=qwen-plus
|
|
173
120
|
|
|
174
|
-
#
|
|
121
|
+
# 其他 OpenAI-compatible 网关
|
|
175
122
|
CHEAP_LLM_BASE_URL=https://example.com/v1
|
|
176
123
|
CHEAP_LLM_MODEL=model-id
|
|
177
124
|
```
|
|
178
125
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
126
|
+
DeepSeek 使用 `Authorization: Bearer ...`,接口是 `https://api.deepseek.com/chat/completions`。Xiaomi MiMo 的 OpenAI-compatible 接口是 `https://api.xiaomimimo.com/v1/chat/completions`;小米文档同时支持 `Authorization: Bearer ...` 和 `api-key` 头。如果你要切到 `api-key` 头,配置:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
CHEAP_LLM_API_KEY_HEADER=api-key
|
|
130
|
+
CHEAP_LLM_API_KEY_PREFIX=none
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Qwen / 阿里云百炼使用 DashScope OpenAI-compatible endpoint:`https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions`,默认模型是 `qwen-plus`。
|
|
134
|
+
|
|
135
|
+
参考文档:[DeepSeek API](https://api-docs.deepseek.com/zh-cn/)、[Xiaomi MiMo 首次调用 API](https://platform.xiaomimimo.com/docs/zh-CN/quick-start/first-api-call) 和 [Alibaba Cloud Model Studio Qwen API](https://www.alibabacloud.com/help/en/model-studio/use-qwen-by-calling-api)。
|
|
136
|
+
|
|
137
|
+
高级用户仍然可以用 `SIMPLE_LLM_PROVIDERS` 配多个具名 provider,但默认体验就是一个便宜的 OpenAI-compatible endpoint。
|
|
138
|
+
|
|
139
|
+
## 什么任务适合外包?
|
|
140
|
+
|
|
141
|
+
适合:短文本摘要、翻译润色、简单分类、小段信息抽取成 JSON、正则草稿、简短命令解释、独立小代码片段。
|
|
142
|
+
|
|
143
|
+
不适合:架构决策、直接修改仓库、安全敏感代码审查、完整私有代码库上下文推理、密钥或敏感数据、复杂跨文件调试。
|
|
144
|
+
|
|
145
|
+
## 稳定性控制,但不浪费 token
|
|
146
|
+
|
|
147
|
+
便宜模型可以干活,但不能当负责人。
|
|
148
|
+
|
|
149
|
+
`cheap-llm-mcp` 默认会给便宜模型加一条很短的稳定性约束:只输出简洁草案,不做最终决策,不假装已经修改文件,不乱猜缺失事实,遇到不确定任务时用 `UNCERTAIN` 说明。
|
|
150
|
+
|
|
151
|
+
同时,MCP 工具描述会要求 Codex 或 Claude Code 的主 AI 对结果进行轻量审查:只对照原任务核对是否可用,不额外发大段上下文,也不默认让便宜模型再自我审查一遍。这样既能提升稳定性,也不会把省下来的 token 又花回去。
|
|
152
|
+
|
|
153
|
+
## Token 节省统计
|
|
154
|
+
|
|
155
|
+
运行 MCP 工具 `get_token_savings`,可以看到当前 MCP server 会话里实际有多少 token 被低费用模型处理了。
|
|
156
|
+
|
|
157
|
+
它会统计低费用模型的 prompt、completion、total token,按 provider/model 分组,并给出粗略的 `estimatedPremiumTokensAvoided`。这里默认只统计 token,不硬编码价格表,因为各家模型价格经常变。
|
|
158
|
+
|
|
159
|
+
## 默认中文约束
|
|
160
|
+
|
|
161
|
+
默认开启:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
SIMPLE_LLM_CHINESE_DEFAULT=true
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
MCP 会自动注入中文优先 system prompt:默认使用简体中文回答,但保留代码、命令、文件路径、API 名称、模型名称、错误信息、配置键和英文技术术语原文。
|
|
168
|
+
|
|
169
|
+
## 安全边界
|
|
170
|
+
|
|
171
|
+
这个 MCP 只适合低风险、可自包含的小任务:
|
|
172
|
+
|
|
173
|
+
- 必须显式确认 `approvedForExternalApi=true`
|
|
174
|
+
- 必须提供 `dataClassification`
|
|
175
|
+
- `sensitive` 数据会直接拒绝
|
|
176
|
+
- 自动扫描常见 API key、token、password、AWS key、private key
|
|
177
|
+
- 默认只允许 HTTPS provider
|
|
178
|
+
- 默认 prompt 上限是 12000 字符
|
|
179
|
+
- 默认请求超时是 60000ms
|
|
180
|
+
- provider 错误会脱敏后返回
|
|
181
|
+
- setup 连通性测试只发送固定 public ping,不发送你的仓库、需求或业务数据
|
|
182
|
+
|
|
183
|
+
不要把密钥、敏感客户数据、完整私有仓库上下文、安全判断、复杂架构决策、大规模重构交给外部便宜模型。
|
|
184
|
+
|
|
185
|
+
## 为什么不是直接换小模型?
|
|
186
|
+
|
|
187
|
+
直接把主模型换小,省了 token,但规划、判断、安全边界、工具编排都会变弱。`cheap-llm-mcp` 的思路是强模型继续当负责人,只把小而明确的任务转交出去。
|
|
188
|
+
|
|
189
|
+
## 开发
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm install
|
|
193
|
+
npm run ci
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
package/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
这个 MCP 可以解决你的大部分小任务成本问题:用便宜的 AI 做便宜的事情,让贵的主模型继续负责统筹、审查和最终决策。
|
|
6
6
|
|
|
7
|
-
`cheap-llm-mcp` 是一个本地 stdio MCP server,适用于 Claude Code、Codex 和其他 MCP
|
|
7
|
+
`cheap-llm-mcp` 是一个本地 stdio MCP server,适用于 Claude Code、Codex 和其他 MCP 客户端。它可以把摘要、翻译、分类、抽取、小段代码等低风险任务交给国产低成本模型分流处理。内置预设包括 DeepSeek、Xiaomi MiMo 和 Qwen / 阿里云百炼,也可以接入你自己填写的 OpenAI-compatible API。
|
|
8
8
|
|
|
9
9
|
## 快速开始
|
|
10
10
|
|
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
npx -y cheap-llm-mcp@latest setup
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
向导会让你选择客户端、provider 预设、模型和 API key。填完 API key 后,它可以立刻发一个极小的公开 ping 测试接口连通性,不发送你的项目内容。
|
|
18
|
+
|
|
19
|
+
手动配置时,核心就是这几项:
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
22
|
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
21
|
-
CHEAP_LLM_MODEL=deepseek-
|
|
23
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
22
24
|
CHEAP_LLM_API_KEY=sk-...
|
|
23
25
|
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
26
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
27
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
24
28
|
```
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
DeepSeek、Xiaomi MiMo 和 Qwen 是明确支持的国产模型预设;其他平台只要提供兼容 chat completions 的接口,并且鉴权头能按下面的格式配置,就可以按自定义 OpenAI-compatible 接口尝试。
|
|
27
31
|
|
|
28
32
|
检查配置:
|
|
29
33
|
|
|
@@ -45,8 +49,10 @@ npx -y cheap-llm-mcp@latest config
|
|
|
45
49
|
claude mcp add --transport stdio --scope user \
|
|
46
50
|
--env CHEAP_LLM_API_KEY=sk-... \
|
|
47
51
|
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
48
|
-
--env CHEAP_LLM_MODEL=deepseek-
|
|
52
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
49
53
|
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
54
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
55
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
50
56
|
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
51
57
|
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
52
58
|
cheap-llm -- npx -y cheap-llm-mcp@latest
|
|
@@ -66,8 +72,10 @@ claude mcp add --transport stdio --scope user \
|
|
|
66
72
|
codex mcp add cheap-llm \
|
|
67
73
|
--env CHEAP_LLM_API_KEY=sk-... \
|
|
68
74
|
--env CHEAP_LLM_BASE_URL=https://api.deepseek.com \
|
|
69
|
-
--env CHEAP_LLM_MODEL=deepseek-
|
|
75
|
+
--env CHEAP_LLM_MODEL=deepseek-v4-flash \
|
|
70
76
|
--env CHEAP_LLM_CHAT_PATH=/chat/completions \
|
|
77
|
+
--env CHEAP_LLM_API_KEY_HEADER=Authorization \
|
|
78
|
+
--env CHEAP_LLM_API_KEY_PREFIX=Bearer \
|
|
71
79
|
--env SIMPLE_LLM_CHINESE_DEFAULT=true \
|
|
72
80
|
--env SIMPLE_LLM_STABILITY_DEFAULT=true \
|
|
73
81
|
-- npx -y cheap-llm-mcp@latest
|
|
@@ -77,23 +85,29 @@ codex mcp add cheap-llm \
|
|
|
77
85
|
|
|
78
86
|
## 配置格式
|
|
79
87
|
|
|
80
|
-
|
|
88
|
+
推荐路径就是这几项:
|
|
81
89
|
|
|
82
90
|
```bash
|
|
83
91
|
CHEAP_LLM_BASE_URL=https://your-provider.example/v1
|
|
84
92
|
CHEAP_LLM_MODEL=your-cheap-model
|
|
85
93
|
CHEAP_LLM_API_KEY=your-api-key
|
|
86
94
|
CHEAP_LLM_CHAT_PATH=/chat/completions
|
|
95
|
+
CHEAP_LLM_API_KEY_HEADER=Authorization
|
|
96
|
+
CHEAP_LLM_API_KEY_PREFIX=Bearer
|
|
87
97
|
```
|
|
88
98
|
|
|
89
|
-
|
|
99
|
+
已明确支持的预设:
|
|
90
100
|
|
|
91
101
|
```bash
|
|
92
102
|
# DeepSeek
|
|
93
103
|
CHEAP_LLM_BASE_URL=https://api.deepseek.com
|
|
94
|
-
CHEAP_LLM_MODEL=deepseek-
|
|
104
|
+
CHEAP_LLM_MODEL=deepseek-v4-flash
|
|
105
|
+
|
|
106
|
+
# Xiaomi MiMo
|
|
107
|
+
CHEAP_LLM_BASE_URL=https://api.xiaomimimo.com/v1
|
|
108
|
+
CHEAP_LLM_MODEL=mimo-v2.5-pro
|
|
95
109
|
|
|
96
|
-
# Qwen
|
|
110
|
+
# Qwen / 阿里云百炼
|
|
97
111
|
CHEAP_LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
|
|
98
112
|
CHEAP_LLM_MODEL=qwen-plus
|
|
99
113
|
|
|
@@ -102,6 +116,17 @@ CHEAP_LLM_BASE_URL=https://example.com/v1
|
|
|
102
116
|
CHEAP_LLM_MODEL=model-id
|
|
103
117
|
```
|
|
104
118
|
|
|
119
|
+
DeepSeek 使用 `Authorization: Bearer ...`,接口是 `https://api.deepseek.com/chat/completions`。Xiaomi MiMo 的 OpenAI-compatible 接口是 `https://api.xiaomimimo.com/v1/chat/completions`;小米文档同时支持 `Authorization: Bearer ...` 和 `api-key` 头。如果你要切到 `api-key` 头,配置:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
CHEAP_LLM_API_KEY_HEADER=api-key
|
|
123
|
+
CHEAP_LLM_API_KEY_PREFIX=none
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Qwen / 阿里云百炼使用 DashScope OpenAI-compatible endpoint:`https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions`,默认模型是 `qwen-plus`。
|
|
127
|
+
|
|
128
|
+
参考文档:[DeepSeek API](https://api-docs.deepseek.com/zh-cn/)、[Xiaomi MiMo 首次调用 API](https://platform.xiaomimimo.com/docs/zh-CN/quick-start/first-api-call) 和 [Alibaba Cloud Model Studio Qwen API](https://www.alibabacloud.com/help/en/model-studio/use-qwen-by-calling-api)。
|
|
129
|
+
|
|
105
130
|
高级用户仍然可以用 `SIMPLE_LLM_PROVIDERS` 配多个具名 provider,但默认体验就是一个便宜的 OpenAI-compatible endpoint。
|
|
106
131
|
|
|
107
132
|
## 什么任务适合外包?
|
|
@@ -146,6 +171,7 @@ MCP 会自动注入中文优先 system prompt:默认使用简体中文回答
|
|
|
146
171
|
- 默认 prompt 上限是 12000 字符
|
|
147
172
|
- 默认请求超时是 60000ms
|
|
148
173
|
- provider 错误会脱敏后返回
|
|
174
|
+
- setup 连通性测试只发送固定 public ping,不发送你的仓库、需求或业务数据
|
|
149
175
|
|
|
150
176
|
不要把密钥、敏感客户数据、完整私有仓库上下文、安全判断、复杂架构决策、大规模重构交给外部便宜模型。
|
|
151
177
|
|
|
@@ -4,8 +4,10 @@ args = ["-y", "cheap-llm-mcp@latest"]
|
|
|
4
4
|
|
|
5
5
|
[mcp_servers.cheap-llm.env]
|
|
6
6
|
CHEAP_LLM_BASE_URL = "https://api.deepseek.com"
|
|
7
|
-
CHEAP_LLM_MODEL = "deepseek-
|
|
7
|
+
CHEAP_LLM_MODEL = "deepseek-v4-flash"
|
|
8
8
|
CHEAP_LLM_CHAT_PATH = "/chat/completions"
|
|
9
|
+
CHEAP_LLM_API_KEY_HEADER = "Authorization"
|
|
10
|
+
CHEAP_LLM_API_KEY_PREFIX = "Bearer"
|
|
9
11
|
SIMPLE_LLM_CHINESE_DEFAULT = "true"
|
|
10
12
|
SIMPLE_LLM_STABILITY_DEFAULT = "true"
|
|
11
13
|
SIMPLE_LLM_MAX_PROMPT_CHARS = "12000"
|
package/dist/chat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { envNumber } from "./env.js";
|
|
2
|
-
import { apiKeyFor, endpointFor, resolveProvider } from "./providers.js";
|
|
2
|
+
import { apiKeyFor, authHeadersFor, endpointFor, resolveProvider } from "./providers.js";
|
|
3
3
|
import { assertSafeToSend, buildMessages, redactError } from "./safety.js";
|
|
4
4
|
import { recordUsage } from "./accounting.js";
|
|
5
5
|
export function buildRequestBody(input, source = process.env) {
|
|
@@ -48,9 +48,9 @@ export async function callChatCompletion(input, source = process.env) {
|
|
|
48
48
|
response = await fetch(endpointFor(provider), {
|
|
49
49
|
method: "POST",
|
|
50
50
|
headers: {
|
|
51
|
-
Authorization: `Bearer ${apiKey}`,
|
|
52
51
|
"Content-Type": "application/json",
|
|
53
|
-
...provider.headers
|
|
52
|
+
...provider.headers,
|
|
53
|
+
...authHeadersFor(provider, apiKey)
|
|
54
54
|
},
|
|
55
55
|
body: JSON.stringify(body),
|
|
56
56
|
signal: controller.signal
|
package/dist/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAAC,KAA0B,EAAE,SAA4B,OAAO,CAAC,GAAG;IAClG,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO;QACL,GAAG,QAAQ,CAAC,WAAW;QACvB,GAAG,KAAK,CAAC,SAAS;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK;QACpC,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC;QACtC,WAAW,EAAE,KAAK,CAAC,WAA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>;
|
|
8
8
|
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
9
|
+
apiKeyHeader: z.ZodOptional<z.ZodString>;
|
|
10
|
+
apiKeyPrefix: z.ZodOptional<z.ZodString>;
|
|
9
11
|
model: z.ZodString;
|
|
10
12
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
11
13
|
defaultBody: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -17,6 +19,8 @@ export declare const providerJsonSchema: z.ZodArray<z.ZodObject<{
|
|
|
17
19
|
chatPath?: string | undefined;
|
|
18
20
|
apiKey?: string | undefined;
|
|
19
21
|
apiKeyEnv?: string | undefined;
|
|
22
|
+
apiKeyHeader?: string | undefined;
|
|
23
|
+
apiKeyPrefix?: string | undefined;
|
|
20
24
|
headers?: Record<string, string> | undefined;
|
|
21
25
|
defaultBody?: Record<string, unknown> | undefined;
|
|
22
26
|
timeoutMs?: number | undefined;
|
|
@@ -27,6 +31,8 @@ export declare const providerJsonSchema: z.ZodArray<z.ZodObject<{
|
|
|
27
31
|
chatPath?: string | undefined;
|
|
28
32
|
apiKey?: string | undefined;
|
|
29
33
|
apiKeyEnv?: string | undefined;
|
|
34
|
+
apiKeyHeader?: string | undefined;
|
|
35
|
+
apiKeyPrefix?: string | undefined;
|
|
30
36
|
headers?: Record<string, string> | undefined;
|
|
31
37
|
defaultBody?: Record<string, unknown> | undefined;
|
|
32
38
|
timeoutMs?: number | undefined;
|
|
@@ -34,6 +40,7 @@ export declare const providerJsonSchema: z.ZodArray<z.ZodObject<{
|
|
|
34
40
|
export declare function normalizeBaseUrl(baseUrl: string): string;
|
|
35
41
|
export declare function normalizePath(path: string | undefined): string;
|
|
36
42
|
export declare function endpointFor(provider: ProviderConfig): string;
|
|
43
|
+
export declare function authHeadersFor(provider: ProviderConfig, apiKey: string): Record<string, string>;
|
|
37
44
|
export declare function builtInProviders(source?: NodeJS.ProcessEnv): ProviderConfig[];
|
|
38
45
|
export declare function customProviders(source?: NodeJS.ProcessEnv): ProviderConfig[];
|
|
39
46
|
export declare function validateProvider(provider: ProviderConfig, source?: NodeJS.ProcessEnv): void;
|
package/dist/providers.js
CHANGED
|
@@ -6,6 +6,8 @@ export const providerJsonSchema = z.array(z.object({
|
|
|
6
6
|
chatPath: z.string().optional(),
|
|
7
7
|
apiKey: z.string().optional(),
|
|
8
8
|
apiKeyEnv: z.string().optional(),
|
|
9
|
+
apiKeyHeader: z.string().optional(),
|
|
10
|
+
apiKeyPrefix: z.string().optional(),
|
|
9
11
|
model: z.string().min(1),
|
|
10
12
|
headers: z.record(z.string()).optional(),
|
|
11
13
|
defaultBody: z.record(z.unknown()).optional(),
|
|
@@ -21,6 +23,20 @@ export function normalizePath(path) {
|
|
|
21
23
|
export function endpointFor(provider) {
|
|
22
24
|
return `${normalizeBaseUrl(provider.baseUrl)}${normalizePath(provider.chatPath)}`;
|
|
23
25
|
}
|
|
26
|
+
export function authHeadersFor(provider, apiKey) {
|
|
27
|
+
const header = provider.apiKeyHeader ?? "Authorization";
|
|
28
|
+
const rawPrefix = provider.apiKeyPrefix;
|
|
29
|
+
const prefix = rawPrefix === undefined
|
|
30
|
+
? "Bearer "
|
|
31
|
+
: ["", "none", "empty", "false", "off"].includes(rawPrefix.toLowerCase())
|
|
32
|
+
? ""
|
|
33
|
+
: rawPrefix.endsWith(" ")
|
|
34
|
+
? rawPrefix
|
|
35
|
+
: `${rawPrefix} `;
|
|
36
|
+
return {
|
|
37
|
+
[header]: `${prefix}${apiKey}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
24
40
|
export function builtInProviders(source = process.env) {
|
|
25
41
|
const providers = [
|
|
26
42
|
{
|
|
@@ -28,7 +44,9 @@ export function builtInProviders(source = process.env) {
|
|
|
28
44
|
baseUrl: env("CHEAP_LLM_BASE_URL", source) ?? "https://api.deepseek.com",
|
|
29
45
|
chatPath: env("CHEAP_LLM_CHAT_PATH", source),
|
|
30
46
|
apiKeyEnv: "CHEAP_LLM_API_KEY",
|
|
31
|
-
|
|
47
|
+
apiKeyHeader: env("CHEAP_LLM_API_KEY_HEADER", source),
|
|
48
|
+
apiKeyPrefix: env("CHEAP_LLM_API_KEY_PREFIX", source),
|
|
49
|
+
model: env("CHEAP_LLM_MODEL", source) ?? "deepseek-v4-flash",
|
|
32
50
|
timeoutMs: envNumber("CHEAP_LLM_TIMEOUT_MS", envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source), source)
|
|
33
51
|
},
|
|
34
52
|
{
|
|
@@ -36,12 +54,22 @@ export function builtInProviders(source = process.env) {
|
|
|
36
54
|
baseUrl: env("DEEPSEEK_BASE_URL", source) ?? "https://api.deepseek.com",
|
|
37
55
|
chatPath: env("DEEPSEEK_CHAT_PATH", source),
|
|
38
56
|
apiKeyEnv: "DEEPSEEK_API_KEY",
|
|
39
|
-
model: env("DEEPSEEK_MODEL", source) ?? "deepseek-
|
|
57
|
+
model: env("DEEPSEEK_MODEL", source) ?? "deepseek-v4-flash",
|
|
40
58
|
timeoutMs: envNumber("DEEPSEEK_TIMEOUT_MS", envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source), source),
|
|
41
59
|
defaultBody: env("DEEPSEEK_THINKING", source) === "enabled"
|
|
42
60
|
? { thinking: { type: "enabled", reasoning_effort: env("DEEPSEEK_REASONING_EFFORT", source) ?? "high" } }
|
|
43
61
|
: { thinking: { type: "disabled" } }
|
|
44
62
|
},
|
|
63
|
+
{
|
|
64
|
+
name: "mimo",
|
|
65
|
+
baseUrl: env("MIMO_BASE_URL", source) ?? "https://api.xiaomimimo.com/v1",
|
|
66
|
+
chatPath: env("MIMO_CHAT_PATH", source),
|
|
67
|
+
apiKeyEnv: "MIMO_API_KEY",
|
|
68
|
+
apiKeyHeader: env("MIMO_API_KEY_HEADER", source),
|
|
69
|
+
apiKeyPrefix: env("MIMO_API_KEY_PREFIX", source),
|
|
70
|
+
model: env("MIMO_MODEL", source) ?? "mimo-v2.5-pro",
|
|
71
|
+
timeoutMs: envNumber("MIMO_TIMEOUT_MS", envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source), source)
|
|
72
|
+
},
|
|
45
73
|
{
|
|
46
74
|
name: "qwen",
|
|
47
75
|
baseUrl: env("QWEN_BASE_URL", source) ?? "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
@@ -52,18 +80,6 @@ export function builtInProviders(source = process.env) {
|
|
|
52
80
|
timeoutMs: envNumber("QWEN_TIMEOUT_MS", envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source), source)
|
|
53
81
|
}
|
|
54
82
|
];
|
|
55
|
-
const mimoBaseUrl = env("MIMO_BASE_URL", source);
|
|
56
|
-
const mimoModel = env("MIMO_MODEL", source);
|
|
57
|
-
if (mimoBaseUrl && mimoModel) {
|
|
58
|
-
providers.push({
|
|
59
|
-
name: "mimo",
|
|
60
|
-
baseUrl: mimoBaseUrl,
|
|
61
|
-
chatPath: env("MIMO_CHAT_PATH", source),
|
|
62
|
-
apiKeyEnv: "MIMO_API_KEY",
|
|
63
|
-
model: mimoModel,
|
|
64
|
-
timeoutMs: envNumber("MIMO_TIMEOUT_MS", envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source), source)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
83
|
return providers;
|
|
68
84
|
}
|
|
69
85
|
export function customProviders(source = process.env) {
|
|
@@ -124,6 +140,7 @@ export function providerSetupStatus(source = process.env) {
|
|
|
124
140
|
model: provider.model,
|
|
125
141
|
endpoint: endpointFor(provider),
|
|
126
142
|
apiKeyEnv: provider.apiKeyEnv,
|
|
143
|
+
apiKeyHeader: provider.apiKeyHeader ?? "Authorization",
|
|
127
144
|
hasApiKey: Boolean(apiKey),
|
|
128
145
|
https: url.protocol === "https:",
|
|
129
146
|
timeoutMs: provider.timeoutMs ?? envNumber("SIMPLE_LLM_TIMEOUT_MS", 60000, source)
|
package/dist/providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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
|
|
2
2
|
export declare const SERVER_NAME = "cheap-llm-mcp";
|
|
3
|
-
export declare const SERVER_VERSION = "0.1.
|
|
3
|
+
export declare const SERVER_VERSION = "0.1.3";
|
|
4
4
|
export declare function createServer(source?: NodeJS.ProcessEnv): McpServer;
|
|
5
5
|
export declare function startStdioServer(source?: NodeJS.ProcessEnv): Promise<void>;
|
package/dist/server.js
CHANGED
|
@@ -7,7 +7,7 @@ import { envFlag } from "./env.js";
|
|
|
7
7
|
import { allProviders, providerSetupStatus } from "./providers.js";
|
|
8
8
|
import { maxPromptChars } from "./safety.js";
|
|
9
9
|
export const SERVER_NAME = "cheap-llm-mcp";
|
|
10
|
-
export const SERVER_VERSION = "0.1.
|
|
10
|
+
export const SERVER_VERSION = "0.1.3";
|
|
11
11
|
export function createServer(source = process.env) {
|
|
12
12
|
const server = new McpServer({
|
|
13
13
|
name: SERVER_NAME,
|
|
@@ -87,7 +87,7 @@ export function createServer(source = process.env) {
|
|
|
87
87
|
{
|
|
88
88
|
type: "text",
|
|
89
89
|
text: JSON.stringify({
|
|
90
|
-
ok: providers.
|
|
90
|
+
ok: providers.some((provider) => provider.hasApiKey && provider.https),
|
|
91
91
|
safety: {
|
|
92
92
|
maxPromptChars: maxPromptChars(source),
|
|
93
93
|
sensitiveDataRejected: true,
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC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;4BACtC,qBAAqB,EAAE,IAAI;4BAC3B,iBAAiB,EAAE,IAAI;4BACvB,8BAA8B,EAAE,IAAI;4BACpC,cAAc,EAAE,OAAO,CAAC,4BAA4B,EAAE,IAAI,EAAE,MAAM,CAAC;4BACnE,gBAAgB,EAAE,OAAO,CAAC,8BAA8B,EAAE,IAAI,EAAE,MAAM,CAAC;4BACvE,kBAAkB,EAAE,IAAI;4BACxB,SAAS,EAAE,OAAO,CAAC,uBAAuB,EAAE,KAAK,EAAE,MAAM,CAAC;yBAC3D;wBACD,SAAS;qBACV,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAA4B,OAAO,CAAC,GAAG;IAC5E,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/setup.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
type Client = "claude" | "codex";
|
|
2
|
+
type ProviderPreset = "deepseek" | "mimo" | "qwen" | "custom";
|
|
2
3
|
export type ProviderAnswers = {
|
|
4
|
+
preset?: ProviderPreset;
|
|
3
5
|
apiKey?: string;
|
|
4
6
|
baseUrl?: string;
|
|
5
7
|
model?: string;
|
|
6
8
|
chatPath?: string;
|
|
9
|
+
apiKeyHeader?: string;
|
|
10
|
+
apiKeyPrefix?: string;
|
|
7
11
|
};
|
|
8
12
|
export type SetupOptions = ProviderAnswers & {
|
|
9
13
|
clients: Client[];
|
|
10
14
|
execute?: boolean;
|
|
15
|
+
testConnection?: boolean;
|
|
11
16
|
};
|
|
17
|
+
export declare function envPairsForProvider(answer: ProviderAnswers): Record<string, string>;
|
|
12
18
|
export declare function buildClaudeCommand(answer: ProviderAnswers): string[];
|
|
13
19
|
export declare function buildCodexCommand(answer: ProviderAnswers): string[];
|
|
14
20
|
export declare function shellQuote(value: string): string;
|
|
@@ -21,6 +27,7 @@ export declare function codexTomlSnippet(answer: ProviderAnswers, options?: {
|
|
|
21
27
|
export declare function claudeJsonSnippet(answer: ProviderAnswers): string;
|
|
22
28
|
export declare function collectSetupOptions(): Promise<SetupOptions>;
|
|
23
29
|
export declare function commandsForSetup(options: SetupOptions): string[][];
|
|
30
|
+
export declare function testProviderConnection(answer: ProviderAnswers): Promise<string>;
|
|
24
31
|
export declare function runSetup(options?: SetupOptions): Promise<number>;
|
|
25
32
|
export declare function printConfig(): void;
|
|
26
33
|
export {};
|
package/dist/setup.js
CHANGED
|
@@ -1,17 +1,51 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { createInterface } from "node:readline/promises";
|
|
3
3
|
import { stdin as input, stdout as output } from "node:process";
|
|
4
|
+
import { callChatCompletion } from "./chat.js";
|
|
4
5
|
const PACKAGE_SPEC = "cheap-llm-mcp@latest";
|
|
5
6
|
const SERVER_NAME = "cheap-llm";
|
|
6
7
|
const SECRET_PLACEHOLDER = "<YOUR_API_KEY>";
|
|
8
|
+
const PROVIDER_PRESETS = {
|
|
9
|
+
deepseek: {
|
|
10
|
+
baseUrl: "https://api.deepseek.com",
|
|
11
|
+
model: "deepseek-v4-flash",
|
|
12
|
+
chatPath: "/chat/completions",
|
|
13
|
+
apiKeyHeader: "Authorization",
|
|
14
|
+
apiKeyPrefix: "Bearer"
|
|
15
|
+
},
|
|
16
|
+
mimo: {
|
|
17
|
+
baseUrl: "https://api.xiaomimimo.com/v1",
|
|
18
|
+
model: "mimo-v2.5-pro",
|
|
19
|
+
chatPath: "/chat/completions",
|
|
20
|
+
apiKeyHeader: "Authorization",
|
|
21
|
+
apiKeyPrefix: "Bearer"
|
|
22
|
+
},
|
|
23
|
+
qwen: {
|
|
24
|
+
baseUrl: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
25
|
+
model: "qwen-plus",
|
|
26
|
+
chatPath: "/chat/completions",
|
|
27
|
+
apiKeyHeader: "Authorization",
|
|
28
|
+
apiKeyPrefix: "Bearer"
|
|
29
|
+
},
|
|
30
|
+
custom: {
|
|
31
|
+
baseUrl: "https://api.example.com/v1",
|
|
32
|
+
model: "model-id",
|
|
33
|
+
chatPath: "/chat/completions",
|
|
34
|
+
apiKeyHeader: "Authorization",
|
|
35
|
+
apiKeyPrefix: "Bearer"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
7
38
|
function isSecretName(name) {
|
|
8
|
-
return /(
|
|
39
|
+
return /(TOKEN|SECRET|PASSWORD)$/i.test(name) || /(^|_)API_?KEY$/i.test(name);
|
|
9
40
|
}
|
|
10
|
-
function envPairsForProvider(answer) {
|
|
41
|
+
export function envPairsForProvider(answer) {
|
|
42
|
+
const preset = PROVIDER_PRESETS[answer.preset ?? "deepseek"];
|
|
11
43
|
const env = {
|
|
12
|
-
CHEAP_LLM_BASE_URL: answer.baseUrl ??
|
|
13
|
-
CHEAP_LLM_MODEL: answer.model ??
|
|
14
|
-
CHEAP_LLM_CHAT_PATH: answer.chatPath ??
|
|
44
|
+
CHEAP_LLM_BASE_URL: answer.baseUrl ?? preset.baseUrl,
|
|
45
|
+
CHEAP_LLM_MODEL: answer.model ?? preset.model,
|
|
46
|
+
CHEAP_LLM_CHAT_PATH: answer.chatPath ?? preset.chatPath,
|
|
47
|
+
CHEAP_LLM_API_KEY_HEADER: answer.apiKeyHeader ?? preset.apiKeyHeader,
|
|
48
|
+
CHEAP_LLM_API_KEY_PREFIX: answer.apiKeyPrefix ?? preset.apiKeyPrefix,
|
|
15
49
|
SIMPLE_LLM_DEFAULT_PROVIDER: "cheap",
|
|
16
50
|
SIMPLE_LLM_CHINESE_DEFAULT: "true",
|
|
17
51
|
SIMPLE_LLM_STABILITY_DEFAULT: "true",
|
|
@@ -91,28 +125,72 @@ async function ask(prompt, defaultValue = "") {
|
|
|
91
125
|
}
|
|
92
126
|
export async function collectSetupOptions() {
|
|
93
127
|
const clientChoice = await choose("Which client should be configured?", ["Claude Code", "Codex", "Both"], 2);
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
128
|
+
const providerChoice = await choose("Provider preset?", ["DeepSeek", "Xiaomi MiMo", "Qwen / Alibaba Cloud Bailian", "Custom OpenAI-compatible"], 0);
|
|
129
|
+
const preset = providerChoice === "Xiaomi MiMo"
|
|
130
|
+
? "mimo"
|
|
131
|
+
: providerChoice === "Qwen / Alibaba Cloud Bailian"
|
|
132
|
+
? "qwen"
|
|
133
|
+
: providerChoice === "Custom OpenAI-compatible"
|
|
134
|
+
? "custom"
|
|
135
|
+
: "deepseek";
|
|
136
|
+
const defaults = PROVIDER_PRESETS[preset];
|
|
137
|
+
const baseUrl = await ask("OpenAI-compatible base URL", defaults.baseUrl);
|
|
138
|
+
const model = await ask("Model id", defaults.model);
|
|
139
|
+
const chatPath = await ask("Chat completions path", defaults.chatPath);
|
|
140
|
+
const apiKeyHeader = await ask("API key header", defaults.apiKeyHeader);
|
|
141
|
+
const apiKeyPrefix = await ask("API key prefix (use none for headers like api-key)", defaults.apiKeyPrefix);
|
|
97
142
|
const apiKey = await ask("API key (leave blank if you will fill it manually in the client config)");
|
|
143
|
+
const testConnection = Boolean(apiKey) && (await choose("Send a tiny API connectivity test now?", ["Yes", "No"], 0)) === "Yes";
|
|
98
144
|
const execute = (await choose("Execute these install commands now?", ["Yes", "No"], 0)) === "Yes";
|
|
99
145
|
return {
|
|
100
146
|
clients: clientChoice === "Both" ? ["claude", "codex"] : clientChoice === "Claude Code" ? ["claude"] : ["codex"],
|
|
147
|
+
preset,
|
|
101
148
|
apiKey: apiKey || undefined,
|
|
102
149
|
baseUrl,
|
|
103
150
|
model,
|
|
104
151
|
chatPath,
|
|
152
|
+
apiKeyHeader,
|
|
153
|
+
apiKeyPrefix,
|
|
154
|
+
testConnection,
|
|
105
155
|
execute
|
|
106
156
|
};
|
|
107
157
|
}
|
|
108
158
|
export function commandsForSetup(options) {
|
|
109
159
|
return options.clients.map((client) => (client === "claude" ? buildClaudeCommand(options) : buildCodexCommand(options)));
|
|
110
160
|
}
|
|
161
|
+
export async function testProviderConnection(answer) {
|
|
162
|
+
return callChatCompletion({
|
|
163
|
+
prompt: 'Reply exactly: cheap-llm-mcp-ok',
|
|
164
|
+
system: "This is a CLI connectivity check. Reply with the exact requested text only.",
|
|
165
|
+
temperature: 0,
|
|
166
|
+
maxTokens: 16,
|
|
167
|
+
includeUsage: true,
|
|
168
|
+
approvedForExternalApi: true,
|
|
169
|
+
dataClassification: "public"
|
|
170
|
+
}, envPairsForProvider(answer));
|
|
171
|
+
}
|
|
111
172
|
export async function runSetup(options) {
|
|
112
173
|
const selected = options ?? (await collectSetupOptions());
|
|
113
174
|
const commands = commandsForSetup(selected);
|
|
114
175
|
output.write("\nCommands:\n");
|
|
115
176
|
commands.forEach((command) => output.write(` ${commandToString(command, { redactSecrets: true })}\n`));
|
|
177
|
+
if (selected.testConnection) {
|
|
178
|
+
if (!selected.apiKey) {
|
|
179
|
+
output.write("\nSkipped API connectivity test because no API key was provided.\n");
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
output.write("\nTesting API connectivity with a tiny public ping...\n");
|
|
183
|
+
try {
|
|
184
|
+
const result = await testProviderConnection(selected);
|
|
185
|
+
output.write(`API connectivity OK:\n${result.slice(0, 800)}\n`);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
189
|
+
output.write(`API connectivity test failed:\n${message}\n`);
|
|
190
|
+
output.write("The MCP config was still generated below. Fix the provider settings or API key, then run setup again.\n");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
116
194
|
if (!selected.execute) {
|
|
117
195
|
output.write("\nSkipped execution. Copy a command above, or run setup again and choose execution.\n");
|
|
118
196
|
output.write("\nManual Codex fallback:\n");
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAqB/C,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAC5C,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,gBAAgB,GAAgI;IACpJ,QAAQ,EAAE;QACR,OAAO,EAAE,0BAA0B;QACnC,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,mBAAmB;QAC7B,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,+BAA+B;QACxC,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,mBAAmB;QAC7B,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,mDAAmD;QAC5D,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,mBAAmB;QAC7B,YAAY,EAAE,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CAAC;AACX,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAClE,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cheap-llm-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Save premium-model tokens by routing simple tasks to cheap OpenAI-compatible LLMs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
"url": "https://github.com/stBlackCat/cheap-llm-mcp/issues"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
-
"dist",
|
|
38
|
-
"README.md",
|
|
39
|
-
"README.
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md",
|
|
39
|
+
"README.en.md",
|
|
40
|
+
"README.zh-CN.md",
|
|
40
41
|
"LICENSE",
|
|
41
42
|
"SECURITY.md",
|
|
42
43
|
"CHANGELOG.md",
|