@halilertekin/claude-code-router-config 1.1.1

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/.env.example ADDED
@@ -0,0 +1,27 @@
1
+ # Claude Code Router - Environment Variables
2
+ # Copy this to .env and fill with your actual API keys
3
+
4
+ # OpenAI (GPT-4o, O1, Codex)
5
+ OPENAI_API_KEY=sk-...
6
+
7
+ # Anthropic Claude
8
+ ANTHROPIC_API_KEY=sk-ant-...
9
+
10
+ # Google Gemini
11
+ GEMINI_API_KEY=AIza...
12
+
13
+ # Alibaba Qwen (DashScope)
14
+ QWEN_API_KEY=sk-...
15
+
16
+ # Zhipu GLM (Z.ai)
17
+ GLM_API_KEY=...
18
+
19
+ # OpenRouter (fallback)
20
+ OPENROUTER_API_KEY=sk-or-...
21
+
22
+ # GitHub Copilot (optional)
23
+ GITHUB_COPIOT_API_KEY=ghu_...
24
+
25
+ # Router Connection
26
+ ANTHROPIC_BASE_URL=http://127.0.0.1:3456
27
+ NO_PROXY=127.0.0.1
package/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Halil Ertekin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Attribution
26
+
27
+ This package provides configuration for @musistudio/claude-code-router.
28
+ Original project: https://github.com/musistudio/claude-code-router
29
+
30
+ The configuration files and intent-based routing logic in this package are designed to work with the original Claude Code Router created by musistudio.
package/README.md ADDED
@@ -0,0 +1,320 @@
1
+ # Claude Code Router Config - Advanced Multi-Provider Setup
2
+
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
+ ```
38
+
39
+ ## Features
40
+
41
+ - **7 Provider Support**: OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, GitHub Copilot
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
48
+
49
+ ## Routing Strategy
50
+
51
+ | Request Type | Provider | Model |
52
+ |--------------|----------|-------|
53
+ | Code writing, debugging | OpenAI | gpt-4o |
54
+ | Deep analysis, architecture | Anthropic | claude-sonnet-4 |
55
+ | Quick responses, summaries | Gemini | gemini-2.5-flash |
56
+ | Simple tasks | Qwen | qwen-plus |
57
+ | Translation, multilingual | GLM | glm-4.6 |
58
+ | Complex algorithms | OpenAI | o1 |
59
+ | Coding assistance | GitHub Copilot | copilot |
60
+
61
+ ## Installation
62
+
63
+ ### Option 1: Homebrew (Recommended)
64
+
65
+ ```bash
66
+ brew install halilertekin/tap/claude-code-router-config
67
+ ```
68
+
69
+ After installation, edit your API keys in `~/.env` and start the router:
70
+ ```bash
71
+ ccr code
72
+ ```
73
+
74
+ ### PNPM
75
+
76
+ ```bash
77
+ pnpm add -g @halilertekin/claude-code-router-config
78
+ ccr-setup
79
+ ```
80
+
81
+ ### Option 3: Manual Setup
82
+
83
+ #### 1. Install Dependencies
84
+
85
+ ```bash
86
+ pnpm add -g @musistudio/claude-code-router
87
+ ```
88
+
89
+ #### 2. Copy Configuration Files
90
+
91
+ ```bash
92
+ mkdir -p ~/.claude-code-router
93
+ cp config/config.json ~/.claude-code-router/
94
+ cp config/intent-router.js ~/.claude-code-router/
95
+ ```
96
+
97
+ #### 3. Set Up Environment Variables
98
+
99
+ Create `.env` file:
100
+
101
+ ```bash
102
+ cp .env.example ~/.env
103
+ # Edit ~/.env with your API keys
104
+ ```
105
+
106
+ Or add to `~/.zshrc` / `~/.bashrc`:
107
+
108
+ ```bash
109
+ # Claude Code Router - API Keys
110
+ export OPENAI_API_KEY="sk-..."
111
+ export ANTHROPIC_API_KEY="sk-ant-..."
112
+ export GEMINI_API_KEY="AIza..."
113
+ export QWEN_API_KEY="sk-..."
114
+ export GLM_API_KEY="..."
115
+ export OPENROUTER_API_KEY="sk-or-..."
116
+ export GITHUB_COPIOT_API_KEY="ghu_..."
117
+
118
+ # Router Connection
119
+ export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
120
+ export NO_PROXY="127.0.0.1"
121
+ ```
122
+
123
+ #### 4. Start Router
124
+
125
+ ```bash
126
+ source ~/.zshrc
127
+ ccr code
128
+ ```
129
+
130
+ ## Usage
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
+
183
+ ### Basic Commands
184
+
185
+ ```bash
186
+ ccr start # Start router
187
+ ccr code # Start with Claude Code
188
+ ccr stop # Stop router
189
+ ```
190
+
191
+ ### Switch Models (Runtime)
192
+
193
+ Inside Claude Code:
194
+
195
+ ```
196
+ /model openai,gpt-4o
197
+ /model anthropic,claude-sonnet-4-latest
198
+ /model gemini,gemini-2.5-flash
199
+ /model qwen,qwen-plus
200
+ /model glm,glm-4.6
201
+ /model copilot,copilot
202
+ ```
203
+
204
+ ## API Key Setup
205
+
206
+ | Provider | Link | Notes |
207
+ |----------|------|-------|
208
+ | OpenAI | https://platform.openai.com/api-keys | gpt-4o, o1 models |
209
+ | Anthropic | https://console.anthropic.com/settings/keys | Claude models |
210
+ | Gemini | https://aistudio.google.com/apikey | Google AI models |
211
+ | Qwen | https://dashscope.console.aliyun.com/apiKey | Alibaba Cloud |
212
+ | GLM | https://open.bigmodel.cn/usercenter/apikeys | Zhipu AI |
213
+ | OpenRouter | https://openrouter.ai/keys | Multiple models |
214
+ | GitHub Copilot | https://github.com/settings/tokens | `copilot` scope |
215
+
216
+ ## Testing
217
+
218
+ ```bash
219
+ # Test different routing scenarios
220
+ claude "Write a Python sorting function" # → OpenAI
221
+ claude "Explain microservices architecture" # → Anthropic
222
+ claude "Quick summary of REST APIs" # → Gemini
223
+ claude "List files in current directory" # → Qwen
224
+ claude "Translate to Chinese: Hello" # → GLM
225
+ claude "Help me debug this React component" # → GitHub Copilot
226
+ ```
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
+
280
+ ## Documentation
281
+
282
+ - [Complete Documentation (EN)](docs/FULL_DOCUMENTATION_EN.md)
283
+ - [Complete Documentation (TR)](docs/FULL_DOCUMENTATION.md)
284
+ - [Setup Prompt (EN)](docs/SETUP_PROMPT_EN.md)
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
303
+
304
+ ## Attribution
305
+
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.
307
+
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.
309
+
310
+ ## License
311
+
312
+ MIT © [Halil Ertekin](https://github.com/halilertekin)
313
+
314
+ ---
315
+
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)!