claude-glm 1.0.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 ADDED
@@ -0,0 +1,782 @@
1
+ # Claude-GLM Wrapper
2
+
3
+ Use [Z.AI's GLM models](https://z.ai) with [Claude Code](https://www.anthropic.com/claude-code) — **without losing your existing Claude setup!**
4
+
5
+ Switch freely between multiple AI providers: GLM, OpenAI, Gemini, OpenRouter, and Anthropic Claude.
6
+
7
+ ## Why This Wrapper?
8
+
9
+ **💰 Cost-effective**: Access to multiple providers with competitive pricing
10
+ **🔄 Risk-free**: Your existing Claude Code setup remains completely untouched
11
+ **⚡ Multiple options**: Two modes - dedicated wrappers or multi-provider proxy
12
+ **🔀 In-session switching**: With ccx, switch models without restarting
13
+ **🎯 Perfect for**: Development, testing, or when you want model flexibility
14
+
15
+ > **Note:** This is a fork of [JoeInnsp23/claude-glm-wrapper](https://github.com/JoeInnsp23/claude-glm-wrapper) with additional features (multi-provider proxy, dangerously-skip-permissions shortcuts, etc.) that haven't been merged upstream. The `npx claude-glm-installer` command installs from the **original** repo and won't include these features. **Use the local clone method below to get the full version.**
16
+
17
+ ## Quick Start
18
+
19
+ ### Installation (Clone from this fork)
20
+
21
+ ```bash
22
+ # macOS / Linux
23
+ git clone https://github.com/aryan877/claude-glm-wrapper.git
24
+ cd claude-glm-wrapper
25
+ bash install.sh
26
+ source ~/.zshrc # or ~/.bashrc
27
+ ```
28
+
29
+ ```powershell
30
+ # Windows (PowerShell)
31
+ git clone https://github.com/aryan877/claude-glm-wrapper.git
32
+ cd claude-glm-wrapper
33
+ .\install.ps1
34
+ . $PROFILE
35
+ ```
36
+
37
+ ### Start Using
38
+
39
+ ```bash
40
+ ccg # Claude Code with GLM-4.7 (latest)
41
+ ccg45 # Claude Code with GLM-4.5
42
+ ccf # Claude Code with GLM-4.5-Air (faster)
43
+ cc # Regular Claude Code
44
+ claude-d # Claude with --dangerously-skip-permissions
45
+ claude-glm-d # GLM with --dangerously-skip-permissions
46
+ ```
47
+
48
+ That's it!
49
+
50
+ ## Features
51
+
52
+ - 🚀 **Easy switching** between GLM and Claude models
53
+ - ⚡ **Multiple GLM models**: GLM-4.7 (latest), GLM-4.5, and GLM-4.5-Air (fast)
54
+ - 🔒 **No sudo/admin required**: Installs to user's home directory
55
+ - 🖥️ **Cross-platform**: Works on Windows, macOS, and Linux
56
+ - 📁 **Isolated configs**: Each model uses its own config directory — no conflicts!
57
+ - 🔧 **Shell aliases**: Quick access with simple commands
58
+
59
+ ## Prerequisites
60
+
61
+ 1. **Node.js** (v14+): For npx installation - [nodejs.org](https://nodejs.org/)
62
+ 2. **Claude Code**: Install from [anthropic.com/claude-code](https://www.anthropic.com/claude-code)
63
+ 3. **Z.AI API Key**: Get your free key from [z.ai/manage-apikey/apikey-list](https://z.ai/manage-apikey/apikey-list)
64
+
65
+ _Note: If you don't have Node.js, you can use the platform-specific installers (see Quick Start above)_
66
+
67
+ ## Installation
68
+
69
+ ### Method 1: Local Clone (Recommended)
70
+
71
+ Clone this fork to get all features including multi-provider proxy and dangerously-skip-permissions shortcuts:
72
+
73
+ #### macOS / Linux
74
+
75
+ ```bash
76
+ git clone https://github.com/aryan877/claude-glm-wrapper.git
77
+ cd claude-glm-wrapper
78
+ bash install.sh
79
+ source ~/.zshrc # or ~/.bashrc
80
+ ```
81
+
82
+ #### Windows (PowerShell)
83
+
84
+ ```powershell
85
+ git clone https://github.com/aryan877/claude-glm-wrapper.git
86
+ cd claude-glm-wrapper
87
+ .\install.ps1
88
+ . $PROFILE
89
+ ```
90
+
91
+ The installer will:
92
+
93
+ - Check if Claude Code is installed
94
+ - Ask for your Z.AI API key
95
+ - Create wrapper scripts in `~/.local/bin/`
96
+ - Add aliases (`cc`, `ccg`, `ccf`, `claude-d`, `claude-glm-d`, etc.) to your shell config
97
+ - Optionally install `ccx` multi-provider proxy
98
+
99
+ ### Method 2: npx
100
+
101
+ ```bash
102
+ npx claude-glm
103
+ ```
104
+
105
+ This downloads and runs the installer directly from npm — no cloning needed.
106
+
107
+ ## Usage
108
+
109
+ ### Available Commands & Aliases
110
+
111
+ The installer creates these commands and aliases:
112
+
113
+ | Alias | Full Command | What It Does | When to Use |
114
+ | -------------- | ------------------------------------------- | --------------------------------- | -------------------------------------- |
115
+ | `cc` | `claude` | Regular Claude Code | Default - your normal Claude setup |
116
+ | `ccg` | `claude-glm` | GLM-4.7 (latest) | Best quality GLM model |
117
+ | `ccg45` | `claude-glm-4.5` | GLM-4.5 | Previous version of GLM |
118
+ | `ccf` | `claude-glm-fast` | GLM-4.5-Air (fast) | Quicker responses, lower cost |
119
+ | `ccx` | `ccx` | Multi-provider proxy | Switch between providers in-session |
120
+ | `claude-d` | `claude --dangerously-skip-permissions` | Claude without permission prompts | Autonomous mode (use with caution) |
121
+ | `claude-glm-d` | `claude-glm --dangerously-skip-permissions` | GLM without permission prompts | Autonomous GLM mode (use with caution) |
122
+
123
+ **💡 Tip**: Use the short aliases! They're faster to type and easier to remember.
124
+
125
+ **🆕 New: ccx Multi-Provider Proxy**
126
+
127
+ The `ccx` command starts a local proxy that lets you switch between multiple AI providers in a single session:
128
+
129
+ - **OpenAI**: GPT-4o, GPT-4o-mini, and more
130
+ - **OpenRouter**: Access to hundreds of models
131
+ - **Google Gemini**: Gemini 1.5 Pro and Flash
132
+ - **Z.AI GLM**: GLM-4.7, GLM-4.5, GLM-4.5-Air
133
+ - **Anthropic**: Claude 3.5 Sonnet, etc.
134
+
135
+ Switch models mid-session using `/model <provider>:<model-name>`. Perfect for comparing responses or using the right model for each task!
136
+
137
+ ### How It Works
138
+
139
+ Each command starts a **separate Claude Code session** with different configurations:
140
+
141
+ - `ccg`, `ccg45`, and `ccf` use Z.AI's API with your Z.AI key
142
+ - `cc` uses Anthropic's API with your Anthropic key (default Claude setup)
143
+ - Your configurations **never conflict** — they're stored in separate directories
144
+
145
+ #### Simple Wrapper Flow (ccg, ccg45, ccf)
146
+
147
+ ```
148
+ ┌─────────────────────────────────────────────────────────────────────────┐
149
+ │ YOUR COMPUTER │
150
+ │ │
151
+ │ ┌─────────────┐ │
152
+ │ │ You run │ │
153
+ │ │ "ccg" │ │
154
+ │ └──────┬──────┘ │
155
+ │ │ │
156
+ │ ▼ │
157
+ │ ┌─────────────────────────────────────────────┐ │
158
+ │ │ Wrapper Script (~/.local/bin/claude-glm) │ │
159
+ │ │ Sets environment variables: │ │
160
+ │ │ • ANTHROPIC_BASE_URL = api.z.ai │ │
161
+ │ │ • ANTHROPIC_AUTH_TOKEN = your-key │ │
162
+ │ │ Then runs: claude │ │
163
+ │ └──────┬──────────────────────────────────────┘ │
164
+ │ │ │
165
+ │ ▼ │
166
+ │ ┌─────────────────────────────────────────────┐ │
167
+ │ │ Claude Code (unchanged) │ │
168
+ │ │ Reads env vars, calls ANTHROPIC_BASE_URL │ │
169
+ │ └──────┬──────────────────────────────────────┘ │
170
+ │ │ │
171
+ └──────────┼───────────────────────────────────────────────────────────────┘
172
+
173
+
174
+ ┌─────────────────┐
175
+ │ Z.AI Servers │
176
+ │ (api.z.ai) │
177
+ │ │
178
+ │ Returns GLM-4.7│
179
+ │ responses in │
180
+ │ Anthropic format│
181
+ └─────────────────┘
182
+ ```
183
+
184
+ #### Multi-Provider Proxy Flow (ccx)
185
+
186
+ ```
187
+ ┌─────────────────────────────────────────────────────────────────────────┐
188
+ │ YOUR COMPUTER │
189
+ │ │
190
+ │ ┌─────────────┐ ┌─────────────────────┐ │
191
+ │ │ Claude Code │ ───▶ │ Local Proxy Server │ │
192
+ │ │ │ │ (localhost:17870) │ │
193
+ │ └─────────────┘ └──────────┬──────────┘ │
194
+ │ │ │
195
+ │ ┌──────────────┼──────────────┐ │
196
+ │ │ │ │ │
197
+ └────────────────────┼──────────────┼──────────────┼───────────────────────┘
198
+ ▼ ▼ ▼
199
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
200
+ │ OpenAI │ │ Z.AI │ │ Gemini │
201
+ │ GPT-4o │ │ GLM-4.7 │ │ 1.5 Pro │
202
+ └──────────┘ └──────────┘ └──────────┘
203
+ ```
204
+
205
+ The proxy reads the `model` field and routes to the right provider. Switch models in-session with `/model openai:gpt-4o`.
206
+
207
+ ### Basic Examples
208
+
209
+ **Start a coding session with the latest GLM:**
210
+
211
+ ```bash
212
+ ccg
213
+ # Opens Claude Code using GLM-4.7
214
+ ```
215
+
216
+ **Use GLM-4.5:**
217
+
218
+ ```bash
219
+ ccg45
220
+ # Opens Claude Code using GLM-4.5
221
+ ```
222
+
223
+ **Need faster responses? Use the fast model:**
224
+
225
+ ```bash
226
+ ccf
227
+ # Opens Claude Code using GLM-4.5-Air
228
+ ```
229
+
230
+ **Use regular Claude:**
231
+
232
+ ```bash
233
+ cc
234
+ # Opens Claude Code with Anthropic models (your default setup)
235
+ ```
236
+
237
+ **Pass arguments like normal:**
238
+
239
+ ```bash
240
+ ccg --help
241
+ ccg "refactor this function"
242
+ ccf "quick question about Python"
243
+ ```
244
+
245
+ ## Common Workflows
246
+
247
+ ### Workflow 1: Testing with GLM, Production with Claude
248
+
249
+ ```bash
250
+ # Develop and test with cost-effective GLM-4.7
251
+ ccg
252
+ # ... work on your code ...
253
+ # exit
254
+
255
+ # Switch to Claude for final review
256
+ cc
257
+ # ... final review with Claude ...
258
+ ```
259
+
260
+ ### Workflow 2: Quick Questions with Fast Model
261
+
262
+ ```bash
263
+ # Quick syntax questions
264
+ ccf "how do I use async/await in Python?"
265
+
266
+ # Complex refactoring with latest GLM
267
+ ccg
268
+ # ... longer coding session ...
269
+ ```
270
+
271
+ ### Workflow 3: Multiple Projects
272
+
273
+ ```bash
274
+ # Project 1: Use GLM to save costs
275
+ cd ~/project1
276
+ ccg
277
+
278
+ # Project 2: Use Claude for critical work
279
+ cd ~/project2
280
+ cc
281
+ ```
282
+
283
+ **Each session is independent** — your chat history stays separate!
284
+
285
+ ## Using ccx (Multi-Provider Proxy)
286
+
287
+ ### Setup
288
+
289
+ After installation, configure your API keys:
290
+
291
+ ```bash
292
+ # First time setup
293
+ ccx --setup
294
+ ```
295
+
296
+ This creates `~/.claude-proxy/.env`. Edit it to add your API keys:
297
+
298
+ ```bash
299
+ # macOS / Linux
300
+ nano ~/.claude-proxy/.env
301
+
302
+ # Windows
303
+ notepad %USERPROFILE%\.claude-proxy\.env
304
+ ```
305
+
306
+ Add keys for the providers you want to use:
307
+
308
+ ```ini
309
+ # OpenAI
310
+ OPENAI_API_KEY=sk-...
311
+
312
+ # OpenRouter
313
+ OPENROUTER_API_KEY=sk-or-...
314
+
315
+ # Gemini
316
+ GEMINI_API_KEY=AIza...
317
+
318
+ # Z.AI GLM
319
+ GLM_UPSTREAM_URL=https://api.z.ai/api/anthropic
320
+ ZAI_API_KEY=...
321
+
322
+ # Anthropic (if you want to route through the proxy)
323
+ ANTHROPIC_UPSTREAM_URL=https://api.anthropic.com
324
+ ANTHROPIC_API_KEY=sk-ant-...
325
+ ```
326
+
327
+ ### Starting ccx
328
+
329
+ ```bash
330
+ ccx
331
+ ```
332
+
333
+ The proxy starts automatically and Claude Code connects to it.
334
+
335
+ ### Switching Models
336
+
337
+ Use Claude Code's built-in `/model` command with provider prefixes:
338
+
339
+ ```
340
+ /model openai:gpt-4o
341
+ /model openai:gpt-4o-mini
342
+ /model openrouter:anthropic/claude-3.5-sonnet
343
+ /model openrouter:meta-llama/llama-3.1-70b-instruct
344
+ /model gemini:gemini-1.5-pro
345
+ /model gemini:gemini-1.5-flash
346
+ /model glm:glm-4.7
347
+ /model glm:glm-4.5
348
+ /model anthropic:claude-3-5-sonnet-20241022
349
+ ```
350
+
351
+ ### Custom Model Shortcuts
352
+
353
+ **Built-in shortcuts** make switching even faster! Instead of typing the full `provider:model-name`, use these aliases:
354
+
355
+ | Shortcut | Expands To | Description |
356
+ | --------------- | -------------------------------------- | -------------------------------- |
357
+ | `/model g` | `glm:glm-4.7` | Fastest way to GLM-4.7 |
358
+ | `/model glm` | `glm:glm-4.7` | Friendly GLM shortcut |
359
+ | `/model glm47` | `glm:glm-4.7` | Explicit version |
360
+ | `/model glm45` | `glm:glm-4.5` | Previous version |
361
+ | `/model flash` | `glm:glm-4-flash` | Fast model |
362
+ | `/model opus` | `anthropic:claude-opus-4-5-20251101` | Claude Opus (API key required) |
363
+ | `/model sonnet` | `anthropic:claude-sonnet-4-5-20250929` | Claude Sonnet (API key required) |
364
+ | `/model haiku` | `anthropic:claude-haiku-4-5-20251001` | Claude Haiku (API key required) |
365
+
366
+ **Note:** Claude shortcuts require `ANTHROPIC_API_KEY` in your `.env` file. Models starting with `claude-` are auto-detected and routed to Anthropic.
367
+
368
+ **How it works**: This is **not** a Claude Code feature. The local proxy intercepts your `/model` request and expands shortcuts before routing. Claude Code just sends `"model": "g"` in the HTTP request, and the proxy translates it to `glm:glm-4.7`.
369
+
370
+ **Adding your own shortcuts**: Edit `~/.claude-proxy/adapters/map.ts` and modify the `MODEL_SHORTCUTS` object:
371
+
372
+ ```typescript
373
+ const MODEL_SHORTCUTS: Record<string, string> = {
374
+ g: "glm:glm-4.7",
375
+ o1: "openai:o1-preview", // Add your own!
376
+ fast: "glm:glm-4-flash",
377
+ // ... more shortcuts
378
+ };
379
+ ```
380
+
381
+ Then restart `ccx` to use your new shortcuts.
382
+
383
+ ### ccx Workflows
384
+
385
+ **Workflow 1: Compare Model Responses**
386
+
387
+ ```bash
388
+ ccx
389
+ # Ask a question
390
+ /model openai:gpt-4o
391
+ # Ask the same question
392
+ /model gemini:gemini-1.5-pro
393
+ # Ask again - compare the responses!
394
+ ```
395
+
396
+ **Workflow 2: Cost Optimization**
397
+
398
+ ```bash
399
+ ccx
400
+ # Start with a fast, cheap model for exploration
401
+ /model glm:glm-4.5-air
402
+ # ... work on the problem ...
403
+ # Switch to a more powerful model when needed
404
+ /model openai:gpt-4o
405
+ ```
406
+
407
+ **Workflow 3: Leverage Model Strengths**
408
+
409
+ ```bash
410
+ ccx
411
+ # Use GPT-4 for coding
412
+ /model openai:gpt-4o
413
+ # ... write code ...
414
+ # Use Claude for writing/docs
415
+ /model openrouter:anthropic/claude-3.5-sonnet
416
+ # ... write documentation ...
417
+ ```
418
+
419
+ ### ccx Advantages
420
+
421
+ ✅ **Single Session**: No need to exit and restart
422
+ ✅ **Context Preserved**: Chat history continues across model switches
423
+ ✅ **Easy Comparison**: Switch models to compare responses
424
+ ✅ **Flexibility**: Use the best model for each task
425
+ ✅ **Provider Options**: OpenAI, OpenRouter, Gemini, GLM, Anthropic
426
+
427
+ ### ccx vs Dedicated Wrappers
428
+
429
+ | Feature | ccx | ccg/ccg45/ccf |
430
+ | ------------------------ | ------------- | ------------- |
431
+ | Switch models in-session | ✅ Yes | ❌ No |
432
+ | Multiple providers | ✅ Yes | ❌ GLM only |
433
+ | Separate chat history | ❌ No | ✅ Yes |
434
+ | Simple setup | ✅ .env file | ✅ Installer |
435
+ | Overhead | Proxy startup | None |
436
+
437
+ **Use ccx when**: You want flexibility and in-session switching
438
+ **Use dedicated wrappers when**: You want separate histories for different models
439
+
440
+ ## Configuration Details
441
+
442
+ ### Where Things Are Stored
443
+
444
+ Each wrapper uses its own configuration directory to prevent conflicts:
445
+
446
+ **macOS / Linux:**
447
+ | Command | Config Directory | Purpose |
448
+ |---------|-----------------|---------|
449
+ | `claude-glm` | `~/.claude-glm/` | GLM-4.7 settings and history |
450
+ | `claude-glm-4.5` | `~/.claude-glm-45/` | GLM-4.5 settings and history |
451
+ | `claude-glm-fast` | `~/.claude-glm-fast/` | GLM-4.5-Air settings and history |
452
+ | `claude` | `~/.claude/` (default) | Your original Claude setup |
453
+
454
+ **Windows:**
455
+ | Command | Config Directory | Purpose |
456
+ |---------|-----------------|---------|
457
+ | `claude-glm` | `%USERPROFILE%\.claude-glm\` | GLM-4.7 settings and history |
458
+ | `claude-glm-4.5` | `%USERPROFILE%\.claude-glm-45\` | GLM-4.5 settings and history |
459
+ | `claude-glm-fast` | `%USERPROFILE%\.claude-glm-fast\` | GLM-4.5-Air settings and history |
460
+ | `claude` | `%USERPROFILE%\.claude\` (default) | Your original Claude setup |
461
+
462
+ **This means:**
463
+
464
+ - ✅ Your original Claude settings are **never touched**
465
+ - ✅ Chat histories stay separate for each model
466
+ - ✅ API keys are isolated — no mixing!
467
+
468
+ ### Wrapper Scripts Location
469
+
470
+ **macOS / Linux:** `~/.local/bin/`
471
+
472
+ - `claude-glm` (GLM-4.7)
473
+ - `claude-glm-4.5` (GLM-4.5)
474
+ - `claude-glm-fast` (GLM-4.5-Air)
475
+
476
+ **Windows:** `%USERPROFILE%\.local\bin\`
477
+
478
+ - `claude-glm.ps1` (GLM-4.7)
479
+ - `claude-glm-4.5.ps1` (GLM-4.5)
480
+ - `claude-glm-fast.ps1` (GLM-4.5-Air)
481
+
482
+ These are just tiny wrapper scripts (bash or PowerShell) that set the right environment variables before launching Claude Code.
483
+
484
+ ## Updating Your API Key
485
+
486
+ ### macOS / Linux
487
+
488
+ **Option 1: Use the Installer**
489
+
490
+ ```bash
491
+ cd claude-glm-wrapper && bash install.sh
492
+ # Choose option "1) Update API key only"
493
+ ```
494
+
495
+ **Option 2: Edit Manually**
496
+
497
+ ```bash
498
+ nano ~/.local/bin/claude-glm
499
+ nano ~/.local/bin/claude-glm-4.5
500
+ nano ~/.local/bin/claude-glm-fast
501
+ # Find and replace ANTHROPIC_AUTH_TOKEN value
502
+ ```
503
+
504
+ ### Windows (PowerShell)
505
+
506
+ **Option 1: Use the Installer**
507
+
508
+ ```powershell
509
+ cd claude-glm-wrapper
510
+ .\install.ps1
511
+ # Choose option "1) Update API key only"
512
+ ```
513
+
514
+ **Option 2: Edit Manually**
515
+
516
+ ```powershell
517
+ notepad "$env:USERPROFILE\.local\bin\claude-glm.ps1"
518
+ notepad "$env:USERPROFILE\.local\bin\claude-glm-4.5.ps1"
519
+ notepad "$env:USERPROFILE\.local\bin\claude-glm-fast.ps1"
520
+ # Find and replace $ZaiApiKey value
521
+ ```
522
+
523
+ ## How It Works (Technical Details)
524
+
525
+ The wrapper scripts work by setting environment variables before launching Claude Code:
526
+
527
+ | Environment Variable | What It Does |
528
+ | ---------------------- | ------------------------------------------- |
529
+ | `ANTHROPIC_BASE_URL` | Points to Z.AI's API endpoint |
530
+ | `ANTHROPIC_AUTH_TOKEN` | Your Z.AI API key |
531
+ | `ANTHROPIC_MODEL` | Which model to use (glm-4.5 or glm-4.5-air) |
532
+ | `CLAUDE_HOME` | Where to store config files |
533
+
534
+ Claude Code reads these variables and uses them instead of the defaults. Simple! 🎯
535
+
536
+ ## Troubleshooting
537
+
538
+ ### ❌ "claude command not found"
539
+
540
+ **Problem**: Claude Code isn't installed or not in your PATH.
541
+
542
+ **Solutions**:
543
+
544
+ 1. Install Claude Code from [anthropic.com/claude-code](https://www.anthropic.com/claude-code)
545
+ 2. Or add Claude to your PATH if it's installed elsewhere
546
+
547
+ **Test it**: Run `which claude` — it should show a path.
548
+
549
+ ### ❌ "ccg: command not found" (or ccg45, ccf, cc)
550
+
551
+ **Problem**: You didn't source your shell config after installation.
552
+
553
+ **Solution**: Run the source command the installer showed you:
554
+
555
+ ```bash
556
+ source ~/.zshrc # or ~/.bashrc
557
+ ```
558
+
559
+ **Still not working?** Try opening a new terminal window.
560
+
561
+ ### ❌ API Authentication Errors
562
+
563
+ **Problem**: API key issues.
564
+
565
+ **Solutions for ccg/ccf/ccg45**:
566
+
567
+ 1. **Check your key**: Visit [z.ai/manage-apikey/apikey-list](https://z.ai/manage-apikey/apikey-list)
568
+ 2. **Verify credits**: Make sure your Z.AI account has available credits
569
+ 3. **Update the key**: Run `bash install.sh` and choose "Update API key only"
570
+
571
+ **Solutions for ccx**:
572
+
573
+ 1. **Check your .env file**: Edit `~/.claude-proxy/.env`
574
+ 2. **Verify keys are set**: Make sure the API keys for the providers you're using are filled in
575
+ 3. **No empty values**: If you're not using a provider, either leave it blank or remove the line
576
+ 4. **Reload**: Restart ccx after editing .env
577
+
578
+ ### ❌ ccx Proxy Won't Start
579
+
580
+ **Problem**: Proxy fails to start or times out.
581
+
582
+ **Solutions**:
583
+
584
+ 1. **Check logs**: Look at `/tmp/claude-proxy.log` (Unix) or `%TEMP%\claude-proxy.log` (Windows)
585
+ 2. **Port in use**: Another process might be using port 17870. Set `CLAUDE_PROXY_PORT=17871` in .env
586
+ 3. **Missing dependencies**: Run `npm install -g tsx` to ensure TypeScript runner is available
587
+ 4. **Check adapters**: Ensure `~/.claude-proxy/adapters/` directory exists and contains TS files
588
+
589
+ ### ❌ Models Don't Switch in ccx
590
+
591
+ **Problem**: `/model` command doesn't seem to work.
592
+
593
+ **Solutions**:
594
+
595
+ 1. **Check provider prefix**: Use format `/model provider:model-name` (e.g., `/model openai:gpt-4o`)
596
+ 2. **Verify API key**: Make sure the provider's API key is set in `~/.claude-proxy/.env`
597
+ 3. **Check proxy logs**: Look for errors in `/tmp/claude-proxy.log`
598
+
599
+ ### ❌ Wrong Model Being Used
600
+
601
+ **Problem**: Using `ccg` but it's using the wrong API.
602
+
603
+ **Solution**: Each command is independent. Make sure you:
604
+
605
+ - Exit any running Claude Code session
606
+ - Start fresh with the command you want (`ccg`, `ccg45`, `ccf`, or `cc`)
607
+
608
+ ### 🪟 Windows-Specific Issues
609
+
610
+ **❌ "cannot be loaded because running scripts is disabled"**
611
+
612
+ **Problem**: PowerShell execution policy prevents running scripts.
613
+
614
+ **Solution**:
615
+
616
+ ```powershell
617
+ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
618
+ ```
619
+
620
+ **❌ "ccg: The term 'ccg' is not recognized"**
621
+
622
+ **Problem**: PowerShell profile wasn't reloaded after installation.
623
+
624
+ **Solutions**:
625
+
626
+ 1. Reload profile: `. $PROFILE`
627
+ 2. Or restart PowerShell
628
+ 3. Or run the full command: `claude-glm`
629
+
630
+ **❌ PATH not updated**
631
+
632
+ **Problem**: The `~/.local/bin` or `$env:USERPROFILE\.local\bin` directory isn't in your PATH.
633
+
634
+ **Solution**: The installer adds it automatically, but you may need to restart PowerShell for it to take effect.
635
+
636
+ ### 💡 General Tips
637
+
638
+ - **Open new terminal**: After installation, aliases work in new terminals automatically
639
+ - **Check the greeting**: Each command prints what model it's using when it starts
640
+ - **Test with**: `ccg --version` to verify the command works
641
+
642
+ ## Uninstallation
643
+
644
+ ### macOS / Linux
645
+
646
+ **Remove wrapper scripts:**
647
+
648
+ ```bash
649
+ rm ~/.local/bin/claude-glm
650
+ rm ~/.local/bin/claude-glm-4.5
651
+ rm ~/.local/bin/claude-glm-fast
652
+ ```
653
+
654
+ **Remove config directories** (optional - deletes chat history):
655
+
656
+ ```bash
657
+ rm -rf ~/.claude-glm
658
+ rm -rf ~/.claude-glm-45
659
+ rm -rf ~/.claude-glm-fast
660
+ ```
661
+
662
+ **Remove aliases** from `~/.zshrc` or `~/.bashrc`:
663
+
664
+ ```bash
665
+ # Delete these lines:
666
+ # Claude Code Model Switcher Aliases
667
+ alias cc='claude'
668
+ alias ccg='claude-glm'
669
+ alias ccg45='claude-glm-4.5'
670
+ alias ccf='claude-glm-fast'
671
+ alias claude-d='claude --dangerously-skip-permissions'
672
+ alias claude-glm-d='claude-glm --dangerously-skip-permissions'
673
+ ```
674
+
675
+ Then run: `source ~/.zshrc`
676
+
677
+ ### Windows (PowerShell)
678
+
679
+ **Remove wrapper scripts:**
680
+
681
+ ```powershell
682
+ Remove-Item "$env:USERPROFILE\.local\bin\claude-glm.ps1"
683
+ Remove-Item "$env:USERPROFILE\.local\bin\claude-glm-4.5.ps1"
684
+ Remove-Item "$env:USERPROFILE\.local\bin\claude-glm-fast.ps1"
685
+ ```
686
+
687
+ **Remove config directories** (optional - deletes chat history):
688
+
689
+ ```powershell
690
+ Remove-Item -Recurse "$env:USERPROFILE\.claude-glm"
691
+ Remove-Item -Recurse "$env:USERPROFILE\.claude-glm-45"
692
+ Remove-Item -Recurse "$env:USERPROFILE\.claude-glm-fast"
693
+ ```
694
+
695
+ **Remove aliases** from PowerShell profile:
696
+
697
+ ```powershell
698
+ notepad $PROFILE
699
+ # Delete these lines:
700
+ # Claude Code Model Switcher Aliases
701
+ Set-Alias cc claude
702
+ Set-Alias ccg claude-glm
703
+ Set-Alias ccg45 claude-glm-4.5
704
+ Set-Alias ccf claude-glm-fast
705
+ ```
706
+
707
+ Then reload: `. $PROFILE`
708
+
709
+ ## FAQ
710
+
711
+ ### Q: Will this affect my existing Claude Code setup?
712
+
713
+ **A**: No! Your regular Claude Code setup is completely untouched. The wrappers use separate config directories.
714
+
715
+ ### Q: Can I use both GLM and Claude in the same project?
716
+
717
+ **A**: Yes! Just use `ccg` for GLM sessions and `cc` for Claude sessions. Each maintains its own chat history. Or use `ccx` to switch between providers in a single session.
718
+
719
+ ### Q: Which should I use: ccx or dedicated wrappers (ccg/ccf)?
720
+
721
+ **A**:
722
+
723
+ - **Use ccx** if you want to switch between multiple providers (OpenAI, Gemini, OpenRouter, GLM, Anthropic) in the same session
724
+ - **Use dedicated wrappers** if you want separate chat histories for different models/providers
725
+
726
+ ### Q: Which model should I use?
727
+
728
+ **A**:
729
+
730
+ - Use **`ccx`** for: Maximum flexibility, model comparison, leveraging different model strengths
731
+ - Use **`ccg` (GLM-4.7)** for: Latest model, complex coding, refactoring, detailed explanations
732
+ - Use **`ccg45` (GLM-4.5)** for: Previous version, if you need consistency with older projects
733
+ - Use **`ccf` (GLM-4.5-Air)** for: Quick questions, simple tasks, faster responses
734
+ - Use **`cc` (Claude)** for: Your regular Anthropic Claude setup
735
+
736
+ ### Q: How do I switch models in ccx?
737
+
738
+ **A**: Use the `/model` command with the format `<provider>:<model-name>`. For example:
739
+
740
+ - `/model openai:gpt-4o`
741
+ - `/model gemini:gemini-1.5-pro`
742
+ - `/model glm:glm-4.7`
743
+
744
+ ### Q: Is this secure?
745
+
746
+ **A**: Yes! Your API keys are stored locally on your machine in wrapper scripts (bash or PowerShell, depending on your OS). Keep your scripts directory secure with appropriate permissions.
747
+
748
+ ### Q: Does this work on Windows?
749
+
750
+ **A**: Yes! Use the PowerShell installer (install.ps1). Windows, macOS, and Linux are all fully supported.
751
+
752
+ ### Q: Can I use a different Z.AI model?
753
+
754
+ **A**: Yes! Edit the wrapper scripts in `~/.local/bin/` and change the `ANTHROPIC_MODEL` variable to any model Z.AI supports.
755
+
756
+ ### Q: What happens if I run out of Z.AI credits?
757
+
758
+ **A**: The GLM commands will fail with an API error. Just switch to regular Claude using `cc` until you add more credits.
759
+
760
+ ## Contributing
761
+
762
+ Found a bug? Have an idea? Contributions are welcome!
763
+
764
+ - 🐛 **Report issues**: [GitHub Issues](https://github.com/JoeInnsp23/claude-glm-wrapper/issues)
765
+ - 🔧 **Submit PRs**: Fork, improve, and open a pull request
766
+ - 💡 **Share feedback**: Tell us how you're using this tool!
767
+
768
+ ## License
769
+
770
+ MIT License - see [LICENSE](LICENSE) file for details.
771
+
772
+ **TL;DR**: Free to use, modify, and distribute. No warranty provided.
773
+
774
+ ## Acknowledgments
775
+
776
+ - 🙏 [Z.AI](https://z.ai) for providing GLM model API access
777
+ - 🙏 [Anthropic](https://anthropic.com) for Claude Code
778
+ - 🙏 You, for using this tool!
779
+
780
+ ---
781
+
782
+ **⭐ Found this useful?** Give it a star on GitHub and share it with others!