srpllm 1.0.0 → 1.0.1
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 +143 -193
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{srpllm.BB4ML_UM.mjs → srpllm.gk7klSey.mjs} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,193 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[ (first open source project author sponsor, the author of [CCR](https://github.com/musistudio/claude-code-router) 🤩)
|
|
147
|
-
- \*年 (first 100 CNY sponsor 💴)
|
|
148
|
-
- [BeatSeat](https://github.com/BeatSeat) (community expert 😎, provided $1000 Claude credits)
|
|
149
|
-
- [wenwen](https://github.com/wenwen12345) (community expert 🤓, provided daily $100 Claude&GPT credits)
|
|
150
|
-
- 16°C coffee (My best friend 🤪, offered ChatGPT Pro $200 package)
|
|
151
|
-
|
|
152
|
-
### Promotion Thanks
|
|
153
|
-
|
|
154
|
-
Thanks to the following authors for promoting this project:
|
|
155
|
-
|
|
156
|
-
- 逛逛 GitHub, article: https://mp.weixin.qq.com/s/phqwSRb16MKCHHVozTFeiQ
|
|
157
|
-
- Geek, tweet: https://x.com/geekbb/status/1955174718618866076
|
|
158
|
-
|
|
159
|
-
## 📄 License
|
|
160
|
-
|
|
161
|
-
[MIT License](LICENSE)
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## 🚀 Contributors
|
|
166
|
-
|
|
167
|
-
<a href="https://github.com/UfoMiao/zcf/graphs/contributors">
|
|
168
|
-
<img src="https://contrib.rocks/image?repo=UfoMiao/zcf" />
|
|
169
|
-
</a>
|
|
170
|
-
<br /><br />
|
|
171
|
-
|
|
172
|
-
## ⭐️ Star History
|
|
173
|
-
|
|
174
|
-
If this project helps you, please give me a ⭐️ Star!
|
|
175
|
-
|
|
176
|
-
[](https://star-history.com/#UfoMiao/zcf&Date)
|
|
177
|
-
|
|
178
|
-
<!-- Badges -->
|
|
179
|
-
|
|
180
|
-
[npm-version-src]: https://img.shields.io/npm/v/zcf?style=flat&colorA=080f12&colorB=1fa669
|
|
181
|
-
[npm-version-href]: https://npmjs.com/package/zcf
|
|
182
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/zcf?style=flat&colorA=080f12&colorB=1fa669
|
|
183
|
-
[npm-downloads-href]: https://npmjs.com/package/zcf
|
|
184
|
-
[license-src]: https://img.shields.io/github/license/ufomiao/zcf.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
185
|
-
[license-href]: https://github.com/ufomiao/zcf/blob/main/LICENSE
|
|
186
|
-
[claude-code-src]: https://img.shields.io/badge/Claude-Code-1fa669?style=flat&colorA=080f12&colorB=1fa669
|
|
187
|
-
[claude-code-href]: https://claude.ai/code
|
|
188
|
-
[codecov-src]: https://codecov.io/gh/UfoMiao/zcf/graph/badge.svg?token=HZI6K4Y7D7&style=flat&colorA=080f12&colorB=1fa669
|
|
189
|
-
[codecov-href]: https://codecov.io/gh/UfoMiao/zcf
|
|
190
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-1fa669?style=flat&colorA=080f12&colorB=1fa669
|
|
191
|
-
[jsdocs-href]: https://www.jsdocs.io/package/zcf
|
|
192
|
-
[deepwiki-src]: https://img.shields.io/badge/Ask-DeepWiki-1fa669?style=flat&colorA=080f12&colorB=1fa669
|
|
193
|
-
[deepwiki-href]: https://deepwiki.com/UfoMiao/zcf
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# SrP-LLM 配置工具
|
|
4
|
+
|
|
5
|
+
中转站客户端一键配置:安装 Claude Code / Codex · 填写 base_url 与 api_token · 从 litellm 拉取并选择模型
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/srpllm)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## 简介
|
|
13
|
+
|
|
14
|
+
`srpllm` 是为 **SrP-LLM 中转站**(基于 litellm 后端)准备的客户端配置脚本。一条命令即可:
|
|
15
|
+
|
|
16
|
+
1. 安装 Claude Code / Codex CLI
|
|
17
|
+
2. 引导填写中转站的 `base_url` 与 `api_token`
|
|
18
|
+
3. 从中转站后端 `GET {base_url}/v1/models` 拉取可用模型列表并选择
|
|
19
|
+
4. 把配置写入对应客户端的配置文件(Claude Code 的 `settings.json` / Codex 的 `config.toml` + `auth.json`)
|
|
20
|
+
|
|
21
|
+
仅做「安装 + 配置接入中转站」这一件事,不做更多设置。
|
|
22
|
+
|
|
23
|
+
## 快速开始
|
|
24
|
+
|
|
25
|
+
无需全局安装,直接用 `npx` 运行:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx srpllm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
按提示选择工具、输入中转站地址和 token、选择模型即可完成。
|
|
32
|
+
|
|
33
|
+
## 命令
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx srpllm # 交互式引导配置(默认)
|
|
37
|
+
npx srpllm init # 安装 CLI 并配置中转站(同上)
|
|
38
|
+
npx srpllm uninstall # 清除中转站配置(可选同时卸载 CLI)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 非交互模式(CI / 脚本)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx srpllm init -s \
|
|
45
|
+
-T claude-code \
|
|
46
|
+
-u https://api.srpllm.com \
|
|
47
|
+
-k sk-xxxx \
|
|
48
|
+
-m glm-5.2 \
|
|
49
|
+
-O glm-5.2 \
|
|
50
|
+
-S glm-5-turbo \
|
|
51
|
+
-H glm-5-turbo
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 参数
|
|
55
|
+
|
|
56
|
+
| 参数 | 简写 | 说明 |
|
|
57
|
+
|------|------|------|
|
|
58
|
+
| `--code-type` | `-T` | 工具类型:`claude-code` / `codex`(简写 `cc` / `cx`) |
|
|
59
|
+
| `--base-url` | `-u` | 中转站 base_url(例如 `https://api.srpllm.com`) |
|
|
60
|
+
| `--token` | `-k` | api_token |
|
|
61
|
+
| `--model` | `-m` | 主模型,写入 `ANTHROPIC_MODEL` |
|
|
62
|
+
| `--opus-model` | `-O` | Opus 档模型,写入 `ANTHROPIC_DEFAULT_OPUS_MODEL` |
|
|
63
|
+
| `--sonnet-model` | `-S` | Sonnet 档模型,写入 `ANTHROPIC_DEFAULT_SONNET_MODEL` |
|
|
64
|
+
| `--haiku-model` | `-H` | Haiku 档模型,写入 `ANTHROPIC_DEFAULT_HAIKU_MODEL` |
|
|
65
|
+
| `--skip-prompt` | `-s` | 非交互模式,跳过所有交互提示 |
|
|
66
|
+
| `--help` | `-h` | 显示帮助 |
|
|
67
|
+
| `--version` | `-v` | 显示版本 |
|
|
68
|
+
|
|
69
|
+
> Opus / Sonnet / Haiku 三档模型参数仅对 Claude Code 生效;Codex 只使用 `--model`。
|
|
70
|
+
|
|
71
|
+
## 配置写入位置
|
|
72
|
+
|
|
73
|
+
### Claude Code
|
|
74
|
+
|
|
75
|
+
写入 `~/.claude/settings.json` 的 `env` 段(合并式,保留其它字段):
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"env": {
|
|
80
|
+
"ANTHROPIC_BASE_URL": "https://api.srpllm.com",
|
|
81
|
+
"ANTHROPIC_AUTH_TOKEN": "sk-xxxx",
|
|
82
|
+
"ANTHROPIC_MODEL": "glm-5.2",
|
|
83
|
+
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2",
|
|
84
|
+
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5-turbo",
|
|
85
|
+
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5-turbo",
|
|
86
|
+
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
|
|
87
|
+
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- 统一使用 `ANTHROPIC_AUTH_TOKEN`(Bearer token 鉴权),清除原 `ANTHROPIC_API_KEY`
|
|
93
|
+
- 额外附加 `CLAUDE_CODE_AUTO_COMPACT_WINDOW` 与 `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` 两个默认值
|
|
94
|
+
|
|
95
|
+
### Codex
|
|
96
|
+
|
|
97
|
+
写入 `~/.codex/config.toml`(合并式,保留用户其它 provider / mcp / projects 等配置,修改前自动备份):
|
|
98
|
+
|
|
99
|
+
```toml
|
|
100
|
+
# --- SrP-LLM 中转站配置 ---
|
|
101
|
+
model = "gpt-5.2"
|
|
102
|
+
model_provider = "srpllm"
|
|
103
|
+
|
|
104
|
+
[model_providers.srpllm]
|
|
105
|
+
name = "SrP-LLM"
|
|
106
|
+
base_url = "https://api.srpllm.com"
|
|
107
|
+
wire_api = "responses"
|
|
108
|
+
temp_env_key = "SRPLLM_API_KEY"
|
|
109
|
+
requires_openai_auth = false
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
并把 `~/.codex/auth.json` 中的 `SRPLLM_API_KEY` 与 `OPENAI_API_KEY` 设为 token(合并保留其它 key)。
|
|
113
|
+
|
|
114
|
+
## 卸载
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npx srpllm uninstall
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- Claude Code:从 `settings.json` 清除中转站相关 env 字段,保留其它设置
|
|
121
|
+
- Codex:移除 `[model_providers.srpllm]` 段与顶层 `model`/`model_provider`,保留其它配置(修改前自动备份)
|
|
122
|
+
- 可选择同时卸载 Claude Code / Codex CLI
|
|
123
|
+
|
|
124
|
+
## 模型列表获取
|
|
125
|
+
|
|
126
|
+
模型列表从中转站后端 litellm 的标准接口拉取:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
GET {base_url}/v1/models
|
|
130
|
+
Authorization: Bearer {api_token}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
返回 `data: [{ id, owned_by, ... }]` 格式,工具会列出全部模型供选择。若拉取失败(网络不通 / token 无效),交互模式下可手动输入模型名,非交互模式下跳过模型配置。
|
|
134
|
+
|
|
135
|
+
## 平台支持
|
|
136
|
+
|
|
137
|
+
- macOS / Linux / Windows / WSL / Termux
|
|
138
|
+
- Claude Code 安装方式:npm / Homebrew / curl / PowerShell
|
|
139
|
+
- Codex 安装方式:npm / Homebrew
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
[MIT](./LICENSE)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { i as init, u as uninstall, G as version } from './shared/srpllm.
|
|
4
|
+
import { i as init, u as uninstall, G as version } from './shared/srpllm.gk7klSey.mjs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'inquirer';
|
|
7
7
|
import 'ora';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, R as RELAY_PROVIDER_ID, F as buildModelsChoices, o as clearClaudeApiConfig, t as clearCodexApiConfig, c as commandExists, y as detectInstalledVersion, p as displayClaudeConfig, v as displayCodexConfig, l as ensureClaudeDir, E as fetchModels, n as getExistingClaudeApiConfig, q as getExistingCodexConfig, g as getPlatform, i as init, A as installTool, x as isToolInstalled, a as isWindows, m as readClaudeSettings, r as resolveCodeToolType, z as selectInstallMethod, u as uninstall, B as uninstallTool, w as writeClaudeApiConfig, s as writeCodexApiConfig } from './shared/srpllm.
|
|
1
|
+
export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, R as RELAY_PROVIDER_ID, F as buildModelsChoices, o as clearClaudeApiConfig, t as clearCodexApiConfig, c as commandExists, y as detectInstalledVersion, p as displayClaudeConfig, v as displayCodexConfig, l as ensureClaudeDir, E as fetchModels, n as getExistingClaudeApiConfig, q as getExistingCodexConfig, g as getPlatform, i as init, A as installTool, x as isToolInstalled, a as isWindows, m as readClaudeSettings, r as resolveCodeToolType, z as selectInstallMethod, u as uninstall, B as uninstallTool, w as writeClaudeApiConfig, s as writeCodexApiConfig } from './shared/srpllm.gk7klSey.mjs';
|
|
2
2
|
import 'node:process';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'inquirer';
|