@wengine-ai/llms 2.0.80 → 2.0.82
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 +83 -0
- package/dist/cjs/server.cjs +138 -138
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/esm/server.mjs +139 -139
- package/dist/esm/server.mjs.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
|
|
34
34
|
### 1. Installation
|
|
35
35
|
|
|
36
|
+
You can install Claude Code Router either from the npm registry or directly from this GitHub repository for the latest development version.
|
|
37
|
+
|
|
38
|
+
#### Option A: Install from npm registry (Stable)
|
|
39
|
+
|
|
36
40
|
First, ensure you have [Claude Code](https://docs.anthropic.com/en/docs/claude-code/quickstart) installed:
|
|
37
41
|
|
|
38
42
|
```shell
|
|
@@ -45,6 +49,43 @@ Then, install Claude Code Router:
|
|
|
45
49
|
npm install -g @wengine-ai/claude-code-router
|
|
46
50
|
```
|
|
47
51
|
|
|
52
|
+
#### Option B: Install from GitHub (Latest Development Version)
|
|
53
|
+
|
|
54
|
+
If you want to use the latest features and bug fixes directly from the source code:
|
|
55
|
+
|
|
56
|
+
1. **Uninstall the current version first** (to prevent command conflicts):
|
|
57
|
+
```shell
|
|
58
|
+
npm uninstall -g @wengine-ai/claude-code-router @musistudio/claude-code-router
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Clone and link locally** (recommended for developers):
|
|
62
|
+
```shell
|
|
63
|
+
git clone https://github.com/xiaoliu10/claude-code-router.git
|
|
64
|
+
cd claude-code-router
|
|
65
|
+
pnpm install
|
|
66
|
+
pnpm build
|
|
67
|
+
npm link
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
*Alternatively, install directly from GitHub globally:*
|
|
71
|
+
```shell
|
|
72
|
+
npm install -g github:xiaoliu10/claude-code-router
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### 🔄 Migrating from the Official Upstream (@musistudio/claude-code-router)
|
|
76
|
+
|
|
77
|
+
If you are currently using the upstream community version `@musistudio/claude-code-router` and want to switch to this repository's version (`@wengine-ai/claude-code-router`) for advanced features (e.g. enhanced token-limit UI bars, DeepSeek thinking compatibilities, active health probes):
|
|
78
|
+
|
|
79
|
+
1. **Uninstall the upstream community version**:
|
|
80
|
+
```shell
|
|
81
|
+
npm uninstall -g @musistudio/claude-code-router
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
2. **Install this version**:
|
|
85
|
+
```shell
|
|
86
|
+
npm install -g @wengine-ai/claude-code-router
|
|
87
|
+
```
|
|
88
|
+
|
|
48
89
|
### 2. Configuration
|
|
49
90
|
|
|
50
91
|
Create and configure your `~/.claude-code-router/config.json` file. For more details, you can refer to `config.example.json`.
|
|
@@ -205,6 +246,48 @@ Here is a comprehensive example:
|
|
|
205
246
|
}
|
|
206
247
|
```
|
|
207
248
|
|
|
249
|
+
### 🔑 API Key / Token Guide
|
|
250
|
+
|
|
251
|
+
To use the router, you need to acquire API Keys from your preferred LLM providers. Below are guides for some popular providers:
|
|
252
|
+
|
|
253
|
+
#### 1. Zhipu AI (BigModel / GLM CODING PLAN)
|
|
254
|
+
* **Platform**: Zhipu BigModel Platform (sponsored partner)
|
|
255
|
+
* **Link**: [Zhipu AI BigModel Platform](https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII) (Use this referral link for a 10% discount on GLM CODING PLAN)
|
|
256
|
+
* **Acquisition Methods**:
|
|
257
|
+
* **Method A: Standard Developer API Key (Pay-as-you-go)**
|
|
258
|
+
1. Register and log in using the link above.
|
|
259
|
+
2. Go to the top-right **Console** -> **API Keys**.
|
|
260
|
+
3. Copy your API Key.
|
|
261
|
+
* **Method B: GLM CODING PLAN Web Token (Recommended for Subscription Users)**
|
|
262
|
+
If you are using the AI coding subscription plan (monthly flat-rate), you need to get your browser's session `Authorization` token:
|
|
263
|
+
1. Log in to the [Zhipu AI BigModel Platform](https://www.bigmodel.cn/claude-code?ic=RRVJPB5SII).
|
|
264
|
+
2. Open your browser's Developer Tools (F12) and go to the **Network** tab.
|
|
265
|
+
3. Refresh the page or click on any feature (e.g., check your usage). Look for any XHR/Fetch request (such as `usage`, `interfaceacting.js`, etc.).
|
|
266
|
+
4. Inspect the **Request Headers** of that request, locate the **`Authorization`** header, and copy its entire value (which starts with `Bearer eyJ...`).
|
|
267
|
+
5. Paste this copied `Bearer ...` token into your `api_key` configuration.
|
|
268
|
+
|
|
269
|
+

|
|
270
|
+
|
|
271
|
+
#### 2. Alibaba Cloud (DashScope / Bailian / Qwen-Coder)
|
|
272
|
+
* **Platform**: Alibaba Cloud Bailian (highly capable Qwen-Coder models)
|
|
273
|
+
* **Link**: [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/)
|
|
274
|
+
* **Acquisition Methods**:
|
|
275
|
+
* **Method A: Standard Developer API Key (For Request Routing)**
|
|
276
|
+
1. Log in to Alibaba Cloud and enable the "Bailian" model service.
|
|
277
|
+
2. Go to the Bailian Console, click on your **profile icon** in the top-right corner.
|
|
278
|
+
3. Click on **API-KEY** in the dropdown.
|
|
279
|
+
4. Click **Create New API-KEY** and copy the generated key.
|
|
280
|
+
* **Method B: Aliyun Console Cookie (For Quota Visualization in UI)**
|
|
281
|
+
If you want the Claude Code Router UI to fetch and display your beautiful monthly **GLM/Qwen Coding Plan** quota progress bars, you need to configure your console session `Cookie` as `quotaToken` in your configuration:
|
|
282
|
+
1. Log in to the [Alibaba Cloud Bailian Console](https://bailian.console.aliyun.com/).
|
|
283
|
+
2. Open your browser's Developer Tools (F12) and switch to the **Network** tab.
|
|
284
|
+
3. Click the **Refresh** (用量刷新) button on the console's usage cards.
|
|
285
|
+
4. Look for an API request starting with `api.json?action=BroadScope...` in the network log.
|
|
286
|
+
5. Select the request, find the **`Cookie`** header under **Request Headers**, and copy its entire value.
|
|
287
|
+
6. Paste this copied cookie string as the **`quotaToken`** property inside the Alibaba Cloud provider block in your `config.json`.
|
|
288
|
+
|
|
289
|
+

|
|
290
|
+
|
|
208
291
|
### 3. Running Claude Code with the Router
|
|
209
292
|
|
|
210
293
|
Start Claude Code using the router:
|