@musistudio/claude-code-router 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@musistudio/claude-code-router",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
5
5
  "bin": {
6
6
  "ccr": "./dist/cli.js"
7
7
  },
8
8
  "scripts": {
9
- "build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js && shx cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm",
9
+ "build": "node scripts/build.js",
10
10
  "release": "npm run build && npm publish"
11
11
  },
12
12
  "keywords": [
@@ -19,9 +19,11 @@
19
19
  "author": "musistudio",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@musistudio/llms": "^1.0.15",
22
+ "@fastify/static": "^8.2.0",
23
+ "@musistudio/llms": "^1.0.16",
23
24
  "dotenv": "^16.4.7",
24
25
  "json5": "^2.2.3",
26
+ "openurl": "^1.1.1",
25
27
  "tiktoken": "^1.0.21",
26
28
  "uuid": "^11.1.0"
27
29
  },
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ console.log('Building Claude Code Router...');
8
+
9
+ try {
10
+ // Build the main CLI application
11
+ console.log('Building CLI application...');
12
+ execSync('esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js', { stdio: 'inherit' });
13
+
14
+ // Copy the tiktoken WASM file
15
+ console.log('Copying tiktoken WASM file...');
16
+ execSync('shx cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm', { stdio: 'inherit' });
17
+
18
+ // Build the UI
19
+ console.log('Building UI...');
20
+ // Check if node_modules exists in ui directory, if not install dependencies
21
+ if (!fs.existsSync('ui/node_modules')) {
22
+ console.log('Installing UI dependencies...');
23
+ execSync('cd ui && npm install', { stdio: 'inherit' });
24
+ }
25
+ execSync('cd ui && npm run build', { stdio: 'inherit' });
26
+
27
+ // Copy the built UI index.html to dist
28
+ console.log('Copying UI build artifacts...');
29
+ execSync('shx cp ui/dist/index.html dist/index.html', { stdio: 'inherit' });
30
+
31
+ console.log('Build completed successfully!');
32
+ } catch (error) {
33
+ console.error('Build failed:', error.message);
34
+ process.exit(1);
35
+ }
package/ui/PROJECT.md ADDED
@@ -0,0 +1,23 @@
1
+ # 项目指南
2
+
3
+ > 这是一个用于设置配置的前端项目,配置格式参考config.example.json
4
+
5
+ ## 技术栈
6
+ 1. 使用pnpm作为包管理工具
7
+ 2. 使用vite.js作为构建工具
8
+ 3. 使用react.js + tailwindcss + shadcn-ui构建前端界面
9
+
10
+ ## UI设计
11
+ 采用现代化的UI风格,让界面整体体现出呼吸感。整体配置应该简洁和通俗易懂,需要有必要的校验,易用的交互体验。
12
+
13
+ ## 接口设计
14
+ 不需要实现任何接口,但你需要根据config.example.json文件的内容mock数据
15
+
16
+ ## 代码指引
17
+ 在使用任何库之前你都需要使用websearch工具查找最新的文档,不要使用你知识库的内容,即使是显而易见的你以为的确定性的知识。
18
+
19
+ ## 多语言设计
20
+ 项目需要同时支持中文和英文
21
+
22
+ ## 构建发布
23
+ 最后需要构建出一个HTML文件,其中所有的js和css采用内联的方式,构建产物应该只包含一个html文件。
package/ui/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
+
14
+ ```js
15
+ export default tseslint.config([
16
+ globalIgnores(['dist']),
17
+ {
18
+ files: ['**/*.{ts,tsx}'],
19
+ extends: [
20
+ // Other configs...
21
+
22
+ // Remove tseslint.configs.recommended and replace with this
23
+ ...tseslint.configs.recommendedTypeChecked,
24
+ // Alternatively, use this for stricter rules
25
+ ...tseslint.configs.strictTypeChecked,
26
+ // Optionally, add this for stylistic rules
27
+ ...tseslint.configs.stylisticTypeChecked,
28
+
29
+ // Other configs...
30
+ ],
31
+ languageOptions: {
32
+ parserOptions: {
33
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
34
+ tsconfigRootDir: import.meta.dirname,
35
+ },
36
+ // other options...
37
+ },
38
+ },
39
+ ])
40
+ ```
41
+
42
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
43
+
44
+ ```js
45
+ // eslint.config.js
46
+ import reactX from 'eslint-plugin-react-x'
47
+ import reactDom from 'eslint-plugin-react-dom'
48
+
49
+ export default tseslint.config([
50
+ globalIgnores(['dist']),
51
+ {
52
+ files: ['**/*.{ts,tsx}'],
53
+ extends: [
54
+ // Other configs...
55
+ // Enable lint rules for React
56
+ reactX.configs['recommended-typescript'],
57
+ // Enable lint rules for React DOM
58
+ reactDom.configs.recommended,
59
+ ],
60
+ languageOptions: {
61
+ parserOptions: {
62
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
63
+ tsconfigRootDir: import.meta.dirname,
64
+ },
65
+ // other options...
66
+ },
67
+ },
68
+ ])
69
+ ```
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ },
20
+ "iconLibrary": "lucide"
21
+ }
@@ -0,0 +1,177 @@
1
+ {
2
+ "LOG": true,
3
+ "CLAUDE_PATH": "/Users/jinhuilee/.claude/local/claude",
4
+ "HOST": "127.0.0.1",
5
+ "PORT": 8080,
6
+ "APIKEY": "1",
7
+ "transformers": [
8
+ {
9
+ "path": "/Users/abc/.claude-code-router/plugins/gemini-cli.js",
10
+ "options": {
11
+ "project": "x"
12
+ }
13
+ }
14
+ ],
15
+ "Providers": [
16
+ {
17
+ "name": "siliconflow",
18
+ "api_base_url": "https://api.moonshot.cn/v1/chat/completions",
19
+ "api_key": "sk-",
20
+ "models": [
21
+ "kimi-k2-0711-preview"
22
+ ],
23
+ "transformer": {
24
+ "use": [
25
+ [
26
+ "maxtoken",
27
+ {
28
+ "max_tokens": 130000
29
+ }
30
+ ]
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "name": "kimi",
36
+ "api_base_url": "https://api.moonshot.cn/v1/chat/completions",
37
+ "api_key": "sk-",
38
+ "models": [
39
+ "kimi-k2-0711-preview"
40
+ ]
41
+ },
42
+ {
43
+ "name": "groq",
44
+ "api_base_url": "https://api.groq.com/openai/v1/chat/completions",
45
+ "api_key": "",
46
+ "models": [
47
+ "moonshotai/kimi-k2-instruct"
48
+ ],
49
+ "transformer": {
50
+ "use": [
51
+ [
52
+ "maxtoken",
53
+ {
54
+ "max_tokens": 16384
55
+ }
56
+ ],
57
+ "groq"
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "name": "openrouter",
63
+ "api_base_url": "https://openrouter.ai/api/v1/chat/completions",
64
+ "api_key": "sk-or-v1-",
65
+ "models": [
66
+ "google/gemini-2.5-pro-preview",
67
+ "anthropic/claude-sonnet-4",
68
+ "anthropic/claude-3.5-sonnet",
69
+ "anthropic/claude-3.7-sonnet:thinking",
70
+ "deepseek/deepseek-chat-v3-0324",
71
+ "@preset/kimi"
72
+ ],
73
+ "transformer": {
74
+ "use": [
75
+ "openrouter"
76
+ ],
77
+ "deepseek/deepseek-chat-v3-0324": {
78
+ "use": [
79
+ "tooluse"
80
+ ]
81
+ }
82
+ }
83
+ },
84
+ {
85
+ "name": "deepseek",
86
+ "api_base_url": "https://api.deepseek.com/chat/completions",
87
+ "api_key": "sk-",
88
+ "models": [
89
+ "deepseek-chat",
90
+ "deepseek-reasoner"
91
+ ],
92
+ "transformer": {
93
+ "use": [
94
+ "deepseek"
95
+ ],
96
+ "deepseek-chat": {
97
+ "use": [
98
+ "tooluse"
99
+ ]
100
+ }
101
+ }
102
+ },
103
+ {
104
+ "name": "test",
105
+ "api_base_url": "https://tbai.xin/v1/chat/completions",
106
+ "api_key": "sk-",
107
+ "models": [
108
+ "gemini-2.5-pro"
109
+ ]
110
+ },
111
+ {
112
+ "name": "ollama",
113
+ "api_base_url": "http://localhost:11434/v1/chat/completions",
114
+ "api_key": "ollama",
115
+ "models": [
116
+ "qwen2.5-coder:latest"
117
+ ]
118
+ },
119
+ {
120
+ "name": "gemini",
121
+ "api_base_url": "https://generativelanguage.googleapis.com/v1beta/models/",
122
+ "api_key": "",
123
+ "models": [
124
+ "gemini-2.5-flash",
125
+ "gemini-2.5-pro"
126
+ ],
127
+ "transformer": {
128
+ "use": [
129
+ "gemini"
130
+ ]
131
+ }
132
+ },
133
+ {
134
+ "name": "volcengine",
135
+ "api_base_url": "https://ark.cn-beijing.volces.com/api/v3/chat/completions",
136
+ "api_key": "sk-xxx",
137
+ "models": [
138
+ "deepseek-v3-250324",
139
+ "deepseek-r1-250528"
140
+ ],
141
+ "transformer": {
142
+ "use": [
143
+ "deepseek"
144
+ ]
145
+ }
146
+ },
147
+ {
148
+ "name": "gemini-cli",
149
+ "api_base_url": "https://cloudcode-pa.googleapis.com/v1internal",
150
+ "api_key": "sk-xxx",
151
+ "models": [
152
+ "gemini-2.5-flash",
153
+ "gemini-2.5-pro"
154
+ ],
155
+ "transformer": {
156
+ "use": [
157
+ "gemini-cli"
158
+ ]
159
+ }
160
+ },
161
+ {
162
+ "name": "azure",
163
+ "api_base_url": "https://your-resource-name.openai.azure.com/",
164
+ "api_key": "",
165
+ "models": [
166
+ "gpt-4"
167
+ ]
168
+ }
169
+ ],
170
+ "Router": {
171
+ "default": "gemini-cli,gemini-2.5-pro",
172
+ "background": "gemini-cli,gemini-2.5-flash",
173
+ "think": "gemini-cli,gemini-2.5-pro",
174
+ "longContext": "gemini-cli,gemini-2.5-pro",
175
+ "webSearch": "gemini-cli,gemini-2.5-flash"
176
+ }
177
+ }