@jsonstudio/rcc 0.89.1959 → 0.89.1960

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 CHANGED
@@ -65,37 +65,170 @@ npm uninstall -g @jsonstudio/rcc
65
65
 
66
66
  ## 使用
67
67
 
68
- ### 1) 初始化配置并启动
68
+ ### 1) 初始化(推荐用 `rcc`)
69
+
70
+ 默认配置路径:
71
+ - macOS / Linux:`~/.routecodex/config.json`
72
+ - Windows:`%USERPROFILE%\\.routecodex\\config.json`
73
+
74
+ 交互式初始化:
69
75
 
70
76
  ```bash
71
- routecodex init
72
- routecodex start
77
+ rcc init
73
78
  ```
74
79
 
75
- 或使用 release CLI:
80
+ 非交互(指定 provider + 默认路由):
76
81
 
77
82
  ```bash
78
- rcc init
79
- rcc start
83
+ rcc init --providers deepseek-web,tab,qwen --default-provider deepseek-web --camoufox --force
80
84
  ```
81
85
 
82
- 默认配置路径:
83
- - macOS / Linux:`~/.routecodex/config.json`
84
- - Windows:`%USERPROFILE%\\.routecodex\\config.json`
86
+ 说明:
87
+ - `--providers` 使用 init 内置 provider id(见下文鉴权表)。
88
+ - `--camoufox` 会显式触发 Camoufox 环境准备(即使当前 provider 不强依赖)。
89
+ - `--force` 会先备份旧配置到 `config.json.bak*` 再重写。
90
+
91
+ 如果你使用 dev CLI,把 `rcc` 替换成 `routecodex` 即可。
92
+
93
+ ### 2) Camoufox 初始化(macOS / Windows)
94
+
95
+ `rcc init --camoufox` 会自动检查/安装 Camoufox。你也可以先手工准备:
96
+
97
+ macOS:
85
98
 
86
- `routecodex init` / `rcc init` 会在 `~/.routecodex/` 生成默认 `config.json`,并把常用文档复制到 `~/.routecodex/docs`。
99
+ ```bash
100
+ python3 -m pip install --user -U camoufox
101
+ python3 -m camoufox path
102
+ ```
103
+
104
+ Windows (PowerShell):
105
+
106
+ ```powershell
107
+ py -3 -m pip install --user -U camoufox
108
+ py -3 -m camoufox path
109
+ ```
110
+
111
+ 可选环境变量(当 Python 不在默认命令路径时):
112
+ - `ROUTECODEX_PYTHON` / `RCC_PYTHON`:指定 Python 可执行文件路径
113
+ - `ROUTECODEX_CAMOUFOX_AUTO_INSTALL=0`:关闭自动安装(默认开启)
114
+
115
+ 验证 Camoufox profile + 指纹是否可打开:
87
116
 
88
- 如果配置文件已存在,需要重新生成模板:
117
+ ```bash
118
+ rcc camoufox antigravity-oauth-1-alias1.json
119
+ ```
120
+
121
+ ### 3) macOS / Windows 环境变量写法
122
+
123
+ macOS/Linux (zsh/bash):
89
124
 
90
125
  ```bash
91
- routecodex init --force
92
- #
93
- rcc init --force
126
+ export OPENAI_API_KEY="your_openai_key"
127
+ export TAB_API_KEY="your_tab_key"
128
+ export GLM_API_KEY="your_glm_key"
129
+ ```
130
+
131
+ Windows PowerShell(当前会话):
132
+
133
+ ```powershell
134
+ $env:OPENAI_API_KEY="your_openai_key"
135
+ $env:TAB_API_KEY="your_tab_key"
136
+ $env:GLM_API_KEY="your_glm_key"
94
137
  ```
95
138
 
