claude-code-router-config 1.0.0 → 1.1.0
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 +190 -18
- package/cli/analytics.js +509 -0
- package/cli/benchmark.js +342 -0
- package/cli/commands.js +300 -0
- package/config/smart-intent-router.js +543 -0
- package/docs/AGENTSKILLS_INTEGRATION.md +500 -0
- package/docs/AGENTSKILLS_SETUP.md +743 -0
- package/docs/AGENTSKILLS_SETUP_TR.md +736 -0
- package/docs/FULL_DOCUMENTATION.md +23 -2
- package/docs/FULL_DOCUMENTATION_EN.md +23 -2
- package/docs/HOMEBREW_SETUP.md +252 -0
- package/docs/v1.1.0-FEATURES.md +752 -0
- package/logging/enhanced-logger.js +410 -0
- package/logging/health-monitor.js +472 -0
- package/logging/middleware.js +384 -0
- package/package.json +42 -10
- package/plugins/plugin-manager.js +607 -0
- package/templates/README.md +161 -0
- package/templates/balanced.json +111 -0
- package/templates/cost-optimized.json +96 -0
- package/templates/development.json +104 -0
- package/templates/performance-optimized.json +88 -0
- package/templates/quality-focused.json +105 -0
- package/web-dashboard/public/css/dashboard.css +575 -0
- package/web-dashboard/public/index.html +308 -0
- package/web-dashboard/public/js/dashboard.js +512 -0
- package/web-dashboard/server.js +352 -0
package/README.md
CHANGED
|
@@ -1,13 +1,50 @@
|
|
|
1
|
-
# Claude Code Router - Multi-Provider Setup
|
|
1
|
+
# Claude Code Router Config - Advanced Multi-Provider Setup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
🚀 **v1.1.0** - Now with advanced CLI tools, analytics, smart routing, and configuration templates!
|
|
4
|
+
|
|
5
|
+
Use Claude Code as a single interface to access multiple AI providers with intelligent routing for optimal performance, cost, and quality.
|
|
6
|
+
|
|
7
|
+
## ✨ New Features in v1.1.0
|
|
8
|
+
|
|
9
|
+
### 🛠️ Advanced CLI Tools
|
|
10
|
+
```bash
|
|
11
|
+
ccr test <provider> [model] # Test provider connectivity
|
|
12
|
+
ccr benchmark --compare-speed # Benchmark all providers
|
|
13
|
+
ccr analytics today # View usage statistics
|
|
14
|
+
ccr config validate # Validate configuration
|
|
15
|
+
ccr health --all-providers # Check provider health
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 📊 Analytics & Monitoring
|
|
19
|
+
- **Cost Tracking**: Monitor spending per provider and model
|
|
20
|
+
- **Usage Analytics**: Track requests, latency, and success rates
|
|
21
|
+
- **Performance Metrics**: Detailed performance insights
|
|
22
|
+
- **Health Monitoring**: Real-time provider health checks
|
|
23
|
+
|
|
24
|
+
### 🧠 Smart Routing Engine
|
|
25
|
+
- **Adaptive Routing**: Learns from past performance
|
|
26
|
+
- **Cost-Aware Selection**: Optimizes for budget constraints
|
|
27
|
+
- **Performance-Based**: Prioritizes speed when needed
|
|
28
|
+
- **Quality-Focused**: Ensures best results for critical tasks
|
|
29
|
+
|
|
30
|
+
### 📋 Configuration Templates
|
|
31
|
+
```bash
|
|
32
|
+
ccr config template performance-optimized # Speed prioritized
|
|
33
|
+
ccr config template cost-optimized # Budget friendly
|
|
34
|
+
ccr config template quality-focused # Maximum quality
|
|
35
|
+
ccr config template development # Coding optimized
|
|
36
|
+
ccr config template balanced # Best of all worlds
|
|
37
|
+
```
|
|
4
38
|
|
|
5
39
|
## Features
|
|
6
40
|
|
|
7
41
|
- **7 Provider Support**: OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, GitHub Copilot
|
|
8
|
-
- **Intent-Based Routing**: Automatically selects the best model based on your request
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
42
|
+
- **Smart Intent-Based Routing**: Automatically selects the best model based on your request
|
|
43
|
+
- **Advanced CLI Tools**: Test, benchmark, analyze, and monitor your setup
|
|
44
|
+
- **Analytics & Cost Tracking**: Detailed insights into usage and spending
|
|
45
|
+
- **Configuration Templates**: Pre-optimized setups for different use cases
|
|
46
|
+
- **Health Monitoring**: Real-time provider status and automatic failover
|
|
47
|
+
- **Enhanced Logging**: Detailed logs with metrics and performance data
|
|
11
48
|
|
|
12
49
|
## Routing Strategy
|
|
13
50
|
|
|
@@ -21,24 +58,35 @@ Use Claude Code as a single interface to access multiple AI providers with inten
|
|
|
21
58
|
| Complex algorithms | OpenAI | o1 |
|
|
22
59
|
| Coding assistance | GitHub Copilot | copilot |
|
|
23
60
|
|
|
24
|
-
##
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### Option 1: Homebrew (Recommended)
|
|
25
64
|
|
|
26
65
|
```bash
|
|
27
|
-
|
|
28
|
-
cd claude-code-router-config
|
|
29
|
-
chmod +x install.sh
|
|
30
|
-
./install.sh
|
|
66
|
+
brew install halilertekin/tap/claude-code-router-config
|
|
31
67
|
```
|
|
32
68
|
|
|
33
|
-
|
|
69
|
+
After installation, edit your API keys in `~/.env` and start the router:
|
|
70
|
+
```bash
|
|
71
|
+
ccr code
|
|
72
|
+
```
|
|
34
73
|
|
|
35
|
-
###
|
|
74
|
+
### Option 2: NPM
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm add -g claude-code-router-config
|
|
78
|
+
ccr-setup
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Option 3: Manual Setup
|
|
82
|
+
|
|
83
|
+
#### 1. Install Dependencies
|
|
36
84
|
|
|
37
85
|
```bash
|
|
38
86
|
pnpm add -g @musistudio/claude-code-router
|
|
39
87
|
```
|
|
40
88
|
|
|
41
|
-
|
|
89
|
+
#### 2. Copy Configuration Files
|
|
42
90
|
|
|
43
91
|
```bash
|
|
44
92
|
mkdir -p ~/.claude-code-router
|
|
@@ -46,7 +94,7 @@ cp config/config.json ~/.claude-code-router/
|
|
|
46
94
|
cp config/intent-router.js ~/.claude-code-router/
|
|
47
95
|
```
|
|
48
96
|
|
|
49
|
-
|
|
97
|
+
#### 3. Set Up Environment Variables
|
|
50
98
|
|
|
51
99
|
Create `.env` file:
|
|
52
100
|
|
|
@@ -72,7 +120,7 @@ export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
|
|
|
72
120
|
export NO_PROXY="127.0.0.1"
|
|
73
121
|
```
|
|
74
122
|
|
|
75
|
-
|
|
123
|
+
#### 4. Start Router
|
|
76
124
|
|
|
77
125
|
```bash
|
|
78
126
|
source ~/.zshrc
|
|
@@ -81,12 +129,62 @@ ccr code
|
|
|
81
129
|
|
|
82
130
|
## Usage
|
|
83
131
|
|
|
132
|
+
### 🔧 Advanced CLI Commands
|
|
133
|
+
|
|
134
|
+
#### Testing & Benchmarking
|
|
135
|
+
```bash
|
|
136
|
+
# Test provider connectivity
|
|
137
|
+
ccr test openai gpt-4o
|
|
138
|
+
ccr test anthropic claude-sonnet-4-latest
|
|
139
|
+
|
|
140
|
+
# Benchmark all providers
|
|
141
|
+
ccr benchmark --all --compare-speed
|
|
142
|
+
ccr benchmark full 5 --provider=openai --provider=anthropic
|
|
143
|
+
|
|
144
|
+
# Load testing
|
|
145
|
+
ccr benchmark load openai gpt-4o --concurrent=5 --duration=30
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Configuration Management
|
|
149
|
+
```bash
|
|
150
|
+
# Validate configuration
|
|
151
|
+
ccr config validate
|
|
152
|
+
|
|
153
|
+
# Backup configuration
|
|
154
|
+
ccr config backup
|
|
155
|
+
|
|
156
|
+
# Apply templates
|
|
157
|
+
ccr config template performance-optimized
|
|
158
|
+
ccr config template cost-optimized
|
|
159
|
+
ccr config template quality-focused
|
|
160
|
+
ccr config template development
|
|
161
|
+
ccr config template balanced
|
|
162
|
+
|
|
163
|
+
# Show detailed status with costs
|
|
164
|
+
ccr status --detailed --show-costs
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### Analytics & Monitoring
|
|
168
|
+
```bash
|
|
169
|
+
# View today's analytics
|
|
170
|
+
ccr analytics today --detailed
|
|
171
|
+
|
|
172
|
+
# View period analytics
|
|
173
|
+
ccr analytics week --detailed
|
|
174
|
+
ccr analytics month --detailed
|
|
175
|
+
|
|
176
|
+
# Export data
|
|
177
|
+
ccr analytics export --format=csv --period=month
|
|
178
|
+
|
|
179
|
+
# Health monitoring
|
|
180
|
+
ccr health --all-providers
|
|
181
|
+
```
|
|
182
|
+
|
|
84
183
|
### Basic Commands
|
|
85
184
|
|
|
86
185
|
```bash
|
|
87
186
|
ccr start # Start router
|
|
88
187
|
ccr code # Start with Claude Code
|
|
89
|
-
ccr status # Check status
|
|
90
188
|
ccr stop # Stop router
|
|
91
189
|
```
|
|
92
190
|
|
|
@@ -127,17 +225,87 @@ claude "Translate to Chinese: Hello" # → GLM
|
|
|
127
225
|
claude "Help me debug this React component" # → GitHub Copilot
|
|
128
226
|
```
|
|
129
227
|
|
|
228
|
+
## Configuration Templates
|
|
229
|
+
|
|
230
|
+
| Template | Best For | Priority | Cost | Speed |
|
|
231
|
+
|----------|----------|----------|------|-------|
|
|
232
|
+
| **performance-optimized** | Real-time apps, chatbots | Speed | Low | ⭐⭐⭐⭐⭐ |
|
|
233
|
+
| **cost-optimized** | Budget-conscious, bulk processing | Cost | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
|
|
234
|
+
| **quality-focused** | Critical tasks, research | Quality | High | ⭐⭐ |
|
|
235
|
+
| **development** | Coding, debugging | Coding | Medium | ⭐⭐⭐⭐ |
|
|
236
|
+
| **balanced** | General use | Balanced | Medium | ⭐⭐⭐⭐ |
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Quick template selection
|
|
240
|
+
ccr config template performance-optimized # Fastest
|
|
241
|
+
ccr config template cost-optimized # Cheapest
|
|
242
|
+
ccr config template quality-focused # Best quality
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Smart Routing Features
|
|
246
|
+
|
|
247
|
+
### 🧠 Adaptive Intelligence
|
|
248
|
+
- **Learning**: Improves routing based on historical performance
|
|
249
|
+
- **Context Awareness**: Considers request complexity and timing
|
|
250
|
+
- **Cost Awareness**: Respects budget constraints and optimization goals
|
|
251
|
+
|
|
252
|
+
### 🔄 Auto-Fallback
|
|
253
|
+
- **Health Checks**: Monitors provider status every 30 seconds
|
|
254
|
+
- **Circuit Breaker**: Automatically routes around failed providers
|
|
255
|
+
- **Graceful Degradation**: Maintains service during provider issues
|
|
256
|
+
|
|
257
|
+
### 📈 Performance Optimization
|
|
258
|
+
- **Latency Tracking**: Monitors and optimizes for speed
|
|
259
|
+
- **Success Rate**: Reliability-based routing decisions
|
|
260
|
+
- **Load Balancing**: Distributes requests optimally
|
|
261
|
+
|
|
262
|
+
## Analytics Dashboard
|
|
263
|
+
|
|
264
|
+
View comprehensive analytics via:
|
|
265
|
+
```bash
|
|
266
|
+
# Web Dashboard (if enabled)
|
|
267
|
+
ccr ui
|
|
268
|
+
|
|
269
|
+
# CLI Analytics
|
|
270
|
+
ccr analytics today --detailed
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Metrics tracked:
|
|
274
|
+
- Request volume and patterns
|
|
275
|
+
- Cost per provider/model
|
|
276
|
+
- Response times and latency
|
|
277
|
+
- Success/error rates
|
|
278
|
+
- Provider health status
|
|
279
|
+
|
|
130
280
|
## Documentation
|
|
131
281
|
|
|
132
282
|
- [Complete Documentation (EN)](docs/FULL_DOCUMENTATION_EN.md)
|
|
283
|
+
- [Complete Documentation (TR)](docs/FULL_DOCUMENTATION.md)
|
|
133
284
|
- [Setup Prompt (EN)](docs/SETUP_PROMPT_EN.md)
|
|
134
285
|
- [Setup Prompt (TR)](docs/SETUP_PROMPT.md)
|
|
286
|
+
- [Configuration Templates Guide](templates/README.md)
|
|
287
|
+
|
|
288
|
+
## What's New
|
|
289
|
+
|
|
290
|
+
### v1.1.0 Features
|
|
291
|
+
- ✨ Advanced CLI tools for testing and benchmarking
|
|
292
|
+
- 📊 Built-in analytics and cost tracking
|
|
293
|
+
- 🧠 Smart routing with machine learning
|
|
294
|
+
- 📋 Configuration templates for different use cases
|
|
295
|
+
- 🔍 Health monitoring and auto-fallback
|
|
296
|
+
- 📝 Enhanced logging with metrics
|
|
297
|
+
|
|
298
|
+
### Coming Soon
|
|
299
|
+
- 🌐 Enhanced web dashboard
|
|
300
|
+
- 🔌 Plugin system for custom providers
|
|
301
|
+
- 🤖 AI-powered optimization recommendations
|
|
302
|
+
- 📱 Mobile-friendly analytics dashboard
|
|
135
303
|
|
|
136
304
|
## Attribution
|
|
137
305
|
|
|
138
306
|
This package provides configuration for [@musistudio/claude-code-router](https://github.com/musistudio/claude-code-router), an excellent tool that enables Claude Code functionality with multiple AI providers.
|
|
139
307
|
|
|
140
|
-
The original Claude Code Router project is developed and maintained by musistudio. This package contains pre-configured routing logic and provider configurations to help users get started quickly.
|
|
308
|
+
The original Claude Code Router project is developed and maintained by musistudio. This package contains pre-configured routing logic, advanced CLI tools, and provider configurations to help users get started quickly and optimize their AI workflows.
|
|
141
309
|
|
|
142
310
|
## License
|
|
143
311
|
|
|
@@ -145,4 +313,8 @@ MIT © [Halil Ertekin](https://github.com/halilertekin)
|
|
|
145
313
|
|
|
146
314
|
---
|
|
147
315
|
|
|
148
|
-
**Note**: This is
|
|
316
|
+
**Note**: This is an enhanced configuration package. To use it, you need to install the original [@musistudio/claude-code-router](https://github.com/musistudio/claude-code-router) package.
|
|
317
|
+
|
|
318
|
+
## 🌟 Show Your Support
|
|
319
|
+
|
|
320
|
+
If you find this useful, please give it a ⭐ on [GitHub](https://github.com/halilertekin/CC-RouterMultiProvider)!
|