@halilertekin/claude-code-router-config 2.0.9 → 2.2.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/CHANGELOG.md +8 -0
- package/README.md +31 -0
- package/SETUP.md +165 -0
- package/cli/ccc.zsh +32 -11
- package/docs/PROVIDER_SETUP.md +599 -0
- package/package.json +4 -2
- package/quick-setup.sh +55 -0
- package/web-dashboard/public/index.html +1 -0
- package/web-dashboard/public/js/dashboard.js +66 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
- **NEW**: UI now supports 3 languages - Turkish (TR), Dutch (NL), and English (EN)
|
|
5
|
+
- **NEW**: Comprehensive provider setup guide added with multi-provider routing documentation
|
|
6
|
+
- **NEW**: Inter-provider routing with automatic fallback support
|
|
7
|
+
- **IMPROVED**: Default routing strategy now prioritizes GLM (z.ai) for cost optimization
|
|
8
|
+
- **IMPROVED**: Smart intent router updated with GLM-first approach for all intents
|
|
9
|
+
- **DOCS**: Added `docs/PROVIDER_SETUP.md` with detailed multi-language instructions
|
|
10
|
+
|
|
3
11
|
## 2.0.9
|
|
4
12
|
- GLM print mode disables attachments to avoid EMFILE (too many open files) watcher errors.
|
|
5
13
|
|
package/README.md
CHANGED
|
@@ -176,12 +176,43 @@ Metrics tracked:
|
|
|
176
176
|
|
|
177
177
|
## Documentation
|
|
178
178
|
|
|
179
|
+
- [**Provider Setup Guide** (EN/TR)](docs/PROVIDER_SETUP.md) - **Multiple providers with intelligent routing**
|
|
179
180
|
- [Complete Documentation (EN)](docs/FULL_DOCUMENTATION_EN.md)
|
|
180
181
|
- [Complete Documentation (TR)](docs/FULL_DOCUMENTATION.md)
|
|
181
182
|
- [Setup Prompt (EN)](docs/SETUP_PROMPT_EN.md)
|
|
182
183
|
- [Setup Prompt (TR)](docs/SETUP_PROMPT.md)
|
|
183
184
|
- [Configuration Templates Guide](templates/README.md)
|
|
184
185
|
|
|
186
|
+
## Provider Setup / Sağlayıcı Kurulumu 🆕
|
|
187
|
+
|
|
188
|
+
**📖 Read the [Provider Setup Guide](docs/PROVIDER_SETUP.md) for:**
|
|
189
|
+
- How to add multiple providers (OpenRouter, OpenAI, Gemini, Qwen)
|
|
190
|
+
- Inter-provider routing with automatic fallback
|
|
191
|
+
- Cost optimization strategies (up to 87% savings!)
|
|
192
|
+
- Configuration examples and troubleshooting
|
|
193
|
+
|
|
194
|
+
**🔗 Hızlı Provider Ekleme:**
|
|
195
|
+
|
|
196
|
+
| Provider | Get API Key | Cost (1M tokens) |
|
|
197
|
+
|----------|-------------|------------------|
|
|
198
|
+
| [GLM (z.ai)](https://open.bigmodel.cn/) | [Sign Up](https://open.bigmodel.cn/) | ~$0.50 ⭐ |
|
|
199
|
+
| [Qwen](https://dashscope-intl.aliyuncs.com/) | [Sign Up](https://dashscope-intl.aliyuncs.com/) | ~$0.10 |
|
|
200
|
+
| [Gemini](https://ai.google.dev/) | [Sign Up](https://ai.google.dev/) | ~$0.01 |
|
|
201
|
+
| [OpenAI](https://platform.openai.com/) | [Sign Up](https://platform.openai.com/) | ~$2.50 |
|
|
202
|
+
| [OpenRouter](https://openrouter.ai/) | [Sign Up](https://openrouter.ai/) | Variable |
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Add to ~/.env
|
|
206
|
+
export GLM_API_KEY="your_key_here"
|
|
207
|
+
export OPENROUTER_API_KEY="your_key_here"
|
|
208
|
+
export GEMINI_API_KEY="your_key_here"
|
|
209
|
+
|
|
210
|
+
# Verify setup
|
|
211
|
+
ccr status --detailed
|
|
212
|
+
ccr test glm
|
|
213
|
+
ccr benchmark --all
|
|
214
|
+
```
|
|
215
|
+
|
|
185
216
|
## License
|
|
186
217
|
|
|
187
218
|
MIT © [Halil Ertekin](https://github.com/halilertekin)
|
package/SETUP.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Claude Code Router - Setup Guide / Kurulum Rehberi
|
|
2
|
+
|
|
3
|
+
> **Türkçe** | [English](#english)
|
|
4
|
+
|
|
5
|
+
## Kullanım
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# .zshrc dosyanıza ekleyin:
|
|
9
|
+
source ~/code/claude-code-router-config/cli/ccc.zsh
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Alias'lar
|
|
13
|
+
|
|
14
|
+
| Komut | Provider | Endpoint | Model |
|
|
15
|
+
|-------|----------|----------|-------|
|
|
16
|
+
| `glm` | z.ai Coding Plan | `api.z.ai/api/coding/paas/v4` | GLM-5 |
|
|
17
|
+
| `glmapi` | z.ai API (Kredi) | `api.z.ai/api/paas/v4` | GLM-5 |
|
|
18
|
+
| `claude-pro` | Anthropic Claude Pro | Official API | Claude Sonnet 4.5 |
|
|
19
|
+
| `deepseek` | DeepSeek | `api.deepseek.com/anthropic` | deepseek-chat |
|
|
20
|
+
|
|
21
|
+
## API Key Kurulumu
|
|
22
|
+
|
|
23
|
+
### 1. z.ai (GLM) API Key
|
|
24
|
+
|
|
25
|
+
`~/.env` dosyanıza ekleyin:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export GLM_API_KEY="your_z.ai_api_key_here"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Key almak için: https://z.ai/apikeys
|
|
32
|
+
|
|
33
|
+
### 2. Claude Pro
|
|
34
|
+
|
|
35
|
+
Claude Pro kullanıcıları `claude login` ile giriş yapabilir veya:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
export ANTHROPIC_API_KEY="your_anthropic_api_key"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. DeepSeek (opsiyonel)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
export DEEPSEEK_API_KEY="your_deepseek_api_key"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Örnek Kullanım
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Coding Plan ile GLM-5 kullan
|
|
51
|
+
glm
|
|
52
|
+
|
|
53
|
+
# API kredisi ile GLM-5 kullan
|
|
54
|
+
glmapi
|
|
55
|
+
|
|
56
|
+
# Claude Pro kullan
|
|
57
|
+
claude-pro
|
|
58
|
+
|
|
59
|
+
# DeepSeek kullan
|
|
60
|
+
deepseek
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Dosya Yapısı
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
claude-code-router-config/
|
|
67
|
+
├── cli/
|
|
68
|
+
│ └── ccc.zsh # Ana konfigürasyon dosyası
|
|
69
|
+
├── config/ # Model konfigürasyonları
|
|
70
|
+
├── router/ # Routing mantığı
|
|
71
|
+
└── docs/ # Dokümantasyon
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Sorun Giderme
|
|
75
|
+
|
|
76
|
+
### "GLM_API_KEY not set" hatası
|
|
77
|
+
- `~/.env` dosyasında key'in doğru olduğundan emin olun
|
|
78
|
+
- Dosyayı kaydettikten sonra terminali yeniden açın veya `source ~/.env` yapın
|
|
79
|
+
|
|
80
|
+
### Model çalışmıyorsa
|
|
81
|
+
- API key'in geçerli olduğunu kontrol edin
|
|
82
|
+
- Kotalarınızı kontrol edin (özellikle glmapi için)
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
<a name="english"></a>
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Add to your .zshrc:
|
|
92
|
+
source ~/code/claude-code-router-config/cli/ccc.zsh
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Aliases
|
|
96
|
+
|
|
97
|
+
| Command | Provider | Endpoint | Model |
|
|
98
|
+
|---------|----------|----------|-------|
|
|
99
|
+
| `glm` | z.ai Coding Plan | `api.z.ai/api/coding/paas/v4` | GLM-5 |
|
|
100
|
+
| `glmapi` | z.ai API (Credits) | `api.z.ai/api/paas/v4` | GLM-5 |
|
|
101
|
+
| `claude-pro` | Anthropic Claude Pro | Official API | Claude Sonnet 4.5 |
|
|
102
|
+
| `deepseek` | DeepSeek | `api.deepseek.com/anthropic` | deepseek-chat |
|
|
103
|
+
|
|
104
|
+
## API Key Setup
|
|
105
|
+
|
|
106
|
+
### 1. z.ai (GLM) API Key
|
|
107
|
+
|
|
108
|
+
Add to your `~/.env`:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
export GLM_API_KEY="your_z.ai_api_key_here"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Get your key from: https://z.ai/apikeys
|
|
115
|
+
|
|
116
|
+
### 2. Claude Pro
|
|
117
|
+
|
|
118
|
+
Claude Pro users can login with `claude login` or:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
export ANTHROPIC_API_KEY="your_anthropic_api_key"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 3. DeepSeek (optional)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
export DEEPSEEK_API_KEY="your_deepseek_api_key"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Example Usage
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Use GLM-5 with Coding Plan
|
|
134
|
+
glm
|
|
135
|
+
|
|
136
|
+
# Use GLM-5 with API credits
|
|
137
|
+
glmapi
|
|
138
|
+
|
|
139
|
+
# Use Claude Pro
|
|
140
|
+
claude-pro
|
|
141
|
+
|
|
142
|
+
# Use DeepSeek
|
|
143
|
+
deepseek
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## File Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
claude-code-router-config/
|
|
150
|
+
├── cli/
|
|
151
|
+
│ └── ccc.zsh # Main configuration file
|
|
152
|
+
├── config/ # Model configurations
|
|
153
|
+
├── router/ # Routing logic
|
|
154
|
+
└── docs/ # Documentation
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Troubleshooting
|
|
158
|
+
|
|
159
|
+
### "GLM_API_KEY not set" error
|
|
160
|
+
- Make sure the key in `~/.env` is correct
|
|
161
|
+
- After saving, restart terminal or run `source ~/.env`
|
|
162
|
+
|
|
163
|
+
### Model not working
|
|
164
|
+
- Check if your API key is valid
|
|
165
|
+
- Check your quotas (especially for glmapi)
|
package/cli/ccc.zsh
CHANGED
|
@@ -50,28 +50,48 @@ ccc() {
|
|
|
50
50
|
|
|
51
51
|
# 2. CONFIGURATION based on alias
|
|
52
52
|
case "$model_alias" in
|
|
53
|
-
glm
|
|
54
|
-
# z.ai / GLM
|
|
55
|
-
export ANTHROPIC_BASE_URL="https://api.z.ai/api/
|
|
56
|
-
# Priority: 1. ENV, 2. PP_KEY (config), 3. GLM_KEY (config)
|
|
53
|
+
glm)
|
|
54
|
+
# z.ai / GLM Coding Plan endpoint
|
|
55
|
+
export ANTHROPIC_BASE_URL="https://api.z.ai/api/coding/paas/v4"
|
|
57
56
|
export ANTHROPIC_API_KEY="${GLM_API_KEY:-${PPINFRA_API_KEY:-$GLM_KEY}}"
|
|
58
57
|
export ANTHROPIC_AUTH_TOKEN="$ANTHROPIC_API_KEY"
|
|
59
|
-
export ANTHROPIC_MODEL="glm-
|
|
58
|
+
export ANTHROPIC_MODEL="glm-5"
|
|
60
59
|
export API_TIMEOUT_MS=3000000
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
export
|
|
64
|
-
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-4.7"
|
|
61
|
+
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5"
|
|
62
|
+
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5"
|
|
65
63
|
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.5-air"
|
|
66
64
|
export ANTHROPIC_SMALL_FAST_MODEL="glm-4.5-air"
|
|
67
|
-
export CLAUDE_CODE_SUBAGENT_MODEL="glm-
|
|
65
|
+
export CLAUDE_CODE_SUBAGENT_MODEL="glm-5"
|
|
68
66
|
|
|
69
67
|
if [[ -z "$ANTHROPIC_API_KEY" ]]; then
|
|
70
68
|
echo "GLM_API_KEY not set. Add it to ~/.env or ~/.claude-code-router/keys.env" >&2
|
|
71
69
|
return 1
|
|
72
70
|
fi
|
|
73
71
|
|
|
74
|
-
echo "🔄 Provider: z.ai (GLM
|
|
72
|
+
echo "🔄 Provider: z.ai (GLM-5 Coding Plan)"
|
|
73
|
+
;;
|
|
74
|
+
|
|
75
|
+
glmapi)
|
|
76
|
+
# z.ai / GLM Standard API (kredi ile kullanım)
|
|
77
|
+
export ANTHROPIC_BASE_URL="https://api.z.ai/api/paas/v4"
|
|
78
|
+
export ANTHROPIC_API_KEY="${GLM_API_KEY:-${PPINFRA_API_KEY:-$GLM_KEY}}"
|
|
79
|
+
export ANTHROPIC_AUTH_TOKEN="$ANTHROPIC_API_KEY"
|
|
80
|
+
export ANTHROPIC_MODEL="glm-5"
|
|
81
|
+
export API_TIMEOUT_MS=3000000
|
|
82
|
+
|
|
83
|
+
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5"
|
|
84
|
+
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5"
|
|
85
|
+
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.5-air"
|
|
86
|
+
export ANTHROPIC_SMALL_FAST_MODEL="glm-4.5-air"
|
|
87
|
+
export CLAUDE_CODE_SUBAGENT_MODEL="glm-5"
|
|
88
|
+
|
|
89
|
+
if [[ -z "$ANTHROPIC_API_KEY" ]]; then
|
|
90
|
+
echo "GLM_API_KEY not set. Add it to ~/.env or ~/.claude-code-router/keys.env" >&2
|
|
91
|
+
return 1
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
echo "🔄 Provider: z.ai (GLM-5 API - Kredi)"
|
|
75
95
|
;;
|
|
76
96
|
|
|
77
97
|
ds|deepseek)
|
|
@@ -93,7 +113,7 @@ ccc() {
|
|
|
93
113
|
|
|
94
114
|
*)
|
|
95
115
|
echo "Unknown model alias: $model_alias"
|
|
96
|
-
echo "Available: glm, ds, claude"
|
|
116
|
+
echo "Available: glm (coding plan), glmapi (kredi), ds, claude"
|
|
97
117
|
return 1
|
|
98
118
|
;;
|
|
99
119
|
esac
|
|
@@ -110,5 +130,6 @@ ccc() {
|
|
|
110
130
|
|
|
111
131
|
# Shortcuts
|
|
112
132
|
alias glm="ccc glm"
|
|
133
|
+
alias glmapi="ccc glmapi"
|
|
113
134
|
alias deepseek="ccc ds"
|
|
114
135
|
alias claude-pro="ccc claude"
|
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
# Provider Setup Guide / Provider Kurulum Rehberi
|
|
2
|
+
|
|
3
|
+
[English](#english) | [Türkçe](#türkçe)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<a name="english"></a>
|
|
8
|
+
## English | Provider Setup Guide
|
|
9
|
+
|
|
10
|
+
### Overview
|
|
11
|
+
|
|
12
|
+
Claude Code Router supports multiple AI providers with intelligent routing. You can use one or more providers simultaneously, and the router will automatically switch between them based on cost, performance, and quality.
|
|
13
|
+
|
|
14
|
+
### Current Architecture
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Request → Smart Intent Router → Provider Selection → AI Response
|
|
18
|
+
↓ ↓
|
|
19
|
+
Intent Analysis GLM (Primary)
|
|
20
|
+
(Cost Optimized) Qwen (Fallback)
|
|
21
|
+
Gemini (Backup)
|
|
22
|
+
OpenAI (Premium)
|
|
23
|
+
Anthropic (Quality)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Quick Start
|
|
27
|
+
|
|
28
|
+
1. **Install & Setup**
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @halilertekin/claude-code-router-config
|
|
31
|
+
ccr-setup
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. **Configure API Keys**
|
|
35
|
+
```bash
|
|
36
|
+
# Edit your .env file
|
|
37
|
+
nano ~/.env
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. **Start Router**
|
|
41
|
+
```bash
|
|
42
|
+
ccr start # Start router server
|
|
43
|
+
ccr code # Start router + Claude Code
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### Available Providers
|
|
49
|
+
|
|
50
|
+
| Provider | API Base URL | Cost (per 1M tokens) | Best For |
|
|
51
|
+
|----------|-------------|---------------------|----------|
|
|
52
|
+
| **GLM (z.ai)** | `https://api.z.ai/api/anthropic` | ~$0.50 | Cost-effective, multilingual |
|
|
53
|
+
| **Qwen** | `https://dashscope-intl.aliyuncs.com/...` | ~$0.10 | Coding, cost-optimized |
|
|
54
|
+
| **Gemini** | `https://generativelanguage.googleapis.com/...` | ~$0.01 | Fast responses |
|
|
55
|
+
| **OpenAI** | `https://api.openai.com/v1/...` | ~$2.50 | Premium quality |
|
|
56
|
+
| **Anthropic** | `https://api.anthropic.com/v1/...` | ~$3.00 | Best quality |
|
|
57
|
+
| **OpenRouter** | `https://openrouter.ai/api/v1/...` | Variable | Variety, fallback |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Adding Providers
|
|
62
|
+
|
|
63
|
+
#### Step 1: Get API Key
|
|
64
|
+
|
|
65
|
+
**GLM (z.ai)**
|
|
66
|
+
- Website: https://open.bigmodel.cn/
|
|
67
|
+
- Pricing: https://open.bigmodel.cn/pricing
|
|
68
|
+
- Sign up → Create API Key
|
|
69
|
+
|
|
70
|
+
**Qwen (Alibaba)**
|
|
71
|
+
- Website: https://dashscope-intl.aliyuncs.com/
|
|
72
|
+
- Pricing: https://dashscope-intl.aliyuncs.com/pricing
|
|
73
|
+
- Sign up → Create API Key
|
|
74
|
+
|
|
75
|
+
**Gemini (Google)**
|
|
76
|
+
- Website: https://ai.google.dev/
|
|
77
|
+
- Pricing: Free tier available
|
|
78
|
+
- Sign up → Create API Key
|
|
79
|
+
|
|
80
|
+
**OpenAI**
|
|
81
|
+
- Website: https://platform.openai.com/
|
|
82
|
+
- Pricing: https://openai.com/pricing
|
|
83
|
+
- Sign up → Create API Key
|
|
84
|
+
|
|
85
|
+
**Anthropic**
|
|
86
|
+
- Website: https://console.anthropic.com/
|
|
87
|
+
- Pricing: https://anthropic.com/pricing
|
|
88
|
+
- Sign up → Create API Key
|
|
89
|
+
|
|
90
|
+
**OpenRouter**
|
|
91
|
+
- Website: https://openrouter.ai/
|
|
92
|
+
- Pricing: Varies by model
|
|
93
|
+
- Sign up → Create API Key
|
|
94
|
+
|
|
95
|
+
#### Step 2: Add to `.env` File
|
|
96
|
+
|
|
97
|
+
Edit `~/.env`:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Primary Provider (GLM - Recommended)
|
|
101
|
+
export GLM_API_KEY="your_glm_api_key_here"
|
|
102
|
+
|
|
103
|
+
# Additional Providers (Optional - for routing)
|
|
104
|
+
export QWEN_API_KEY="your_qwen_api_key_here"
|
|
105
|
+
export GEMINI_API_KEY="your_gemini_api_key_here"
|
|
106
|
+
export OPENAI_API_KEY="your_openai_api_key_here"
|
|
107
|
+
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
|
|
108
|
+
export OPENROUTER_API_KEY="your_openrouter_api_key_here"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Step 3: Verify Setup
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Check configuration
|
|
115
|
+
ccr status --detailed
|
|
116
|
+
|
|
117
|
+
# Test provider connection
|
|
118
|
+
ccr test glm
|
|
119
|
+
ccr test qwen
|
|
120
|
+
ccr test gemini
|
|
121
|
+
|
|
122
|
+
# Benchmark providers
|
|
123
|
+
ccr benchmark --all --compare-speed
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### Inter-Provider Routing
|
|
129
|
+
|
|
130
|
+
The router automatically switches between providers based on:
|
|
131
|
+
|
|
132
|
+
1. **Intent Analysis**
|
|
133
|
+
- Coding tasks → GLM (cost-effective)
|
|
134
|
+
- Reasoning → GLM with fallback to Qwen
|
|
135
|
+
- Fast responses → GLM or Gemini
|
|
136
|
+
- Complex tasks → OpenAI with fallback
|
|
137
|
+
|
|
138
|
+
2. **Cost Optimization**
|
|
139
|
+
- Primary: GLM (~$0.50/1M tokens)
|
|
140
|
+
- Fallback 1: Qwen (~$0.10/1M tokens)
|
|
141
|
+
- Fallback 2: Gemini (~$0.01/1M tokens)
|
|
142
|
+
- Premium: OpenAI/Anthropic (when quality needed)
|
|
143
|
+
|
|
144
|
+
3. **Health Monitoring**
|
|
145
|
+
- If provider fails → automatic fallback
|
|
146
|
+
- Performance tracking → optimal provider selection
|
|
147
|
+
- Cost tracking → budget management
|
|
148
|
+
|
|
149
|
+
#### Routing Flow Example
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
User Request: "Help me refactor this code"
|
|
153
|
+
↓
|
|
154
|
+
Intent Router: CODING intent detected
|
|
155
|
+
↓
|
|
156
|
+
Provider Selection: glm,glm-4.7 (primary)
|
|
157
|
+
↓
|
|
158
|
+
Try GLM → Success ✅
|
|
159
|
+
OR
|
|
160
|
+
Try GLM → Failure ❌ → Fallback to Qwen ✅
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Configuration Examples
|
|
166
|
+
|
|
167
|
+
#### Example 1: Cost-Optimized Setup (GLM Only)
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"Router": {
|
|
172
|
+
"default": "glm,glm-4.7",
|
|
173
|
+
"fallbacks": ["qwen,qwen-plus", "gemini,gemini-2.5-flash"]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`.env`:
|
|
179
|
+
```bash
|
|
180
|
+
export GLM_API_KEY="your_key"
|
|
181
|
+
# No other keys needed - GLM handles everything
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Example 2: Multi-Provider Setup (With Routing)
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"Router": {
|
|
189
|
+
"default": "glm,glm-4.7",
|
|
190
|
+
"fallbacks": ["qwen,qwen-plus", "gemini,gemini-2.5-flash", "openai,gpt-4o"]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`.env`:
|
|
196
|
+
```bash
|
|
197
|
+
export GLM_API_KEY="your_glm_key"
|
|
198
|
+
export QWEN_API_KEY="your_qwen_key"
|
|
199
|
+
export GEMINI_API_KEY="your_gemini_key"
|
|
200
|
+
export OPENAI_API_KEY="your_openai_key"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Example 3: Quality-Optimized Setup (Premium)
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"Router": {
|
|
208
|
+
"default": "anthropic,claude-sonnet-4-latest",
|
|
209
|
+
"fallbacks": ["openai,gpt-4o", "glm,glm-4.7"]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`.env`:
|
|
215
|
+
```bash
|
|
216
|
+
export ANTHROPIC_API_KEY="your_anthropic_key"
|
|
217
|
+
export OPENAI_API_KEY="your_openai_key"
|
|
218
|
+
export GLM_API_KEY="your_glm_key"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Advanced: Custom Routing Rules
|
|
224
|
+
|
|
225
|
+
Edit `~/.claude-code-router/smart-intent-router.js`:
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
// Custom routing based on your needs
|
|
229
|
+
CODING: {
|
|
230
|
+
patterns: [/\b(coding|debug|refactor)\b/i],
|
|
231
|
+
route: "glm,glm-4.7", // Primary
|
|
232
|
+
fallbacks: [
|
|
233
|
+
"qwen,qwen3-coder-plus", // Fallback 1
|
|
234
|
+
"openai,gpt-4o" // Fallback 2 (premium)
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Troubleshooting
|
|
242
|
+
|
|
243
|
+
**Issue: Provider not working**
|
|
244
|
+
```bash
|
|
245
|
+
# Check if API key is set
|
|
246
|
+
echo $GLM_API_KEY
|
|
247
|
+
|
|
248
|
+
# Test connection
|
|
249
|
+
ccr test glm
|
|
250
|
+
|
|
251
|
+
# Check logs
|
|
252
|
+
tail -f ~/.claude-code-router/logs/app.log
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Issue: Always using same provider**
|
|
256
|
+
```bash
|
|
257
|
+
# Check router config
|
|
258
|
+
cat ~/.claude-code-router/config.json | jq '.Router'
|
|
259
|
+
|
|
260
|
+
# Verify intent router
|
|
261
|
+
cat ~/.claude-code-router/smart-intent-router.js
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Issue: High costs**
|
|
265
|
+
```bash
|
|
266
|
+
# Check analytics
|
|
267
|
+
ccr analytics --today
|
|
268
|
+
|
|
269
|
+
# Verify cost optimization is enabled
|
|
270
|
+
ccr status --detailed --show-costs
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
### Cost Comparison
|
|
276
|
+
|
|
277
|
+
| Task | Claude Sonnet 4.5 | GLM 4.7 | Savings |
|
|
278
|
+
|------|-------------------|---------|---------|
|
|
279
|
+
| 100K coding tasks | $300 | $50 | **83%** |
|
|
280
|
+
| 1M tokens input | $3.00 | $0.50 | **83%** |
|
|
281
|
+
| 1M tokens output | $15.00 | $2.00 | **87%** |
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
<a name="türkçe"></a>
|
|
286
|
+
---
|
|
287
|
+
## Türkçe | Provider Kurulum Rehberi
|
|
288
|
+
|
|
289
|
+
### Genel Bakış
|
|
290
|
+
|
|
291
|
+
Claude Code Router, birden fazla AI sağlayıcısını akıllı yönlendirme ile destekler. Aynı anda bir veya daha fazla sağlayıcı kullanabilirsiniz, router maliyet, performans ve kaliteye göre otomatik olarak sağlayıcılar arası geçiş yapar.
|
|
292
|
+
|
|
293
|
+
### Mevcut Mimari
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
İstek → Akıllı Intent Router → Sağlayıcı Seçimi → AI Cevabı
|
|
297
|
+
↓ ↓
|
|
298
|
+
Intent Analizi GLM (Birincil)
|
|
299
|
+
(Maliyet Optimize) Qwen (Yedek)
|
|
300
|
+
Gemini (Yedek 2)
|
|
301
|
+
OpenAI (Premium)
|
|
302
|
+
Anthropic (Kalite)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Hızlı Başlangıç
|
|
306
|
+
|
|
307
|
+
1. **Kurulum**
|
|
308
|
+
```bash
|
|
309
|
+
npm install -g @halilertekin/claude-code-router-config
|
|
310
|
+
ccr-setup
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
2. **API Key Yapılandırma**
|
|
314
|
+
```bash
|
|
315
|
+
# .env dosyasını düzenle
|
|
316
|
+
nano ~/.env
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
3. **Router'ı Başlat**
|
|
320
|
+
```bash
|
|
321
|
+
ccr start # Router sunucusunu başlat
|
|
322
|
+
ccr code # Router + Claude Code'u başlat
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### Mevcut Sağlayıcılar
|
|
328
|
+
|
|
329
|
+
| Sağlayıcı | API URL | Maliyet (1M token) | En İyi Kullanım |
|
|
330
|
+
|-----------|---------|-------------------|-----------------|
|
|
331
|
+
| **GLM (z.ai)** | `https://api.z.ai/api/anthropic` | ~$0.50 | Ucuz, çok dilli |
|
|
332
|
+
| **Qwen** | `https://dashscope-intl.aliyuncs.com/...` | ~$0.10 | Kodlama, ucuz |
|
|
333
|
+
| **Gemini** | `https://generativelanguage.googleapis.com/...` | ~$0.01 | Hızlı cevap |
|
|
334
|
+
| **OpenAI** | `https://api.openai.com/v1/...` | ~$2.50 | Premium kalite |
|
|
335
|
+
| **Anthropic** | `https://api.anthropic.com/v1/...` | ~$3.00 | En iyi kalite |
|
|
336
|
+
| **OpenRouter** | `https://openrouter.ai/api/v1/...` | Değişken | Çeşitlilik |
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
### Sağlayıcı Ekleme
|
|
341
|
+
|
|
342
|
+
#### Adım 1: API Key Al
|
|
343
|
+
|
|
344
|
+
**GLM (z.ai)**
|
|
345
|
+
- Website: https://open.bigmodel.cn/
|
|
346
|
+
- Fiyatlandırma: https://open.bigmodel.cn/pricing
|
|
347
|
+
- Kayıt ol → API Key Oluştur
|
|
348
|
+
|
|
349
|
+
**Qwen (Alibaba)**
|
|
350
|
+
- Website: https://dashscope-intl.aliyuncs.com/
|
|
351
|
+
- Fiyatlandırma: https://dashscope-intl.aliyuncs.com/pricing
|
|
352
|
+
- Kayıt ol → API Key Oluştur
|
|
353
|
+
|
|
354
|
+
**Gemini (Google)**
|
|
355
|
+
- Website: https://ai.google.dev/
|
|
356
|
+
- Fiyatlandırma: Ücretsiz tier mevcut
|
|
357
|
+
- Kayıt ol → API Key Oluştur
|
|
358
|
+
|
|
359
|
+
**OpenAI**
|
|
360
|
+
- Website: https://platform.openai.com/
|
|
361
|
+
- Fiyatlandırma: https://openai.com/pricing
|
|
362
|
+
- Kayıt ol → API Key Oluştur
|
|
363
|
+
|
|
364
|
+
**Anthropic**
|
|
365
|
+
- Website: https://console.anthropic.com/
|
|
366
|
+
- Fiyatlandırma: https://anthropic.com/pricing
|
|
367
|
+
- Kayıt ol → API Key Oluştur
|
|
368
|
+
|
|
369
|
+
**OpenRouter**
|
|
370
|
+
- Website: https://openrouter.ai/
|
|
371
|
+
- Fiyatlandırma: Modele göre değişir
|
|
372
|
+
- Kayıt ol → API Key Oluştur
|
|
373
|
+
|
|
374
|
+
#### Adım 2: `.env` Dosyasına Ekle
|
|
375
|
+
|
|
376
|
+
`~/.env` dosyasını düzenle:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Birincil Sağlayıcı (GLM - Önerilen)
|
|
380
|
+
export GLM_API_KEY="glm_api_key_buraya"
|
|
381
|
+
|
|
382
|
+
# Ek Sağlayıcılar (Opsiyonel - yönlendirme için)
|
|
383
|
+
export QWEN_API_KEY="qwen_api_key_buraya"
|
|
384
|
+
export GEMINI_API_KEY="gemini_api_key_buraya"
|
|
385
|
+
export OPENAI_API_KEY="openai_api_key_buraya"
|
|
386
|
+
export ANTHROPIC_API_KEY="anthropic_api_key_buraya"
|
|
387
|
+
export OPENROUTER_API_KEY="openrouter_api_key_buraya"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
#### Adım 3: Kurulumu Doğrula
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
# Yapılandırmayı kontrol et
|
|
394
|
+
ccr status --detailed
|
|
395
|
+
|
|
396
|
+
# Sağlayıcı bağlantısını test et
|
|
397
|
+
ccr test glm
|
|
398
|
+
ccr test qwen
|
|
399
|
+
ccr test gemini
|
|
400
|
+
|
|
401
|
+
# Sağlayıcıları benchmark et
|
|
402
|
+
ccr benchmark --all --compare-speed
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
### Sağlayıcılar Arası Yönlendirme
|
|
408
|
+
|
|
409
|
+
Router, sağlayıcılar arasında şunlara göre otomatik geçiş yapar:
|
|
410
|
+
|
|
411
|
+
1. **Intent Analizi**
|
|
412
|
+
- Kodlama görevleri → GLM (ucuz)
|
|
413
|
+
- Akıl yürütme → GLM, Qwen yedeği
|
|
414
|
+
- Hızlı cevaplar → GLM veya Gemini
|
|
415
|
+
- Karmaşık görevler → OpenAI, yedeği mevcut
|
|
416
|
+
|
|
417
|
+
2. **Maliyet Optimizasyonu**
|
|
418
|
+
- Birincil: GLM (~$0.50/1M token)
|
|
419
|
+
- Yedek 1: Qwen (~$0.10/1M token)
|
|
420
|
+
- Yedek 2: Gemini (~$0.01/1M token)
|
|
421
|
+
- Premium: OpenAI/Anthropic (kalite gerektiğinde)
|
|
422
|
+
|
|
423
|
+
3. **Sağlık İzleme**
|
|
424
|
+
- Sağlayıcı başarısız → otomatik yedek
|
|
425
|
+
- Performans izleme → optimal sağlayıcı seçimi
|
|
426
|
+
- Maliyet izleme → bütçe yönetimi
|
|
427
|
+
|
|
428
|
+
#### Yönlendirme Akışı Örneği
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
Kullanıcı İsteği: "Bu kodu refactor etmemeye yardımcı olur musun?"
|
|
432
|
+
↓
|
|
433
|
+
Intent Router: KODlama intent'i algılandı
|
|
434
|
+
↓
|
|
435
|
+
Sağlayıcı Seçimi: glm,glm-4.7 (birincil)
|
|
436
|
+
↓
|
|
437
|
+
GLM Dene → Başarılı ✅
|
|
438
|
+
VEYA
|
|
439
|
+
GLM Dene → Başarısız ❌ → Qwen Yedeği ✅
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
### Yapılandırma Örnekleri
|
|
445
|
+
|
|
446
|
+
#### Örnek 1: Maliyet Optimize Kurulum (Sadece GLM)
|
|
447
|
+
|
|
448
|
+
```json
|
|
449
|
+
{
|
|
450
|
+
"Router": {
|
|
451
|
+
"default": "glm,glm-4.7",
|
|
452
|
+
"fallbacks": ["qwen,qwen-plus", "gemini,gemini-2.5-flash"]
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
`.env`:
|
|
458
|
+
```bash
|
|
459
|
+
export GLM_API_KEY="senin_key"
|
|
460
|
+
# Diğer key'lere gerek yok - GLM her şeyi halleder
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### Örnek 2: Çoklu Sağlayıcı Kurulum (Yönlendirme ile)
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"Router": {
|
|
468
|
+
"default": "glm,glm-4.7",
|
|
469
|
+
"fallbacks": ["qwen,qwen-plus", "gemini,gemini-2.5-flash", "openai,gpt-4o"]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
`.env`:
|
|
475
|
+
```bash
|
|
476
|
+
export GLM_API_KEY="glm_key"
|
|
477
|
+
export QWEN_API_KEY="qwen_key"
|
|
478
|
+
export GEMINI_API_KEY="gemini_key"
|
|
479
|
+
export OPENAI_API_KEY="openai_key"
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
#### Örnek 3: Kalite Optimize Kurulum (Premium)
|
|
483
|
+
|
|
484
|
+
```json
|
|
485
|
+
{
|
|
486
|
+
"Router": {
|
|
487
|
+
"default": "anthropic,claude-sonnet-4-latest",
|
|
488
|
+
"fallbacks": ["openai,gpt-4o", "glm,glm-4.7"]
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
`.env`:
|
|
494
|
+
```bash
|
|
495
|
+
export ANTHROPIC_API_KEY="anthropic_key"
|
|
496
|
+
export OPENAI_API_KEY="openai_key"
|
|
497
|
+
export GLM_API_KEY="glm_key"
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
### İleri Seviye: Özel Yönlendirme Kuralları
|
|
503
|
+
|
|
504
|
+
`~/.claude-code-router/smart-intent-router.js` dosyasını düzenle:
|
|
505
|
+
|
|
506
|
+
```javascript
|
|
507
|
+
// İhtiyaçlarına göre özel yönlendirme
|
|
508
|
+
CODING: {
|
|
509
|
+
patterns: [/\b(coding|debug|refactor|kodlama)\b/i],
|
|
510
|
+
route: "glm,glm-4.7", // Birincil
|
|
511
|
+
fallbacks: [
|
|
512
|
+
"qwen,qwen3-coder-plus", // Yedek 1
|
|
513
|
+
"openai,gpt-4o" // Yedek 2 (premium)
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
### Sorun Giderme
|
|
521
|
+
|
|
522
|
+
**Sorun: Sağlayıcı çalışmıyor**
|
|
523
|
+
```bash
|
|
524
|
+
# API key'in ayarlanmış olduğunu kontrol et
|
|
525
|
+
echo $GLM_API_KEY
|
|
526
|
+
|
|
527
|
+
# Bağlantıyı test et
|
|
528
|
+
ccr test glm
|
|
529
|
+
|
|
530
|
+
# Logları kontrol et
|
|
531
|
+
tail -f ~/.claude-code-router/logs/app.log
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Sorun: Her zaman aynı sağlayıcıyı kullanıyor**
|
|
535
|
+
```bash
|
|
536
|
+
# Router yapılandırmasını kontrol et
|
|
537
|
+
cat ~/.claude-code-router/config.json | jq '.Router'
|
|
538
|
+
|
|
539
|
+
# Intent router'ı doğrula
|
|
540
|
+
cat ~/.claude-code-router/smart-intent-router.js
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
**Sorun: Yüksek maliyetler**
|
|
544
|
+
```bash
|
|
545
|
+
# Analitikleri kontrol et
|
|
546
|
+
ccr analytics --today
|
|
547
|
+
|
|
548
|
+
# Maliyet optimizasyonunun açık olduğunu doğrula
|
|
549
|
+
ccr status --detailed --show-costs
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### Maliyet Karşılaştırması
|
|
555
|
+
|
|
556
|
+
| Görev | Claude Sonnet 4.5 | GLM 4.7 | Tasarruf |
|
|
557
|
+
|------|-------------------|---------|---------|
|
|
558
|
+
| 100K kodlama görevi | $300 | $50 | **%83** |
|
|
559
|
+
| 1M token input | $3.00 | $0.50 | **%83** |
|
|
560
|
+
| 1M token output | $15.00 | $2.00 | **%87** |
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
### CLI Komutları
|
|
565
|
+
|
|
566
|
+
```bash
|
|
567
|
+
# Router yönetimi
|
|
568
|
+
ccr start # Router'ı başlat
|
|
569
|
+
ccr stop # Router'ı durdur
|
|
570
|
+
ccr restart # Router'ı yeniden başlat
|
|
571
|
+
ccr status # Durumu göster
|
|
572
|
+
ccr code # Router + Claude Code
|
|
573
|
+
|
|
574
|
+
# İstatistikler
|
|
575
|
+
ccr analytics --today # Bugünün kullanımı
|
|
576
|
+
ccr analytics # Haftalık özet
|
|
577
|
+
ccr benchmark # Karşılaştırmalı test
|
|
578
|
+
|
|
579
|
+
# Test ve doğrulama
|
|
580
|
+
ccr test glm # GLM bağlantısını test et
|
|
581
|
+
ccr config validate # Yapılandırmayı doğrula
|
|
582
|
+
|
|
583
|
+
# Dashboard
|
|
584
|
+
ccr ui # Web dashboard'ı aç
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
### Daha Fazla Bilgi
|
|
590
|
+
|
|
591
|
+
- **GitHub Repository**: https://github.com/halilertekin/CC-RouterMultiProvider
|
|
592
|
+
- **Issues**: https://github.com/halilertekin/CC-RouterMultiProvider/issues
|
|
593
|
+
- **Changelog**: [CHANGELOG.md](../CHANGELOG.md)
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
*Created by Halil Ertekin*
|
|
598
|
+
*Version: 2.0.9*
|
|
599
|
+
*Last Updated: 2025-01-11*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halilertekin/claude-code-router-config",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Multi-provider configuration for Claude Code Router with intent-based routing, advanced CLI tools, analytics, and smart routing. Setup OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, and GitHub Copilot with intelligent routing.",
|
|
5
5
|
"main": "install.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
"CHANGELOG.md",
|
|
40
40
|
"LICENSE",
|
|
41
41
|
"README.md",
|
|
42
|
-
"NPM_README.md"
|
|
42
|
+
"NPM_README.md",
|
|
43
|
+
"SETUP.md",
|
|
44
|
+
"quick-setup.sh"
|
|
43
45
|
],
|
|
44
46
|
"keywords": [
|
|
45
47
|
"claude",
|
package/quick-setup.sh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/zsh
|
|
2
|
+
|
|
3
|
+
# Claude Code Router - Quick Setup Script
|
|
4
|
+
# Usage: ./quick-setup.sh
|
|
5
|
+
|
|
6
|
+
echo "🔧 Claude Code Router - Quick Setup / Hızlı Kurulum"
|
|
7
|
+
echo "====================================================="
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
10
|
+
ZSHRC="$HOME/.zshrc"
|
|
11
|
+
|
|
12
|
+
# 1. Add source line to .zshrc
|
|
13
|
+
SOURCE_LINE='[[ -f "$HOME/code/claude-code-router-config/cli/ccc.zsh" ]] && source "$HOME/code/claude-code-router-config/cli/ccc.zsh"'
|
|
14
|
+
|
|
15
|
+
if grep -q "claude-code-router-config/cli/ccc.zsh" "$ZSHRC" 2>/dev/null; then
|
|
16
|
+
echo "✅ .zshrc already configured"
|
|
17
|
+
else
|
|
18
|
+
echo "" >> "$ZSHRC"
|
|
19
|
+
echo "# Claude Code Router" >> "$ZSHRC"
|
|
20
|
+
echo "$SOURCE_LINE" >> "$ZSHRC"
|
|
21
|
+
echo "✅ .zshrc updated"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# 2. Check .env file
|
|
25
|
+
ENV_FILE="$HOME/.env"
|
|
26
|
+
if [[ ! -f "$ENV_FILE" ]]; then
|
|
27
|
+
touch "$ENV_FILE"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if grep -q "GLM_API_KEY" "$ENV_FILE" 2>/dev/null; then
|
|
31
|
+
echo "✅ GLM_API_KEY defined"
|
|
32
|
+
else
|
|
33
|
+
echo "" >> "$ENV_FILE"
|
|
34
|
+
echo "# z.ai GLM API Key" >> "$ENV_FILE"
|
|
35
|
+
echo 'export GLM_API_KEY="YOUR_KEY_HERE"' >> "$ENV_FILE"
|
|
36
|
+
echo "⚠️ Added GLM_API_KEY to .env - replace with your actual key"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# 3. Reload shell
|
|
40
|
+
source "$ZSHRC"
|
|
41
|
+
|
|
42
|
+
echo ""
|
|
43
|
+
echo "✅ Setup complete!"
|
|
44
|
+
echo ""
|
|
45
|
+
echo "Usage / Kullanım:"
|
|
46
|
+
echo " glm → z.ai Coding Plan (GLM-5)"
|
|
47
|
+
echo " glmapi → z.ai API Credits (GLM-5)"
|
|
48
|
+
echo " claude-pro → Claude Pro"
|
|
49
|
+
echo " deepseek → DeepSeek"
|
|
50
|
+
echo ""
|
|
51
|
+
echo "Next steps / Sonraki adımlar:"
|
|
52
|
+
echo " 1. Get API key from https://z.ai/apikeys"
|
|
53
|
+
echo " 2. Update GLM_API_KEY in ~/.env"
|
|
54
|
+
echo " 3. Restart terminal"
|
|
55
|
+
echo ""
|
|
@@ -130,6 +130,65 @@ class Dashboard {
|
|
|
130
130
|
statusDown: 'Niet beschikbaar',
|
|
131
131
|
statusUnknown: 'Onbekend',
|
|
132
132
|
dataUnavailable: 'Geen gegevens'
|
|
133
|
+
},
|
|
134
|
+
en: {
|
|
135
|
+
appTitle: 'Claude Code Router',
|
|
136
|
+
appSubtitle: 'Unified router dashboard',
|
|
137
|
+
refresh: 'Refresh',
|
|
138
|
+
connected: 'Connected',
|
|
139
|
+
disconnected: 'Disconnected',
|
|
140
|
+
overview: 'Overview',
|
|
141
|
+
lastUpdated: 'Last updated',
|
|
142
|
+
requests: 'Requests',
|
|
143
|
+
tokens: 'Tokens',
|
|
144
|
+
cost: 'Cost',
|
|
145
|
+
avgLatency: 'Avg Latency',
|
|
146
|
+
providers: 'Providers',
|
|
147
|
+
quickActions: 'Quick Actions',
|
|
148
|
+
export: 'Export',
|
|
149
|
+
refreshHealth: 'Refresh Health',
|
|
150
|
+
analytics: 'Analytics',
|
|
151
|
+
periodLabel: 'Period',
|
|
152
|
+
periodToday: 'Today',
|
|
153
|
+
periodWeek: 'Last 7 days',
|
|
154
|
+
periodMonth: 'Last 30 days',
|
|
155
|
+
totalRequests: 'Total Requests',
|
|
156
|
+
totalTokens: 'Total Tokens',
|
|
157
|
+
totalCost: 'Total Cost',
|
|
158
|
+
topProviders: 'Most Used',
|
|
159
|
+
health: 'Health',
|
|
160
|
+
system: 'System',
|
|
161
|
+
uptime: 'Uptime',
|
|
162
|
+
memory: 'Memory',
|
|
163
|
+
cpu: 'CPU',
|
|
164
|
+
node: 'Node Version',
|
|
165
|
+
config: 'Configuration',
|
|
166
|
+
configSummary: 'Summary',
|
|
167
|
+
providerCount: 'Provider count',
|
|
168
|
+
defaultRoute: 'Default route',
|
|
169
|
+
logging: 'Logging',
|
|
170
|
+
configJson: 'Configuration',
|
|
171
|
+
env: 'Environment Variables',
|
|
172
|
+
envHint: 'Quickly update keys',
|
|
173
|
+
envStatus: 'Status',
|
|
174
|
+
envUpdate: 'Update',
|
|
175
|
+
envKeyLabel: 'Key',
|
|
176
|
+
envKeyPlaceholder: 'CUSTOM_KEY',
|
|
177
|
+
envValueLabel: 'Value',
|
|
178
|
+
envSave: 'Save',
|
|
179
|
+
envSaved: 'Saved',
|
|
180
|
+
envSaveError: 'Save failed',
|
|
181
|
+
envSet: 'Set',
|
|
182
|
+
envMissing: 'Missing',
|
|
183
|
+
envPath: 'File',
|
|
184
|
+
envSelect: 'Select key',
|
|
185
|
+
logOn: 'On',
|
|
186
|
+
logOff: 'Off',
|
|
187
|
+
statusHealthy: 'Healthy',
|
|
188
|
+
statusDegraded: 'Degraded',
|
|
189
|
+
statusDown: 'Down',
|
|
190
|
+
statusUnknown: 'Unknown',
|
|
191
|
+
dataUnavailable: 'No data'
|
|
133
192
|
}
|
|
134
193
|
};
|
|
135
194
|
}
|
|
@@ -137,10 +196,10 @@ class Dashboard {
|
|
|
137
196
|
detectLanguage() {
|
|
138
197
|
const stored = localStorage.getItem('ccr_lang');
|
|
139
198
|
if (stored) return stored;
|
|
140
|
-
const lang = navigator.language || '
|
|
199
|
+
const lang = navigator.language || 'en';
|
|
141
200
|
if (lang.startsWith('nl')) return 'nl';
|
|
142
201
|
if (lang.startsWith('tr')) return 'tr';
|
|
143
|
-
return '
|
|
202
|
+
return 'en';
|
|
144
203
|
}
|
|
145
204
|
|
|
146
205
|
t(key) {
|
|
@@ -512,7 +571,11 @@ class Dashboard {
|
|
|
512
571
|
}
|
|
513
572
|
|
|
514
573
|
locale() {
|
|
515
|
-
|
|
574
|
+
switch (this.lang) {
|
|
575
|
+
case 'nl': return 'nl-NL';
|
|
576
|
+
case 'tr': return 'tr-TR';
|
|
577
|
+
default: return 'en-US';
|
|
578
|
+
}
|
|
516
579
|
}
|
|
517
580
|
|
|
518
581
|
formatNumber(value) {
|