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
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
# 🚀 Claude Code Router Config v1.1.0 - New Features Guide
|
|
2
|
+
|
|
3
|
+
Version 1.1.0 brings major enhancements to the Claude Code Router configuration, transforming it from a basic setup package into a comprehensive AI router management system with advanced monitoring, analytics, and extensibility features.
|
|
4
|
+
|
|
5
|
+
## 📋 Table of Contents
|
|
6
|
+
|
|
7
|
+
- [New Features Overview](#new-features-overview)
|
|
8
|
+
- [Advanced CLI Tools](#advanced-cli-tools)
|
|
9
|
+
- [Configuration Templates](#configuration-templates)
|
|
10
|
+
- [Smart Routing Engine](#smart-routing-engine)
|
|
11
|
+
- [Analytics & Monitoring](#analytics--monitoring)
|
|
12
|
+
- [Web Dashboard](#web-dashboard)
|
|
13
|
+
- [Plugin System](#plugin-system)
|
|
14
|
+
- [Enhanced Logging](#enhanced-logging)
|
|
15
|
+
- [Migration Guide](#migration-guide)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 🎉 New Features Overview
|
|
20
|
+
|
|
21
|
+
### v1.1.0 Enhancements Summary
|
|
22
|
+
|
|
23
|
+
| Category | Features | Status |
|
|
24
|
+
|----------|----------|--------|
|
|
25
|
+
| 🛠️ **CLI Tools** | Test, benchmark, analytics, health monitoring | ✅ |
|
|
26
|
+
| 📋 **Templates** | 5 pre-optimized configurations | ✅ |
|
|
27
|
+
| 🧠 **Smart Routing** | Adaptive, cost/performance optimized | ✅ |
|
|
28
|
+
| 📊 **Analytics** | Usage tracking, cost analysis | ✅ |
|
|
29
|
+
| 🌐 **Web UI** | Interactive dashboard | ✅ |
|
|
30
|
+
| 🔌 **Plugin System** | Extensible architecture | ✅ |
|
|
31
|
+
| 📝 **Logging** | Enhanced metrics, middleware | ✅ |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🛠️ Advanced CLI Tools
|
|
36
|
+
|
|
37
|
+
### New Commands Added
|
|
38
|
+
|
|
39
|
+
#### Testing & Diagnostics
|
|
40
|
+
```bash
|
|
41
|
+
# Test provider connectivity
|
|
42
|
+
ccr test openai gpt-4o
|
|
43
|
+
ccr test anthropic claude-sonnet-4-latest
|
|
44
|
+
|
|
45
|
+
# Benchmark all providers
|
|
46
|
+
ccr benchmark --all --compare-speed
|
|
47
|
+
ccr benchmark full 5 --provider=openai --provider=anthropic
|
|
48
|
+
|
|
49
|
+
# Load testing
|
|
50
|
+
ccr benchmark load openai gpt-4o --concurrent=10 --duration=60
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Analytics & Monitoring
|
|
54
|
+
```bash
|
|
55
|
+
# View today's statistics
|
|
56
|
+
ccr analytics today --detailed
|
|
57
|
+
ccr analytics week --detailed
|
|
58
|
+
ccr analytics month
|
|
59
|
+
|
|
60
|
+
# Export analytics data
|
|
61
|
+
ccr analytics export --format=csv --period=month
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Configuration Management
|
|
65
|
+
```bash
|
|
66
|
+
# Apply templates
|
|
67
|
+
ccr config template performance-optimized
|
|
68
|
+
ccr config template cost-optimized
|
|
69
|
+
|
|
70
|
+
# Configuration operations
|
|
71
|
+
ccr config validate
|
|
72
|
+
ccr config backup
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Plugin Management
|
|
76
|
+
```bash
|
|
77
|
+
# Plugin operations
|
|
78
|
+
ccr plugin list
|
|
79
|
+
ccr plugin create my-provider --type provider
|
|
80
|
+
ccr plugin load custom-provider
|
|
81
|
+
ccr plugin unload custom-provider
|
|
82
|
+
ccr plugin load-all
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Web Dashboard
|
|
86
|
+
```bash
|
|
87
|
+
# Open web dashboard (default port 3457)
|
|
88
|
+
ccr ui
|
|
89
|
+
|
|
90
|
+
# Open on custom port
|
|
91
|
+
ccr ui --port 8080
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 📋 Configuration Templates
|
|
97
|
+
|
|
98
|
+
### Available Templates
|
|
99
|
+
|
|
100
|
+
| Template | Optimization | Best For | Performance | Cost | Quality |
|
|
101
|
+
|----------|---------------|----------|------------|------|--------|
|
|
102
|
+
| **performance-optimized** | Speed | Real-time apps, chatbots | ⭐⭐⭐⭐⭐ | Low | ⭐⭐⭐ |
|
|
103
|
+
| **cost-optimized** | Cost | Budget-conscious users | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
|
|
104
|
+
| **quality-focused** | Quality | Critical tasks, research | ⭐⭐ | Low | ⭐⭐⭐⭐⭐ |
|
|
105
|
+
| **development** | Coding | Software development | ⭐⭐⭐⭐ | Medium | ⭐⭐⭐⭐ |
|
|
106
|
+
| **balanced** | Balanced | General use | ⭐⭐⭐⭐ | Medium | ⭐⭐⭐⭐ |
|
|
107
|
+
|
|
108
|
+
### Template Features
|
|
109
|
+
|
|
110
|
+
Each template includes:
|
|
111
|
+
|
|
112
|
+
- **Optimized Provider Priority**: Tailored model selection
|
|
113
|
+
- **Routing Strategy**: Specific routing logic
|
|
114
|
+
- **Performance Settings**: Timeout, retries, caching
|
|
115
|
+
- **Health Monitoring**: Provider health checks
|
|
116
|
+
- **Budget Controls**: Cost limits and alerts (cost template)
|
|
117
|
+
|
|
118
|
+
### Quick Template Switching
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Apply template and backup current config
|
|
122
|
+
ccr config template cost-optimized
|
|
123
|
+
|
|
124
|
+
# Backup current configuration before switching
|
|
125
|
+
ccr config backup
|
|
126
|
+
ccr config template quality-focused
|
|
127
|
+
|
|
128
|
+
# Validate new configuration
|
|
129
|
+
ccr config validate
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🧠 Smart Routing Engine
|
|
135
|
+
|
|
136
|
+
### Core Improvements
|
|
137
|
+
|
|
138
|
+
#### 1. Adaptive Intelligence
|
|
139
|
+
- **Learning System**: Routes improve based on historical performance
|
|
140
|
+
- **Context Awareness**: Considers request complexity and timing
|
|
141
|
+
- **Cost Awareness**: Respects budget constraints
|
|
142
|
+
|
|
143
|
+
#### 2. Routing Strategies
|
|
144
|
+
- **Cost-Optimized**: Minimizes cost while maintaining quality
|
|
145
|
+
- **Performance-Optimized**: Maximizes speed and responsiveness
|
|
146
|
+
- **Quality-Optimized**: Prioritizes best results
|
|
147
|
+
- **Adaptive**: Balances all factors automatically
|
|
148
|
+
|
|
149
|
+
#### 3. Advanced Features
|
|
150
|
+
- **Auto-Fallback**: Automatic provider switching on failure
|
|
151
|
+
- **Load Balancing**: Distributes requests optimally
|
|
152
|
+
- **Performance Metrics**: Tracks latency and success rates
|
|
153
|
+
- **Route Caching**: Remembers optimal routes for patterns
|
|
154
|
+
|
|
155
|
+
### Configuration Example
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"Router": {
|
|
160
|
+
"default": "openai,gpt-4o",
|
|
161
|
+
"SmartRouting": {
|
|
162
|
+
"enabled": true,
|
|
163
|
+
"strategy": "adaptive",
|
|
164
|
+
"learningPeriod": 7,
|
|
165
|
+
"costOptimization": true
|
|
166
|
+
},
|
|
167
|
+
"Fallback": {
|
|
168
|
+
"enabled": true,
|
|
169
|
+
"maxRetries": 3,
|
|
170
|
+
"circuitBreaker": true
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 📊 Analytics & Monitoring
|
|
179
|
+
|
|
180
|
+
### Metrics Tracked
|
|
181
|
+
|
|
182
|
+
#### Request Analytics
|
|
183
|
+
- Request volume and trends
|
|
184
|
+
- Provider and model usage statistics
|
|
185
|
+
- Success and error rates
|
|
186
|
+
- Average response times
|
|
187
|
+
|
|
188
|
+
#### Cost Analytics
|
|
189
|
+
- Spending per provider and model
|
|
190
|
+
- Cost optimization opportunities
|
|
191
|
+
- Budget tracking and alerts
|
|
192
|
+
- ROI calculations
|
|
193
|
+
|
|
194
|
+
#### Performance Analytics
|
|
195
|
+
- Latency distribution
|
|
196
|
+
- Provider performance comparison
|
|
197
|
+
- Bottleneck identification
|
|
198
|
+
- Load distribution analysis
|
|
199
|
+
|
|
200
|
+
#### Health Monitoring
|
|
201
|
+
- Real-time provider status
|
|
202
|
+
- Uptime and availability metrics
|
|
203
|
+
- Error pattern analysis
|
|
204
|
+
- Automatic failover events
|
|
205
|
+
|
|
206
|
+
### Analytics Dashboard Features
|
|
207
|
+
|
|
208
|
+
#### Overview Tab
|
|
209
|
+
- System health status
|
|
210
|
+
- Today's statistics at a glance
|
|
211
|
+
- Provider health indicators
|
|
212
|
+
- Quick action buttons
|
|
213
|
+
|
|
214
|
+
#### Analytics Tab
|
|
215
|
+
- Interactive usage charts
|
|
216
|
+
- Provider performance graphs
|
|
217
|
+
- Cost trend analysis
|
|
218
|
+
- Export capabilities
|
|
219
|
+
|
|
220
|
+
#### Health Tab
|
|
221
|
+
- Real-time provider monitoring
|
|
222
|
+
- Health check results
|
|
223
|
+
- Error rate tracking
|
|
224
|
+
- Maintenance recommendations
|
|
225
|
+
|
|
226
|
+
### Using Analytics
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# View detailed analytics
|
|
230
|
+
ccr analytics today --detailed
|
|
231
|
+
|
|
232
|
+
# Export monthly report
|
|
233
|
+
ccr analytics export --format=csv --period=month
|
|
234
|
+
|
|
235
|
+
# Real-time monitoring (web dashboard)
|
|
236
|
+
ccr ui
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 🌐 Web Dashboard
|
|
242
|
+
|
|
243
|
+
### Interactive Features
|
|
244
|
+
|
|
245
|
+
#### Real-time Monitoring
|
|
246
|
+
- Live provider status updates
|
|
247
|
+
- Request performance metrics
|
|
248
|
+
- System resource usage
|
|
249
|
+
- Alert notifications
|
|
250
|
+
|
|
251
|
+
#### Configuration Management
|
|
252
|
+
- Visual configuration editing
|
|
253
|
+
- Template application with preview
|
|
254
|
+
- Backup and restore operations
|
|
255
|
+
- Provider testing interface
|
|
256
|
+
|
|
257
|
+
#### Analytics Visualization
|
|
258
|
+
- Interactive charts and graphs
|
|
259
|
+
- Filterable time periods
|
|
260
|
+
- Comparison analysis
|
|
261
|
+
- Export and sharing options
|
|
262
|
+
|
|
263
|
+
### Dashboard Architecture
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Web Dashboard (Port 3457)
|
|
267
|
+
├── Overview Page → System status, quick stats
|
|
268
|
+
├── Analytics Page → Usage charts, cost trends
|
|
269
|
+
├── Health Page → Provider monitoring
|
|
270
|
+
├── Config Page → Template management
|
|
271
|
+
└── API Endpoints → Data for CLI tools
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Accessing the Dashboard
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Start dashboard (default port 3457)
|
|
278
|
+
ccr ui
|
|
279
|
+
|
|
280
|
+
# Custom port
|
|
281
|
+
ccr ui --port 8080
|
|
282
|
+
|
|
283
|
+
# Access from browser
|
|
284
|
+
http://localhost:3457
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 🔌 Plugin System
|
|
290
|
+
|
|
291
|
+
### Plugin Types
|
|
292
|
+
|
|
293
|
+
#### 1. Provider Plugins
|
|
294
|
+
Add new AI providers with custom logic:
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
class CustomProvider {
|
|
298
|
+
constructor(config) {
|
|
299
|
+
this.apiBase = config.apiBase;
|
|
300
|
+
this.models = config.models;
|
|
301
|
+
this.pricing = config.pricing;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
async createRequest(prompt, options) {
|
|
305
|
+
// Custom request creation logic
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
async parseResponse(response) {
|
|
309
|
+
// Custom response parsing
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### 2. Hook Plugins
|
|
315
|
+
Execute code at specific routing points:
|
|
316
|
+
|
|
317
|
+
```javascript
|
|
318
|
+
class LoggingHook {
|
|
319
|
+
get hooks() {
|
|
320
|
+
return {
|
|
321
|
+
'beforeRequest': async (req) => {
|
|
322
|
+
console.log(`Request: ${req.method}`);
|
|
323
|
+
},
|
|
324
|
+
'afterRequest': async (req, response, latency) => {
|
|
325
|
+
console.log(`Completed in ${latency}ms`);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
#### 3. Middleware Plugins
|
|
333
|
+
Add custom request/response processing:
|
|
334
|
+
|
|
335
|
+
```javascript
|
|
336
|
+
class RateLimitMiddleware {
|
|
337
|
+
async middleware(req, res, next) {
|
|
338
|
+
// Rate limiting logic
|
|
339
|
+
await next();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Plugin Management
|
|
345
|
+
|
|
346
|
+
#### Create Plugin Scaffold
|
|
347
|
+
```bash
|
|
348
|
+
# Create provider plugin
|
|
349
|
+
ccr plugin create my-provider --type provider
|
|
350
|
+
|
|
351
|
+
# Create middleware plugin
|
|
352
|
+
ccr plugin create rate-limiter --type middleware --description "Rate limiting middleware"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### Plugin Operations
|
|
356
|
+
```bash
|
|
357
|
+
# List loaded plugins
|
|
358
|
+
ccr plugin list
|
|
359
|
+
|
|
360
|
+
# Load plugin
|
|
361
|
+
ccr plugin load my-provider
|
|
362
|
+
|
|
363
|
+
# Unload plugin
|
|
364
|
+
ccr plugin unload my-provider
|
|
365
|
+
|
|
366
|
+
# Reload plugin (after changes)
|
|
367
|
+
ccr plugin reload my-provider
|
|
368
|
+
|
|
369
|
+
# Load all plugins
|
|
370
|
+
ccr plugin load-all
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Plugin Structure
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
plugins/my-provider/
|
|
377
|
+
├── plugin.json # Plugin configuration
|
|
378
|
+
├── index.js # Main plugin file
|
|
379
|
+
├── package.json # Dependencies (optional)
|
|
380
|
+
└── README.md # Documentation
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## 📝 Enhanced Logging System
|
|
386
|
+
|
|
387
|
+
### Logging Features
|
|
388
|
+
|
|
389
|
+
#### Structured Logging
|
|
390
|
+
- Multiple log levels (fatal, error, warn, info, debug, trace)
|
|
391
|
+
- Request/response logging with metrics
|
|
392
|
+
- Provider-specific logging
|
|
393
|
+
- Error tracking and stack traces
|
|
394
|
+
|
|
395
|
+
#### Performance Metrics
|
|
396
|
+
- Request latency tracking
|
|
397
|
+
- Token usage monitoring
|
|
398
|
+
- Cost calculation per request
|
|
399
|
+
- Success/error rate analysis
|
|
400
|
+
|
|
401
|
+
#### Middleware Support
|
|
402
|
+
- HTTP request/response logging
|
|
403
|
+
- API call interceptors
|
|
404
|
+
- Route decision logging
|
|
405
|
+
- Health check logging
|
|
406
|
+
|
|
407
|
+
### Log Storage
|
|
408
|
+
|
|
409
|
+
#### Log Files
|
|
410
|
+
```
|
|
411
|
+
~/.claude-code-router/logs/
|
|
412
|
+
├── claude-router-YYYY-MM-DD.log # Daily logs
|
|
413
|
+
├── claude-router.1.log # Rotated logs
|
|
414
|
+
├── errors.log # Error-only log
|
|
415
|
+
└── metrics.json # Aggregated metrics
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### Log Configuration
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"LOG": true,
|
|
422
|
+
"LOG_LEVEL": "info",
|
|
423
|
+
"LOG_FILE": true,
|
|
424
|
+
"LOG_CONSOLE": true,
|
|
425
|
+
"METRICS_ENABLED": true,
|
|
426
|
+
"ANALYTICS_ENABLED": true
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Using the Enhanced Logger
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
const { logger } = require('../logging/enhanced-logger');
|
|
434
|
+
|
|
435
|
+
// Log with metadata
|
|
436
|
+
logger.info('Processing request', {
|
|
437
|
+
requestId: 'req_123',
|
|
438
|
+
provider: 'openai',
|
|
439
|
+
model: 'gpt-4o',
|
|
440
|
+
latency: 1500
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// Log API requests
|
|
444
|
+
logger.logRequest('openai', 'gpt-4o', 100, 50, 1500, true, 0.005);
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## 📈 Performance Improvements
|
|
450
|
+
|
|
451
|
+
### Router Performance
|
|
452
|
+
|
|
453
|
+
#### Smart Selection Algorithm
|
|
454
|
+
- Historical performance consideration
|
|
455
|
+
- Real-time health status checks
|
|
456
|
+
- Adaptive routing based on current conditions
|
|
457
|
+
- Predictive routing for known patterns
|
|
458
|
+
|
|
459
|
+
#### Caching Strategies
|
|
460
|
+
- Route decision caching for common patterns
|
|
461
|
+
- Response caching where appropriate
|
|
462
|
+
- Configuration caching
|
|
463
|
+
- Health check result caching
|
|
464
|
+
|
|
465
|
+
### System Efficiency
|
|
466
|
+
|
|
467
|
+
#### Resource Management
|
|
468
|
+
- Automatic log rotation and cleanup
|
|
469
|
+
- Memory-efficient metric storage
|
|
470
|
+
- Background health monitoring
|
|
471
|
+
- Lazy loading of plugins
|
|
472
|
+
|
|
473
|
+
#### Monitoring Impact
|
|
474
|
+
- Minimal performance overhead
|
|
475
|
+
- Asynchronous logging
|
|
476
|
+
- Non-blocking health checks
|
|
477
|
+
- Optimized data structures
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 🔧 Configuration Enhancements
|
|
482
|
+
|
|
483
|
+
### New Configuration Options
|
|
484
|
+
|
|
485
|
+
#### Smart Routing Settings
|
|
486
|
+
```json
|
|
487
|
+
{
|
|
488
|
+
"SmartRouting": {
|
|
489
|
+
"enabled": true,
|
|
490
|
+
"strategy": "adaptive",
|
|
491
|
+
"learningPeriod": 7,
|
|
492
|
+
"autoOptimize": false
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
#### Performance Optimization
|
|
498
|
+
```json
|
|
499
|
+
{
|
|
500
|
+
"PerformanceOptimization": {
|
|
501
|
+
"enabled": true,
|
|
502
|
+
"timeoutMs": 15000,
|
|
503
|
+
"retryAttempts": 2,
|
|
504
|
+
"preferLowLatency": true
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
#### Budget Management
|
|
510
|
+
```json
|
|
511
|
+
{
|
|
512
|
+
"BudgetManagement": {
|
|
513
|
+
"dailyLimit": 10.0,
|
|
514
|
+
"alerts": true,
|
|
515
|
+
"cheapestFirstFallback": true
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Environment Variables
|
|
521
|
+
|
|
522
|
+
#### Plugin System
|
|
523
|
+
```bash
|
|
524
|
+
export CLAUDE_ROUTER_PLUGINS_DIR="$HOME/.claude-code-router/plugins"
|
|
525
|
+
export CLAUDE_ROUTER_AUTOLOAD_PLUGINS=true
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
#### Enhanced Logging
|
|
529
|
+
```bash
|
|
530
|
+
export CLAUDE_ROUTER_LOG_LEVEL=debug
|
|
531
|
+
export CLAUDE_ROUTER_LOG_FILE=true
|
|
532
|
+
export CLAUDE_ROUTER_METRICS=true
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## 🔄 Migration Guide
|
|
538
|
+
|
|
539
|
+
### From v1.0.0 to v1.1.0
|
|
540
|
+
|
|
541
|
+
#### 1. Update Package
|
|
542
|
+
```bash
|
|
543
|
+
# Update to latest version
|
|
544
|
+
npm update -g claude-code-router-config
|
|
545
|
+
|
|
546
|
+
# Or install latest
|
|
547
|
+
npm install -g claude-code-router-config@latest
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
#### 2. Configuration Update (Optional)
|
|
551
|
+
Your existing configuration will continue to work, but you can enhance it:
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
# Backup current configuration
|
|
555
|
+
ccr config backup
|
|
556
|
+
|
|
557
|
+
# Apply enhanced smart routing
|
|
558
|
+
cp config/smart-intent-router.js ~/.claude-code-router/intent-router.js
|
|
559
|
+
|
|
560
|
+
# Or use a template
|
|
561
|
+
ccr config template balanced
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
#### 3. Enable New Features
|
|
565
|
+
|
|
566
|
+
```bash
|
|
567
|
+
# Enable enhanced logging in config.json
|
|
568
|
+
{
|
|
569
|
+
"LOG": true,
|
|
570
|
+
"LOG_LEVEL": "info",
|
|
571
|
+
"ANALYTICS_ENABLED": true,
|
|
572
|
+
"HEALTH_CHECKS": {
|
|
573
|
+
"enabled": true,
|
|
574
|
+
"interval": 30000
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
#### 4. Verify Installation
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
# Test enhanced features
|
|
583
|
+
ccr test openai gpt-4o
|
|
584
|
+
ccr analytics today
|
|
585
|
+
ccr ui
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### Backward Compatibility
|
|
589
|
+
|
|
590
|
+
All v1.0.0 configurations remain fully compatible with v1.1.0. New features use:
|
|
591
|
+
- Default settings when not specified
|
|
592
|
+
- Graceful fallbacks for missing options
|
|
593
|
+
- Automatic migration where safe
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## 🛠️ Advanced Usage Examples
|
|
598
|
+
|
|
599
|
+
### Cost Optimization Workflow
|
|
600
|
+
```bash
|
|
601
|
+
# Start with cost-optimized template
|
|
602
|
+
ccr config template cost-optimized
|
|
603
|
+
|
|
604
|
+
# Monitor spending
|
|
605
|
+
ccr analytics today --detailed
|
|
606
|
+
|
|
607
|
+
# Analyze spending patterns
|
|
608
|
+
ccr analytics export --format=csv --period=month
|
|
609
|
+
|
|
610
|
+
# Adjust budget if needed
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Performance Optimization Workflow
|
|
614
|
+
```bash
|
|
615
|
+
# Benchmark current setup
|
|
616
|
+
ccr benchmark --all --compare-speed
|
|
617
|
+
|
|
618
|
+
# Apply performance template
|
|
619
|
+
ccr config template performance-optimized
|
|
620
|
+
|
|
621
|
+
# Monitor performance
|
|
622
|
+
ccr ui
|
|
623
|
+
|
|
624
|
+
# Analyze results
|
|
625
|
+
ccr analytics week --detailed
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Plugin Development Workflow
|
|
629
|
+
```bash
|
|
630
|
+
# Create custom provider
|
|
631
|
+
ccr plugin create my-custom-provider --type provider
|
|
632
|
+
|
|
633
|
+
# Edit plugin files
|
|
634
|
+
cd ~/.claude-code-router/plugins/my-custom-provider
|
|
635
|
+
|
|
636
|
+
# Test plugin
|
|
637
|
+
ccr plugin load my-custom-provider
|
|
638
|
+
ccr test my-custom-provider
|
|
639
|
+
|
|
640
|
+
# Monitor plugin performance
|
|
641
|
+
ccr analytics today
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## 🔍 Troubleshooting
|
|
647
|
+
|
|
648
|
+
### Common Issues
|
|
649
|
+
|
|
650
|
+
#### CLI Commands Not Working
|
|
651
|
+
```bash
|
|
652
|
+
# Check installation
|
|
653
|
+
which ccr
|
|
654
|
+
ccr --version
|
|
655
|
+
|
|
656
|
+
# Verify package installation
|
|
657
|
+
npm list -g claude-code-router-config
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
#### Dashboard Not Starting
|
|
661
|
+
```bash
|
|
662
|
+
# Check port availability
|
|
663
|
+
lsof -i :3457
|
|
664
|
+
|
|
665
|
+
# Try different port
|
|
666
|
+
ccr ui --port 8080
|
|
667
|
+
|
|
668
|
+
# Check logs
|
|
669
|
+
ccr analytics today
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
#### Plugin Loading Issues
|
|
673
|
+
```bash
|
|
674
|
+
# Check plugin directory
|
|
675
|
+
ls -la ~/.claude-code-router/plugins/
|
|
676
|
+
|
|
677
|
+
# Check plugin syntax
|
|
678
|
+
node -c plugins/my-provider/index.js
|
|
679
|
+
|
|
680
|
+
# Enable debug logging
|
|
681
|
+
export CLAUDE_ROUTER_LOG_LEVEL=debug
|
|
682
|
+
ccr plugin load my-provider
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
### Performance Issues
|
|
686
|
+
|
|
687
|
+
#### Slow Response Times
|
|
688
|
+
```bash
|
|
689
|
+
# Check provider health
|
|
690
|
+
ccr health --all-providers
|
|
691
|
+
|
|
692
|
+
# Benchmark providers
|
|
693
|
+
ccr benchmark --all --compare-speed
|
|
694
|
+
|
|
695
|
+
# Check analytics for bottlenecks
|
|
696
|
+
ccr analytics today --detailed
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
#### High Memory Usage
|
|
700
|
+
```bash
|
|
701
|
+
# Check system resources
|
|
702
|
+
ccr analytics today --detailed
|
|
703
|
+
|
|
704
|
+
# Clean up old logs
|
|
705
|
+
# Logs auto-rotate, but you can force cleanup
|
|
706
|
+
rm ~/.claude-code-router/logs/*.log.2
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## 📚️ Additional Resources
|
|
712
|
+
|
|
713
|
+
### Documentation
|
|
714
|
+
- [Full Documentation (EN)](docs/FULL_DOCUMENTATION_EN.md)
|
|
715
|
+
- [Full Documentation (TR)](docs/FULL_DOCUMENTATION.md)
|
|
716
|
+
- [Configuration Templates Guide](templates/README.md)
|
|
717
|
+
- [Homebrew Setup Guide](docs/HOMEBREW_SETUP.md)
|
|
718
|
+
- [AgentSkills Integration](docs/AGENTSKILLS_INTEGRATION.md)
|
|
719
|
+
|
|
720
|
+
### API Reference
|
|
721
|
+
- [CLI Commands Reference](#advanced-cli-tools)
|
|
722
|
+
- [Plugin Development Guide](#plugin-system)
|
|
723
|
+
- [Configuration Options](#configuration-enhancements)
|
|
724
|
+
- [Analytics API](docs/API.md)
|
|
725
|
+
|
|
726
|
+
### Support
|
|
727
|
+
- [GitHub Issues](https://github.com/halilertekin/CC-RouterMultiProvider/issues)
|
|
728
|
+
- [Original Router Project](https://github.com/musistudio/claude-code-router)
|
|
729
|
+
|
|
730
|
+
---
|
|
731
|
+
|
|
732
|
+
## 🎉 What's Next?
|
|
733
|
+
|
|
734
|
+
### Planned Features for v1.2.0
|
|
735
|
+
- 📱 Mobile-responsive dashboard
|
|
736
|
+
- 🤖 AI-powered optimization recommendations
|
|
737
|
+
- 🔗 Team collaboration features
|
|
738
|
+
- 📊 Advanced reporting
|
|
739
|
+
- 🔄 Automated plugin updates
|
|
740
|
+
- 🌐 Integration with popular tools
|
|
741
|
+
|
|
742
|
+
### Contributing
|
|
743
|
+
We welcome contributions! See the contributing guidelines in the repository.
|
|
744
|
+
|
|
745
|
+
### Feedback
|
|
746
|
+
Have ideas for improvement? Found a bug? Please open an issue on GitHub.
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
*Last Updated: December 20, 2025*
|
|
751
|
+
*Version: 1.1.0*
|
|
752
|
+
*Author: Halil Ertekin*
|