claude-code-router-config 1.0.0 → 1.0.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.
@@ -155,14 +155,35 @@ Claude Code Router, Claude Code CLI'ı bir proxy üzerinden çalıştırarak ist
155
155
  - Node.js 18+
156
156
  - pnpm (tercih edilen) veya npm
157
157
 
158
- ### Adım 1: Paket Kurulumu
158
+ ### Seçenek 1: Homebrew (Tavsiye Edilen)
159
+
160
+ ```bash
161
+ brew install halilertekin/tap/claude-code-router-config
162
+ ```
163
+
164
+ Homebrew kurulumu her şeyi otomatik yapar:
165
+ - @musistudio/claude-code-router kurar
166
+ - Konfigürasyon dosyalarını kopyalar
167
+ - ~/.env dosyasını şablonlarla oluşturur
168
+ - Sonraki adımları gösterir
169
+
170
+ ### Seçenek 2: NPM Paketi
171
+
172
+ ```bash
173
+ pnpm add -g claude-code-router-config
174
+ ccr-setup
175
+ ```
176
+
177
+ ### Seçenek 3: Manuel Kurulum
178
+
179
+ #### Adım 1: Paket Kurulumu
159
180
 
160
181
  ```bash
161
182
  pnpm add -g @musistudio/claude-code-router
162
183
  mkdir -p ~/.claude-code-router
163
184
  ```
164
185
 
165
- ### Adım 2: Environment Variables
186
+ #### Adım 2: Environment Variables
166
187
 
167
188
  `~/.zshrc` veya `~/.bashrc` dosyasına ekle:
168
189
 
@@ -165,14 +165,35 @@ Claude Code Router acts as a proxy that intercepts Claude Code CLI requests and
165
165
  - Node.js 18+
166
166
  - pnpm (preferred) or npm
167
167
 
168
- ### Step 1: Install Package
168
+ ### Option 1: Homebrew (Recommended)
169
+
170
+ ```bash
171
+ brew install halilertekin/tap/claude-code-router-config
172
+ ```
173
+
174
+ The Homebrew installation handles everything automatically:
175
+ - Installs @musistudio/claude-code-router
176
+ - Copies configuration files
177
+ - Creates ~/.env with templates
178
+ - Provides next-step instructions
179
+
180
+ ### Option 2: NPM Package
181
+
182
+ ```bash
183
+ pnpm add -g claude-code-router-config
184
+ ccr-setup
185
+ ```
186
+
187
+ ### Option 3: Manual Installation
188
+
189
+ #### Step 1: Install Package
169
190
 
170
191
  ```bash
171
192
  pnpm add -g @musistudio/claude-code-router
172
193
  mkdir -p ~/.claude-code-router
173
194
  ```
174
195
 
175
- ### Step 2: Environment Variables
196
+ #### Step 2: Environment Variables
176
197
 
177
198
  Option 1: Create `.env` file:
178
199
 