96
- 它会先备份旧配置为 `config.json.bak`(或 `config.json.bak.N`),再生成新模板。
139
+ Windows PowerShell(持久化):
140
+
141
+ ```powershell
142
+ setx OPENAI_API_KEY "your_openai_key"
143
+ setx TAB_API_KEY "your_tab_key"
144
+ setx GLM_API_KEY "your_glm_key"
145
+ ```
146
+
147
+ API key 类 provider 的常用环境变量(按 init 模板):
148
+ - `OPENAI_API_KEY`
149
+ - `TAB_API_KEY`
150
+ - `GLM_API_KEY`
151
+ - `KIMI_API_KEY`
152
+ - `MODELSCOPE_API_KEY`
153
+ - `MIMO_API_KEY`
154
+
155
+ ### 4) 按 init 内置 provider 配置鉴权
156
+
157
+ 下表对应 `rcc init --list-providers` 的内置模板:
158
+
159
+ | Provider ID | 默认 auth 类型 | 你需要做什么 |
160
+ |------|------|------|
161
+ | `openai` | `apikey` | 设置 `OPENAI_API_KEY` |
162
+ | `tab` | `apikey` (responses) | 设置 `TAB_API_KEY` |
163
+ | `deepseek-web` | `deepseek-account` (`tokenFile` entries) | 准备 `~/.routecodex/auth/deepseek-account-*.json` |
164
+ | `glm` | `apikey` | 设置 `GLM_API_KEY` |
165
+ | `glm-anthropic` | `apikey` (`/v1/messages`) | 设置 `GLM_API_KEY` |
166
+ | `kimi` | `apikey` | 设置 `KIMI_API_KEY` |
167
+ | `modelscope` | `apikey` | 设置 `MODELSCOPE_API_KEY` |
168
+ | `lmstudio` | `apikey` (本地) | 通常可留空或填本地网关 key |
169
+ | `qwen` | `qwen-oauth` (`tokenFile=default`) | 先跑 OAuth 生成 token |
170
+ | `iflow` | `iflow-cookie` | 准备 `~/.routecodex/auth/iflow-work.cookie` |
171
+ | `mimo` | `apikey` | 设置 `MIMO_API_KEY` |
172
+ | `gemini-cli` | `gemini-cli-oauth` (`entries[].tokenFile`) | 先跑 OAuth 生成 token |
173
+ | `antigravity` | `antigravity-oauth` (`entries[].tokenFile`) | 先跑 OAuth 生成 token |
174
+
175
+ OAuth 认证命令(常用):
176
+
177
+ ```bash
178
+ rcc oauth qwen-auto qwen
179
+ rcc oauth gemini-auto gemini-cli
180
+ rcc oauth antigravity-auto antigravity
181
+ ```
182
+
183
+ DeepSeek 单文件凭据 + token(同一文件)示例:
184
+
185
+ ```json
186
+ {
187
+ "mobile": "13800000000",
188
+ "password": "your_password",
189
+ "access_token": ""
190
+ }
191
+ ```
192
+
193
+ 放在 `~/.routecodex/auth/deepseek-account-1.json` 后,启动时会自动登录并回填 `access_token`。
194
+
195
+ ### 5) 脱敏快速配置(来自当前线上配置)
196
+
197
+ 已提供脱敏模板:
198
+ - `configsamples/config.v1.quickstart.sanitized.json`
199
+
200
+ 快速使用:
201
+
202
+ ```bash
203
+ cp configsamples/config.v1.quickstart.sanitized.json ~/.routecodex/config.v1.json
204
+ rcc start --config ~/.routecodex/config.v1.json
205
+ ```
206
+
207
+ 此模板已经脱敏(API key、token、账号别名),保留了可直接复用的路由结构和 provider 组合。
208
+
209
+ #### 5.1) 用 `rcc init` 把本地 v1 配置转换为 v2
210
+
211
+ 如果你要把 `configsamples/config.v1.quickstart.sanitized.json` 本地化成 v2(provider 分文件 + `virtualrouterMode: v2`),推荐直接用:
212
+
213
+ ```bash
214
+ mkdir -p ~/.routecodex
215
+ cp configsamples/config.v1.quickstart.sanitized.json ~/.routecodex/config.json
216
+ rcc init --config ~/.routecodex/config.json --force
217
+ ```
218
+
219
+ 说明:
220
+ - `rcc init` 会检测到这是 v1 配置并执行迁移。
221
+ - `--force` 会跳过交互确认,适合脚本化/CI。
222
+ - 迁移后会生成 `~/.routecodex/provider/<providerId>/config.v2.json`,并备份原始 v1 文件为 `config.json.bak*`。
223
+
224
+ 可选检查:
225
+
226
+ ```bash
227
+ rcc init --list-current-providers
228
+ rcc start --config ~/.routecodex/config.json
229
+ ```
97
230
 
98
- ### 2) 调用 API(示例)
231
+ ### 6) 调用 API(示例)
99
232
 
100
233
  健康检查:
101
234
 
@@ -173,6 +306,7 @@ curl http://127.0.0.1:5555/v1/messages \
173
306
  ## 参考配置
174
307
 
175
308
  - `configsamples/config.reference.json`
309
+ - `configsamples/config.v1.quickstart.sanitized.json`
176
310
  - `configsamples/provider/*/config.v1.json`
177
311
 
178
312
  ## 相关链接