@musistudio/claude-code-router 3.0.4 → 3.0.5

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
@@ -1,375 +1,184 @@
1
- <h1 align="center">Claude Code Router Desktop</h1>
2
-
3
- <p align="center">
4
- <a href="README_zh.md"><img alt="Chinese README" src="https://img.shields.io/badge/%F0%9F%87%A8%F0%9F%87%B3-%E4%B8%AD%E6%96%87%E7%89%88-ff0000?style=flat" /></a>
5
- <a href="https://discord.gg/rdftVMaUcS"><img alt="Discord" src="https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white" /></a>
6
- <a href="https://x.com/musistudio2026"><img alt="X" src="https://img.shields.io/badge/X-@musistudio2026-000000?logo=x&logoColor=white" /></a>
7
- <a href="https://github.com/musistudio/claude-code-router/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/musistudio/claude-code-router" /></a>
8
- <a href="https://ccrdesk.top/"><img alt="Documentation" src="https://img.shields.io/badge/Docs-ccrdesk.top-0ea5e9?style=flat" /></a>
9
- </p>
10
-
11
- <div align="center">
12
-
13
- <table width="100%">
14
- <tr>
15
- <td align="center">
16
- <a href="https://www.kimi.com/code?aff=ccr">
17
- <img src="https://gcdn.moonshot.cn/growth-cdn/sponsor/kimi-en.png" width="960" alt="Kimi K2.7 Code sponsor banner" />
18
- </a>
19
- <br />
20
- <sub>
21
- <a href="https://www.kimi.com/code?aff=ccr"><strong>Kimi Code Subscription</strong></a>
22
- &nbsp;·&nbsp;
23
- <a href="https://platform.kimi.ai?aff=ccr"><strong>API Global</strong></a>
24
- &nbsp;·&nbsp;
25
- <a href="https://platform.kimi.com?aff=ccr">API China</a>
26
- </sub>
27
- </td>
28
- </tr>
29
- <tr>
30
- <td align="left">
31
- <p>
32
- <strong>Thanks to Kimi for sponsoring this project!</strong> Kimi K2.7 Code is an open-source, coding-focused agentic model developed by Moonshot AI, with substantial gains on real-world long-horizon coding tasks and higher end-to-end success across complex software engineering workflows. It also cuts thinking-token usage by approximately 30% compared with K2.6. Inside CCR, Kimi ships as built-in provider presets: import the pay-as-you-go API or the Kimi Code subscription in one click and route your coding agent's requests to Kimi, the subscription endpoint passes straight through natively with no protocol conversion, API endpoints are adapted automatically, and your balance and subscription usage show up right in the CCR dashboard.
33
- </p>
34
- <p align="center">
35
- CCR already supports Kimi. Visit the Kimi Open Platform (<a href="https://platform.kimi.com?aff=ccr">中文站</a> | <a href="https://platform.kimi.ai?aff=ccr">Global</a>) to try the API, or explore the <a href="https://www.kimi.com/code?aff=ccr">cost-effective Coding Plan</a>.
36
- </p>
37
- </td>
38
- </tr>
39
- </table>
40
-
41
- </div>
42
-
43
- Claude Code Router Desktop is a local gateway and desktop control panel for routing agent requests from Claude Code, Codex, ZCode, and compatible clients to the model provider you actually want to use.
44
-
45
- <p align="center">
46
- <img src="blog/images/claude-code-router.png" width="720" alt="Claude Code Router Desktop screenshot" />
47
- </p>
48
-
49
- ## Why Use CCR
50
-
51
- - Use one local endpoint for multiple agent tools instead of configuring every client separately.
52
- - Route requests with default routing, conditional rules, fallback targets, and request rewrites instead of editing client configuration by hand.
53
- - Mix providers without changing your workflow. CCR supports OpenAI-compatible APIs, Anthropic Messages, Gemini Generate Content, OpenRouter, DeepSeek, SiliconFlow, Moonshot, Kimi Code, Mistral, Z.AI, Bailian, and custom providers.
54
- - Control cost and reliability with fallback routing, API key rotation, usage statistics, and request logs.
55
-
56
- ## Features
57
-
58
- - **Overview dashboard**: inspect system status, usage widgets, account balances, model distribution, and share cards.
59
- - **Provider management**: add provider presets or custom endpoints, probe protocol support, test model connectivity, manage credentials, and monitor supported account balances where available.
60
- - **Routing rules**: configure default routing, conditional and model-prefix rules, fallback handling, and request rewrites.
61
- - **Agent Config**: configure Claude Code, Codex, and ZCode launch entries, models, scopes, and multi-instance app profiles.
62
- - **Gateway compatibility**: translate supported client requests through the local CCR model gateway.
63
- - **Proxy mode**: capture supported API traffic through a local proxy with optional system proxy integration and network capture.
64
- - **Fusion models**: combine a base model with vision, web search, or MCP tools into a reusable selectable model.
65
-
66
- ## Documentation
67
-
68
- Read the full documentation at [ccrdesk.top](https://ccrdesk.top/).
69
-
70
- ## Download And Install
71
-
72
- 1. Open the [GitHub Releases page](https://github.com/musistudio/claude-code-router/releases).
73
- 2. Download the package for your platform:
74
- - macOS Apple Silicon: `Claude-Code-Router_<version>-mac-Apple-Silicon-arm64.dmg` or `.zip`
75
- - macOS Intel: `Claude-Code-Router_<version>-mac-Intel-x64.dmg` or `.zip`
76
- - Windows: `Claude Code Router_<version>.exe`
77
- - Linux: `Claude Code Router_<version>.AppImage`
78
- 3. Install and launch **Claude Code Router**.
79
- 4. On first launch, CCR creates its local configuration database:
80
- - macOS/Linux: `~/.claude-code-router/config.sqlite`
81
- - Windows: `%APPDATA%\Claude Code Router\config.sqlite`
82
-
83
- CCR stores runtime configuration in SQLite. A legacy `config.json` is read only once for migration when no SQLite config exists.
84
-
85
- After the service is started from the **Server** page, CCR listens on `http://localhost:8080` by default. The **Server** page controls the gateway `Host`, `Port`, proxy mode, system proxy, network capture, and CA certificate status.
1
+ # Claude Code Router CLI
2
+
3
+ [中文](README_zh.md) · [Documentation](https://ccrdesk.top/en/) · [GitHub](https://github.com/musistudio/claude-code-router)
4
+
5
+ `@musistudio/claude-code-router` is the Node.js distribution of Claude Code Router. It provides the `ccr` command, the browser-based management UI, the local model gateway, and profile launch commands without requiring Electron.
6
+
7
+ Use the CLI on developer machines and headless hosts. If you want the tray, desktop notifications, automatic app updates, or desktop-only browser integrations, install the desktop application instead.
8
+
9
+ ## Requirements And Installation
10
+
11
+ - Node.js 22 or newer
12
+ - A supported upstream model provider, or a locally logged-in agent account that CCR can import
13
+ - A locally installed agent executable when using profile launch commands
14
+
15
+ Install globally:
16
+
17
+ ```sh
18
+ npm install -g @musistudio/claude-code-router
19
+ ccr --help
20
+ ```
21
+
22
+ Upgrade or remove it with npm:
23
+
24
+ ```sh
25
+ npm install -g @musistudio/claude-code-router@latest
26
+ npm uninstall -g @musistudio/claude-code-router
27
+ ```
28
+
29
+ Removing the package does not delete CCR's local configuration or databases.
86
30
 
87
31
  ## Quick Start
88
32
 
89
- CCR can be configured entirely from the desktop UI. Use this setup order for a clean first run.
90
-
91
- ### 1. Add a provider
92
-
93
- Open **Providers**, click **Add Provider**, then choose a built-in preset or **Other / custom API endpoint**. Fill in the provider name, base URL, protocol, API key, and model list. Run protocol probing and model connectivity checks when available, then save the provider.
94
-
95
- ### 2. Configure routing
96
-
97
- Open **Routing** to add conditional rules, configure request rewrites, and set fallback behavior.
98
-
99
- Use **Add Routing Rule** for request conditions, model-prefix routing, or rule-level fallback targets.
100
-
101
- ### 3. Start the gateway
102
-
103
- Open **Server** and click **Start**. After the page shows Running, CCR listens on `http://localhost:8080`. Enable **Auto start** if you want CCR to start the local gateway whenever the desktop app opens.
104
-
105
- ### 4. Connect your agent tool
106
-
107
- Open **Agent Config** and choose the client you want to use. Configure Claude Code, Codex, or ZCode, select the target model and effect scope, then apply the config. For app entries, use the **Open Agent** action to open the target app through CCR.
108
-
109
- ### 5. Monitor and adjust
110
-
111
- Use **Settings Logs & Observability** to enable request logs and agent observability. Use **Logs** to confirm `request model`, `resolved provider`, `resolved model`, status, tokens, latency, and errors; use the tray window for quick token and account status.
112
-
113
- ## Acknowledgements
114
-
115
- Codex support is powered by [musistudio/codexl](https://github.com/musistudio/codexl).
116
-
117
- ## Support & Sponsoring
118
-
119
- <div align="center">
120
-
121
- <p>If you find this project helpful, please consider sponsoring its development. Your support is greatly appreciated.</p>
122
-
123
- <table>
124
- <tr>
125
- <td align="center" width="220">
126
- <a href="https://ko-fi.com/F1F31GN2GM">
127
- <img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="Support on Ko-fi" />
128
- </a>
129
- <br />
130
- <sub>One-time support via Ko-fi</sub>
131
- </td>
132
- <td align="center" width="220">
133
- <a href="https://paypal.me/musistudio1999">
134
- <img src="https://img.shields.io/badge/PayPal-Sponsor-003087?logo=paypal&logoColor=white" alt="Sponsor with PayPal" />
135
- </a>
136
- <br />
137
- <sub>International sponsorship</sub>
138
- </td>
139
- </tr>
140
- </table>
141
-
142
- <table>
143
- <tr>
144
- <td align="center" width="220">
145
- <strong>Alipay</strong>
146
- <br />
147
- <img src="/blog/images/alipay.jpg" width="160" alt="Alipay QR code" />
148
- </td>
149
- <td align="center" width="220">
150
- <strong>WeChat Pay</strong>
151
- <br />
152
- <img src="/blog/images/wechat.jpg" width="160" alt="WeChat Pay QR code" />
153
- </td>
154
- </tr>
155
- </table>
156
-
157
- </div>
158
-
159
- ### Our Sponsors
160
-
161
- <div align="center">
162
-
163
- <p>A huge thank you to all our sponsors for their generous support.</p>
164
-
165
- <table width="100%">
166
- <tr>
167
- <td align="center" width="330">
168
- <a href="https://www.bigmodel.cn/claude-code?ic=FPF9IVAGFJ">
169
- <img src="/docs/public/provider-icons/zhipu-cn-general.png" width="42" height="42" alt="Zhipu icon" />
170
- <br />
171
- <strong>Z智谱</strong>
172
- </a>
173
- </td>
174
- <td align="center" width="330">
175
- <a href="https://aihubmix.com/">
176
- <img src="https://www.google.com/s2/favicons?domain=aihubmix.com&amp;sz=128" width="42" height="42" alt="AIHubmix icon" />
177
- <br />
178
- <strong>AIHubmix</strong>
179
- </a>
180
- </td>
181
- <td align="center" width="330">
182
- <a href="https://ai.burncloud.com">
183
- <img src="https://www.burncloud.com/favicon.png" width="42" height="42" alt="BurnCloud icon" />
184
- <br />
185
- <strong>BurnCloud</strong>
186
- </a>
187
- </td>
188
- <td align="center" width="330">
189
- <a href="https://share.302.ai/ZGVF9w">
190
- <img src="https://www.google.com/s2/favicons?domain=302.ai&amp;sz=128" width="42" height="42" alt="302.AI icon" />
191
- <br />
192
- <strong>302.AI</strong>
193
- </a>
194
- </td>
195
- </tr>
196
- <tr>
197
- <td align="center" width="330">
198
- <a href="https://runapi.co/register?aff=IX1t">
199
- <img src="/docs/public/provider-icons/runapi.jpg" width="42" height="42" alt="RunAPI icon" />
200
- <br />
201
- <strong>RunAPI</strong>
202
- </a>
203
- </td>
204
- <td align="center" width="330">
205
- <a href="https://teamorouter.com/">
206
- <img src="/docs/public/provider-icons/teamorouter.png" width="42" height="42" alt="TeamoRouter icon" />
207
- <br />
208
- <strong>TeamoRouter</strong>
209
- </a>
210
- </td>
211
- <td align="center" width="330">
212
- <a href="https://s.qiniu.com/AVjMVf">
213
- <img src="/docs/public/provider-icons/qiniu-ai.png" width="42" height="42" alt="Qiniu Cloud AI icon" />
214
- <br />
215
- <strong>Qiniu Cloud AI</strong>
216
- </a>
217
- </td>
218
- <td align="center" width="330">
219
- <a href="https://api.fenno.ai/register?redirect=/purchase?tab=subscription%26group=16&amp;aff=9HHHAB5QLAES">
220
- <img src="/docs/public/provider-icons/fenno.jpg" width="42" height="42" alt="Fenno.ai icon" />
221
- <br />
222
- <strong>Fenno.ai</strong>
223
- </a>
224
- </td>
225
- </tr>
226
- </table>
227
-
228
- <h4>Community Sponsors</h4>
229
-
230
- <table width="100%">
231
- <tr>
232
- <td align="center" width="220">@Simon Leischnig</td>
233
- <td align="center" width="220"><a href="https://github.com/duanshuaimin">@duanshuaimin</a></td>
234
- <td align="center" width="220"><a href="https://github.com/vrgitadmin">@vrgitadmin</a></td>
235
- <td align="center" width="220">@*o</td>
236
- <td align="center" width="220"><a href="https://github.com/ceilwoo">@ceilwoo</a></td>
237
- <td align="center" width="220">@*说</td>
238
- </tr>
239
- <tr>
240
- <td align="center" width="220">@*更</td>
241
- <td align="center" width="220">@K*g</td>
242
- <td align="center" width="220">@R*R</td>
243
- <td align="center" width="220"><a href="https://github.com/bobleer">@bobleer</a></td>
244
- <td align="center" width="220">@*苗</td>
245
- <td align="center" width="220">@*划</td>
246
- </tr>
247
- <tr>
248
- <td align="center" width="220"><a href="https://github.com/Clarence-pan">@Clarence-pan</a></td>
249
- <td align="center" width="220"><a href="https://github.com/carter003">@carter003</a></td>
250
- <td align="center" width="220">@S*r</td>
251
- <td align="center" width="220">@*晖</td>
252
- <td align="center" width="220">@*敏</td>
253
- <td align="center" width="220">@Z*z</td>
254
- </tr>
255
- <tr>
256
- <td align="center" width="220">@*然</td>
257
- <td align="center" width="220"><a href="https://github.com/cluic">@cluic</a></td>
258
- <td align="center" width="220">@*苗</td>
259
- <td align="center" width="220"><a href="https://github.com/PromptExpert">@PromptExpert</a></td>
260
- <td align="center" width="220">@*应</td>
261
- <td align="center" width="220"><a href="https://github.com/yusnake">@yusnake</a></td>
262
- </tr>
263
- <tr>
264
- <td align="center" width="220">@*飞</td>
265
- <td align="center" width="220">@董*</td>
266
- <td align="center" width="220">@*汀</td>
267
- <td align="center" width="220">@*涯</td>
268
- <td align="center" width="220">@*:-)</td>
269
- <td align="center" width="220">@**磊</td>
270
- </tr>
271
- <tr>
272
- <td align="center" width="220">@*琢</td>
273
- <td align="center" width="220">@*成</td>
274
- <td align="center" width="220">@Z*o</td>
275
- <td align="center" width="220">@*琨</td>
276
- <td align="center" width="220"><a href="https://github.com/congzhangzh">@congzhangzh</a></td>
277
- <td align="center" width="220">@*_</td>
278
- </tr>
279
- <tr>
280
- <td align="center" width="220">@Z*m</td>
281
- <td align="center" width="220">@*鑫</td>
282
- <td align="center" width="220">@c*y</td>
283
- <td align="center" width="220">@*昕</td>
284
- <td align="center" width="220"><a href="https://github.com/witsice">@witsice</a></td>
285
- <td align="center" width="220">@b*g</td>
286
- </tr>
287
- <tr>
288
- <td align="center" width="220">@*亿</td>
289
- <td align="center" width="220">@*辉</td>
290
- <td align="center" width="220">@JACK</td>
291
- <td align="center" width="220">@*光</td>
292
- <td align="center" width="220">@W*l</td>
293
- <td align="center" width="220"><a href="https://github.com/kesku">@kesku</a></td>
294
- </tr>
295
- <tr>
296
- <td align="center" width="220"><a href="https://github.com/biguncle">@biguncle</a></td>
297
- <td align="center" width="220">@二吉吉</td>
298
- <td align="center" width="220">@a*g</td>
299
- <td align="center" width="220">@*林</td>
300
- <td align="center" width="220">@*咸</td>
301
- <td align="center" width="220">@*明</td>
302
- </tr>
303
- <tr>
304
- <td align="center" width="220">@S*y</td>
305
- <td align="center" width="220">@f*o</td>
306
- <td align="center" width="220">@*智</td>
307
- <td align="center" width="220">@F*t</td>
308
- <td align="center" width="220">@r*c</td>
309
- <td align="center" width="220"><a href="https://github.com/qierkang">@qierkang</a></td>
310
- </tr>
311
- <tr>
312
- <td align="center" width="220">@*军</td>
313
- <td align="center" width="220"><a href="https://github.com/snrise-z">@snrise-z</a></td>
314
- <td align="center" width="220">@*王</td>
315
- <td align="center" width="220"><a href="https://github.com/greatheart1000">@greatheart1000</a></td>
316
- <td align="center" width="220">@*王</td>
317
- <td align="center" width="220">@zcutlip</td>
318
- </tr>
319
- <tr>
320
- <td align="center" width="220"><a href="https://github.com/Peng-YM">@Peng-YM</a></td>
321
- <td align="center" width="220">@*更</td>
322
- <td align="center" width="220">@*.</td>
323
- <td align="center" width="220">@F*t</td>
324
- <td align="center" width="220">@*政</td>
325
- <td align="center" width="220">@*铭</td>
326
- </tr>
327
- <tr>
328
- <td align="center" width="220">@*叶</td>
329
- <td align="center" width="220">@七*o</td>
330
- <td align="center" width="220">@*青</td>
331
- <td align="center" width="220">@**晨</td>
332
- <td align="center" width="220">@*远</td>
333
- <td align="center" width="220">@*霄</td>
334
- </tr>
335
- <tr>
336
- <td align="center" width="220">@**吉</td>
337
- <td align="center" width="220">@**飞</td>
338
- <td align="center" width="220">@**驰</td>
339
- <td align="center" width="220">@x*g</td>
340
- <td align="center" width="220">@**东</td>
341
- <td align="center" width="220">@*落</td>
342
- </tr>
343
- <tr>
344
- <td align="center" width="220">@哆*k</td>
345
- <td align="center" width="220">@*涛</td>
346
- <td align="center" width="220"><a href="https://github.com/WitMiao">@苗大</a></td>
347
- <td align="center" width="220">@*呢</td>
348
- <td align="center" width="220">@d*u</td>
349
- <td align="center" width="220">@crizcraig</td>
350
- </tr>
351
- <tr>
352
- <td align="center" width="220">s*s</td>
353
- <td align="center" width="220">*火</td>
354
- <td align="center" width="220">*勤</td>
355
- <td align="center" width="220">**锟</td>
356
- <td align="center" width="220">*涛</td>
357
- <td align="center" width="220">**明</td>
358
- </tr>
359
- <tr>
360
- <td align="center" width="220">*知</td>
361
- <td align="center" width="220">*语</td>
362
- <td align="center" width="220">*瓜</td>
363
- <td align="center" width="220"></td>
364
- <td align="center" width="220"></td>
365
- <td align="center" width="220"></td>
366
- </tr>
367
- </table>
368
-
369
- <sub>If your name is masked, please contact me via my homepage email to update it with your GitHub username.</sub>
370
-
371
- </div>
33
+ Start the background service and open the management UI:
34
+
35
+ ```sh
36
+ ccr ui
37
+ ```
38
+
39
+ Then:
40
+
41
+ 1. Add an upstream provider and at least one model.
42
+ 2. Create a CCR client key under **API Keys**.
43
+ 3. Configure routing if the default provider/model is not sufficient.
44
+ 4. Confirm that the gateway is running under **Server**.
45
+ 5. Point your client at the gateway URL shown in the UI. The default gateway is `http://127.0.0.1:3456`; the management UI defaults to `http://127.0.0.1:3458`.
46
+
47
+ The management token and CCR client API keys are different credentials. The management token protects the browser UI and RPC API. CCR client keys authenticate model requests sent to the gateway.
48
+
49
+ ## Service Commands
50
+
51
+ | Command | Behavior |
52
+ | --- | --- |
53
+ | `ccr start` | Starts a detached background management service and gateway, then prints its authenticated management URL. |
54
+ | `ccr ui` | Reuses or starts the background service and opens the management UI. |
55
+ | `ccr stop` | Stops the detached service started by `ccr start` or `ccr ui`. |
56
+ | `ccr serve` | Runs the management service and gateway in the foreground. `ccr web` is an alias. |
57
+ | `ccr <profile>` | Opens an enabled Agent Config profile by name or ID. |
58
+
59
+ ### `ccr start`
60
+
61
+ ```text
62
+ ccr start [--host <host>] [--port <port>] [--open|--no-open] [--gateway|--no-gateway]
63
+ ```
64
+
65
+ - `--host <host>`: management listener, default `127.0.0.1`.
66
+ - `--port <port>`: preferred management port, default `3458`.
67
+ - `--open` / `--no-open`: enable or disable opening a browser.
68
+ - `--gateway`: explicitly request gateway startup; this is the default.
69
+ - `--no-gateway`: start only the management service.
70
+
71
+ ### `ccr ui`
72
+
73
+ ```text
74
+ ccr ui [--host <host>] [--port <port>] [--open|--no-open] [--gateway|--no-gateway]
75
+ ```
76
+
77
+ `ui` opens the browser by default. Use `--no-open` on SSH or other headless sessions.
78
+
79
+ ### `ccr serve`
80
+
81
+ ```text
82
+ ccr serve [--host <host>] [--port <port>] [--open|--no-open] [--gateway|--no-gateway]
83
+ ```
84
+
85
+ `serve` stays attached to the current terminal and handles `SIGINT`/`SIGTERM`. It is the appropriate mode for a process supervisor. `ccr stop` only manages the detached service; stop a foreground server through its terminal or supervisor.
86
+
87
+ If the preferred management port is occupied, CCR tries the next available ports and prints the actual URL. When `start` or `ui` reuses an existing service, new host, port, and `--no-gateway` choices do not reconfigure that process. Run `ccr stop` first when those settings must change.
88
+
89
+ ## Agent Config Profiles
90
+
91
+ Create and enable profiles in **Agent Config**, then launch one by name or ID:
92
+
93
+ ```sh
94
+ ccr "Codex - Work"
95
+ ccr "Codex - Work" app
96
+ ccr "Claude - Review" cli -- --model sonnet
97
+ ccr profile-id -- --help
98
+ ```
99
+
100
+ The syntax is:
101
+
102
+ ```text
103
+ ccr <profile-name-or-id> [cli|app] [-- <agent arguments>]
104
+ ```
105
+
106
+ - `--cli` and `--app` are accepted alternatives to the positional surface.
107
+ - Put agent-specific arguments after `--` so they cannot be confused with CCR options.
108
+ - If the surface is omitted, CCR uses the first surface allowed by the profile: CLI for Claude Code, Codex, and Grok CLI; App for ZCode.
109
+ - Grok supports CLI only. ZCode supports App only. Claude App and ZCode App do not accept trailing agent arguments.
110
+ - Desktop App launches require that app to be installed and a graphical session to be available.
111
+ - Start the CCR service before opening most profiles. A Grok CLI profile can start a temporary shared service automatically and stops it after the last managed session exits.
112
+
113
+ The desktop application installs a related command named `ccr-app`. Commands copied from desktop Agent Config cards use `ccr-app`; the npm package documented here installs `ccr`.
114
+
115
+ ## Configuration And Runtime Files
116
+
117
+ | Platform | Config directory |
118
+ | --- | --- |
119
+ | macOS / Linux | `~/.claude-code-router` |
120
+ | Windows | `%APPDATA%\claude-code-router` |
121
+
122
+ Important files include:
123
+
124
+ - `config.sqlite`: current application configuration.
125
+ - `app-data/`: API key, usage, request-log, certificate, and other runtime databases/files.
126
+ - `service.json`: state and private token for a detached CLI service.
127
+ - `gateway.config.json`: generated gateway runtime configuration.
128
+ - `profiles/` and `bin/`: isolated profile configuration and launch wrappers.
129
+
130
+ Do not edit or copy live SQLite files while CCR is writing to them. Use the UI export feature, or stop CCR before taking a filesystem backup.
131
+
132
+ ## Environment And Security
133
+
134
+ | Variable | Description |
135
+ | --- | --- |
136
+ | `CCR_WEB_HOST` | Default management listener when `--host` is omitted. |
137
+ | `CCR_WEB_PORT` | Default management port when `--port` is omitted. |
138
+ | `CCR_WEB_AUTH_TOKEN` | Fixes the management UI/RPC token instead of generating a random token for the process. |
139
+
140
+ The authenticated management URL contains `ccr_web_token` in its query string. Treat that URL like a password and avoid copying it into logs, tickets, or shell history. Bind to `127.0.0.1` unless remote access is intentional. For remote access, use a firewall or private network plus TLS at a trusted reverse proxy.
141
+
142
+ Do not expose the gateway without creating CCR client API keys. Upstream provider credentials are stored in CCR's local data directory, so protect that directory and its backups.
143
+
144
+ ## Troubleshooting
145
+
146
+ ### `ccr` is not found
147
+
148
+ Confirm Node.js is version 22 or later and that npm's global binary directory is on `PATH`:
149
+
150
+ ```sh
151
+ node --version
152
+ npm prefix -g
153
+ ```
154
+
155
+ Open a new shell after installation if your shell caches command paths.
156
+
157
+ ### The management URL changed ports
158
+
159
+ The requested port was already occupied. Use the URL printed by CCR, or stop the conflicting process and restart CCR.
160
+
161
+ ### The UI opens but the gateway is unavailable
162
+
163
+ The management service can run without a usable gateway. Add a provider and model, create a client API key, then start or restart the gateway from **Server**. Check the foreground output from `ccr serve` when diagnosing startup errors.
164
+
165
+ ### A profile cannot be found
166
+
167
+ Only enabled profiles are launchable. Names are matched without case and sanitized names are accepted, but ambiguous names require the profile ID. Re-save the profile if its generated launcher is missing.
168
+
169
+ ### A background service uses old options
170
+
171
+ Stop and recreate it:
172
+
173
+ ```sh
174
+ ccr stop
175
+ ccr start --host 127.0.0.1 --port 3458
176
+ ```
177
+
178
+ ## Docker
179
+
180
+ The repository also includes a Docker image for gateway and browser-UI deployments. It does not install the npm `ccr` command into the runtime image. See the [Docker deployment guide](https://github.com/musistudio/claude-code-router/blob/main/docker/README.md).
372
181
 
373
182
  ## License
374
183
 
375
- This project is licensed under the [MIT License](LICENSE).
184
+ [MIT](LICENSE)