@@ -0,0 +1,252 @@
1
+ # Homebrew Setup Documentation
2
+
3
+ ## Overview
4
+
5
+ This document explains how to set up and use the custom Homebrew tap for installing `claude-code-router-config`. The custom tap allows easy installation of the multi-provider AI routing configuration with intent-based routing support.
6
+
7
+ ## Custom Tap Details
8
+
9
+ **Tap Repository**: https://github.com/halilertekin/homebrew-tap
10
+ **Formula**: `claude-code-router-config`
11
+ **Main Repository**: https://github.com/halilertekin/CC-RouterMultiProvider
12
+
13
+ ## Installation Instructions
14
+
15
+ ### Prerequisites
16
+
17
+ - macOS with [Homebrew](https://brew.sh/) installed
18
+ - An Anthropic API key (for Claude models)
19
+ - Optional API keys for other providers (OpenAI, Gemini, Qwen, GLM, OpenRouter, GitHub Copilot)
20
+
21
+ ### Step 1: Add the Custom Tap
22
+
23
+ ```bash
24
+ # Add the custom tap to your Homebrew installation
25
+ brew tap halilertekin/homebrew-tap
26
+ ```
27
+
28
+ ### Step 2: Install the Package
29
+
30
+ ```bash
31
+ # Install claude-code-router-config
32
+ brew install claude-code-router-config
33
+ ```
34
+
35
+ ### Step 3: Configure API Keys
36
+
37
+ The installer automatically creates configuration files and an `.env.example` file. You need to:
38
+
39
+ 1. **Edit your environment variables:**
40
+ ```bash
41
+ nano ~/.env
42
+ ```
43
+
44
+ 2. **Add your API keys:**
45
+ ```bash
46
+ # Required for Claude models
47
+ export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
48
+
49
+ # Optional - Add other providers
50
+ export OPENAI_API_KEY="your_openai_api_key_here"
51
+ export GEMINI_API_KEY="your_gemini_api_key_here"
52
+ export QWEN_API_KEY="your_qwen_api_key_here"
53
+ export GLM_API_KEY="your_glm_api_key_here"
54
+ export OPENROUTER_API_KEY="your_openrouter_api_key_here"
55
+ export GITHUB_TOKEN="your_github_token_here"
56
+ ```
57
+
58
+ 3. **Add to shell configuration:**
59
+ ```bash
60
+ # Add to ~/.zshrc or ~/.bashrc
61
+ export $(cat ~/.env | xargs)
62
+ export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
63
+ export NO_PROXY="127.0.0.1"
64
+ ```
65
+
66
+ 4. **Reload your shell:**
67
+ ```bash
68
+ source ~/.zshrc
69
+ # or
70
+ source ~/.bashrc
71
+ ```
72
+
73
+ ### Step 4: Start the Router
74
+
75
+ ```bash
76
+ # Start the Claude Code Router
77
+ ccr code
78
+ ```
79
+
80
+ ## What Gets Installed
81
+
82
+ The Homebrew formula installs the following components:
83
+
84
+ ### 1. Core Package
85
+ - **@musistudio/claude-code-router**: The main routing application (via pnpm)
86
+
87
+ ### 2. Configuration Files
88
+ - **`~/.claude-code-router/config.json`**: Multi-provider configuration with 7 AI providers
89
+ - **`~/.claude-code-router/intent-router.js`**: Intelligent intent-based routing logic
90
+
91
+ ### 3. Environment Template
92
+ - **`~/.env`**: Environment variables file (created from `.env.example`)
93
+
94
+ ## Supported AI Providers
95
+
96
+ The configuration supports 7 AI providers:
97
+
98
+ 1. **OpenAI**: GPT-4o, GPT-4 Turbo, O1, O1-mini
99
+ 2. **Anthropic**: Claude Sonnet 4, Claude 3.5 Sonnet
100
+ 3. **Gemini**: Gemini 2.5 Flash, Gemini 2.5 Pro
101
+ 4. **Qwen**: Qwen Plus, Qwen Max
102
+ 5. **GLM**: GLM-4.6, GLM-4.5
103
+ 6. **OpenRouter**: Multiple models via OpenRouter
104
+ 7. **GitHub Copilot**: Code assistance
105
+
106
+ ## Intent-Based Routing
107
+
108
+ The router automatically routes requests to the most appropriate provider based on the task type:
109
+
110
+ - **Coding tasks** → OpenAI (GPT-4o/O1)
111
+ - **Deep reasoning** → Anthropic Claude
112
+ - **Fast responses** → Gemini Flash
113
+ - **Simple tasks** → Qwen
114
+ - **Multilingual** → GLM
115
+ - **Heavy reasoning** → OpenAI O1
116
+ - **Coding assistance** → GitHub Copilot
117
+
118
+ ## Troubleshooting
119
+
120
+ ### Common Issues
121
+
122
+ 1. **Permission Denied Errors**
123
+ ```bash
124
+ # Fix permissions on config directory
125
+ sudo chown -R $USER:$USER ~/.claude-code-router
126
+ chmod 755 ~/.claude-code-router
127
+ ```
128
+
129
+ 2. **pnpm Not Found**
130
+ ```bash
131
+ # Install pnpm
132
+ brew install pnpm
133
+
134
+ # Or the formula automatically falls back to npm
135
+ ```
136
+
137
+ 3. **Environment Variables Not Loading**
138
+ ```bash
139
+ # Verify .env file exists
140
+ ls -la ~/.env
141
+
142
+ # Manually source environment
143
+ export $(cat ~/.env | xargs)
144
+ ```
145
+
146
+ 4. **Router Fails to Start**
147
+ ```bash
148
+ # Check configuration files
149
+ ls -la ~/.claude-code-router/
150
+
151
+ # Verify config syntax
152
+ node -c ~/.claude-code-router/intent-router.js
153
+ ```
154
+
155
+ 5. **API Key Issues**
156
+ ```bash
157
+ # Test API key
158
+ curl -X POST https://api.anthropic.com/v1/messages \
159
+ -H "x-api-key: $ANTHROPIC_API_KEY" \
160
+ -H "content-type: application/json" \
161
+ -d '{"model": "claude-3-sonnet-20240229", "max_tokens": 10, "messages": [{"role": "user", "content": "test"}]}'
162
+ ```
163
+
164
+ ### Getting Help
165
+
166
+ 1. **Check logs**: The router provides detailed logging information
167
+ 2. **Verify configuration**: Ensure all JSON files are valid
168
+ 3. **Test providers individually**: Use direct API calls to test each provider
169
+ 4. **Check network connectivity**: Ensure you can reach the provider APIs
170
+
171
+ ## Updating the Installation
172
+
173
+ To update to the latest version:
174
+
175
+ ```bash
176
+ # Update the tap
177
+ brew update
178
+
179
+ # Upgrade the package
180
+ brew upgrade claude-code-router-config
181
+
182
+ # Or reinstall for clean setup
183
+ brew reinstall claude-code-router-config
184
+ ```
185
+
186
+ ## Uninstallation
187
+
188
+ To completely remove the installation:
189
+
190
+ ```bash
191
+ # Uninstall the package
192
+ brew uninstall claude-code-router-config
193
+
194
+ # Remove configuration files (optional)
195
+ rm -rf ~/.claude-code-router
196
+
197
+ # Remove environment variables from ~/.zshrc or ~/.bashrc
198
+ # Remove the tap (optional)
199
+ brew untap halilertekin/homebrew-tap
200
+ ```
201
+
202
+ ## Advanced Configuration
203
+
204
+ ### Custom Intent Patterns
205
+
206
+ Edit `~/.claude-code-router/intent-router.js` to add custom routing patterns:
207
+
208
+ ```javascript
209
+ // Add custom intent
210
+ CUSTOM_TASK: {
211
+ patterns: [/\b(custom|special|specific)\b/i],
212
+ route: "openai,gpt-4o"
213
+ }
214
+ ```
215
+
216
+ ### Provider Priority
217
+
218
+ Modify the routing order in `~/.claude-code-router/config.json`:
219
+
220
+ ```json
221
+ "Router": {
222
+ "default": "anthropic,claude-sonnet-4-latest",
223
+ "background": "qwen,qwen-turbo",
224
+ "think": "openai,o1"
225
+ }
226
+ ```
227
+
228
+ ## Performance Tips
229
+
230
+ 1. **Use appropriate models**: Choose the right model for each task
231
+ 2. **Set timeouts**: Configure appropriate API timeouts
232
+ 3. **Monitor usage**: Track token usage and costs
233
+ 4. **Cache results**: Use caching for repeated requests
234
+
235
+ ## Security Considerations
236
+
237
+ 1. **Protect API keys**: Never commit API keys to version control
238
+ 2. **Use environment variables**: Keep sensitive data in `.env`
239
+ 3. **Regular key rotation**: Rotate API keys periodically
240
+ 4. **Audit logs**: Monitor router logs for unusual activity
241
+
242
+ ## Support
243
+
244
+ - **Main Repository**: https://github.com/halilertekin/CC-RouterMultiProvider
245
+ - **Issues**: Report issues via GitHub
246
+ - **Documentation**: See `docs/` directory for comprehensive guides
247
+
248
+ ## Attribution
249
+
250
+ This configuration package is for use with [@musistudio/claude-code-router](https://github.com/musistudio/claude-code-router).
251
+ Original project: https://github.com/musistudio/claude-code-router
252
+ Configuration by Halil Ertekin
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-code-router-config",
3
- "version": "1.0.0",
4
- "description": "Configuration package for @musistudio/claude-code-router with multi-provider intent-based routing",
3
+ "version": "1.0.1",
4
+ "description": "Multi-provider configuration for Claude Code Router with intent-based routing. Setup OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, and GitHub Copilot with intelligent routing.",
5
5
  "main": "install.js",
6
6
  "bin": {
7
7
  "ccr-setup": "install.js"
@@ -9,13 +9,16 @@
9
9
  "scripts": {
10
10
  "install": "node install.js",
11
11
  "setup": "chmod +x install.sh && ./install.sh",
12
- "postinstall": "node postinstall.js"
12
+ "postinstall": "node postinstall.js",
13
+ "test": "node test/test.js"
13
14
  },
14
15
  "files": [
15
16
  "config/",
16
17
  "install.sh",
17
18
  ".env.example",
18
- "docs/"
19
+ "docs/",
20
+ "LICENSE",
21
+ "README.md"
19
22
  ],
20
23
  "keywords": [
21
24
  "claude",
@@ -31,7 +34,10 @@
31
34
  "claude-code",
32
35
  "cli",
33
36
  "automation",
34
- "configuration"
37
+ "configuration",
38
+ "homebrew",
39
+ "intent-based",
40
+ "llm"
35
41
  ],
36
42
  "author": {
37
43
  "name": "Halil Ertekin",
@@ -41,12 +47,12 @@
41
47
  "license": "MIT",
42
48
  "repository": {
43
49
  "type": "git",
44
- "url": "https://github.com/halilertekin/claude-code-router-config.git"
50
+ "url": "https://github.com/halilertekin/CC-RouterMultiProvider.git"
45
51
  },
46
52
  "bugs": {
47
- "url": "https://github.com/halilertekin/claude-code-router-config/issues"
53
+ "url": "https://github.com/halilertekin/CC-RouterMultiProvider/issues"
48
54
  },
49
- "homepage": "https://github.com/halilertekin/claude-code-router-config#readme",
55
+ "homepage": "https://github.com/halilertekin/CC-RouterMultiProvider#readme",
50
56
  "engines": {
51
57
  "node": ">=16.0.0"
52
58
  },
@@ -55,5 +61,8 @@
55
61
  "chalk": "^5.3.0",
56
62
  "fs-extra": "^11.1.1",
57
63
  "dotenv": "^16.3.1"
64
+ },
65
+ "devDependencies": {
66
+ "jest": "^29.7.0"
58
67
  }
59
68
  }