
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Public tool for Supermeo & Inwave DR Team
A CLI tool for managing multiple GLM API profiles in Claude Code/VS Code. Quickly switch between different GLM configurations without manual editing.
npm install -g glm-switch
# Clone repository
git clone https://github.com/supermeo-studio/glm-switch.git
cd glm-switch
# Setup
npm run setup
The npm run setup command will:
npm linkEach profile is a separate GLM API configuration containing:
| Config Key | Description |
|---|---|
ANTHROPIC_BASE_URL | API endpoint for GLM |
ANTHROPIC_AUTH_TOKEN | Authentication token |
ANTHROPIC_DEFAULT_HAIKU_MODEL | Haiku model (lightweight) |
ANTHROPIC_DEFAULT_SONNET_MODEL | Sonnet model (balanced) |
ANTHROPIC_DEFAULT_OPUS_MODEL | Opus model (powerful) |
Storage: Profiles are stored in ~/.claude/glm-switch/
# Create profile 0 with default values
glm-switch init 0
Output:
✓ Profile 0 created
Config: {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5"
}
Don't forget to set your auth token:
glm-switch set 0 token <your-token>
# Set token for profile 0
glm-switch set 0 token your_token_here
# Apply default profile (0)
glm-switch on
# Apply specific profile
glm-switch on 1
Important: After applying, restart Claude Code/VS Code for changes to take effect.
# Start a new child shell using profile 1 env
glm-switch start 1
# Exit child shell to return to your original terminal context
exit
This mode does not edit ~/.claude/settings.json, so other existing/new terminals keep their normal Claude setup.
# macOS bash/zsh
eval "$(glm-switch env 1 --shell zsh)"
# fish
glm-switch env 1 --shell fish | source
# PowerShell
glm-switch env 1 --shell powershell | Invoke-Expression
Use this when you explicitly want to inject profile env into the current shell process.
# Create profile 1
glm-switch init 1
# Set different token for profile 1
glm-switch set 1 token another_token_here
# Apply profile 1
glm-switch on 1
# Update Sonnet model for all profiles
glm-switch setall sonnet glm-5
# Update Opus model for all profiles
glm-switch setall opus glm-5
# Update Haiku model for all profiles
glm-switch setall haiku glm-4.5-air
# Update API endpoint for all profiles
glm-switch setall ANTHROPIC_BASE_URL https://api.z.ai/api/anthropic
glm-switch list
Output:
Profiles:
[active] [default] 0
Base URL: https://api.z.ai/api/anthropic
Token: b8eb5131e...
Haiku: glm-4.5-air
Sonnet: glm-5
Opus: glm-5
1
Base URL: https://api.z.ai/api/anthropic
Token: (not set)
Haiku: glm-4.5-air
Sonnet: glm-5
Opus: glm-5
glm-switch status
glm-switch delete 1
glm-switch off
| Command | Description | Example |
|---|---|---|
init [id] | Create a new profile | glm-switch init 0 |
set <id> <key> <value> | Set value for a specific profile | glm-switch set 0 token xxxx |
setall <key> <value> | Set value for all profiles | glm-switch setall sonnet glm-5 |
on [id] | Apply profile (default: 0) | glm-switch on 1 |
start [id] | Start child shell with profile env only | glm-switch start 1 |
env [id] --shell <shell> | Print shell export commands | glm-switch env 1 --shell zsh |
off | Remove GLM config | glm-switch off |
status | Show current status | glm-switch status |
list | List all profiles | glm-switch list |
delete <id> | Delete a profile | glm-switch delete 1 |
--help | Show help | glm-switch --help |
--version | Show version | glm-switch --version |
When using set or setall commands, you can use full keys or shorthand aliases:
ANTHROPIC_BASE_URL
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_DEFAULT_HAIKU_MODEL
ANTHROPIC_DEFAULT_SONNET_MODEL
ANTHROPIC_DEFAULT_OPUS_MODEL
token
haiku
sonnet
opus
~/.claude/
├── settings.json # Claude Code settings
└── glm-switch/ # GLM Switch profiles directory
├── profile-0.json # Profile 0 config
├── profile-1.json # Profile 1 config
├── active-profile.json # Currently active profile
└── default-profile.json # Default profile (0)
{
"id": "0",
"config": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-token-here",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5"
},
"createdAt": "2025-01-14T10:00:00.000Z",
"updatedAt": "2025-01-14T10:00:00.000Z"
}
When running glm-switch on [id], the tool injects config from the profile into ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-token-here",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5"
}
}
When running glm-switch start [id], the tool:
cwd~/.claude/settings.json# 1. Create profile 0
glm-switch init 0
# 2. Set your token
glm-switch set 0 token your_token_here
# 3. Apply
glm-switch on
# 4. Restart Claude Code
# 1. Create new profile
glm-switch init 1
# 2. Set token
glm-switch set 1 token another_token
# 3. Apply when needed
glm-switch on 1
# Start isolated GLM shell from current directory
glm-switch start 1
# Work with GLM in this shell only...
# Exit back to normal Claude environment
exit
glm-switch setall sonnet glm-5
glm-switch setall opus glm-5
glm-switch setall haiku glm-4.5-air
.backup file before modifyingstart mode does not change global settings# Close and reopen terminal
# Or check npm bin path
npm bin -g
# Ensure npm bin is in your PATH
# 1. Check status
glm-switch status
# 2. Restart Claude Code/VS Code COMPLETELY
# 3. Check status again
# List all profiles
glm-switch list
# Create profile if needed
glm-switch init 0
✗ Invalid config key: invalid_key
Valid keys: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL
Windows: Run terminal as Administrator
macOS:
# Check permissions
ls -la ~/.claude/
# Fix permissions
chmod 644 ~/.claude/settings.json
git clone https://github.com/supermeo-studio/glm-switch.git
cd glm-switch
npm run setup
npm run build
npm run dev
npm run clean
npm uninstall -g glm-switch
# Remove profiles directory
rm -rf ~/.claude/glm-switch
| Platform | Status | Settings Location |
|---|---|---|
| Windows 10/11 | ✅ Supported | C:\Users\{username}\.claude\settings.json |
| macOS | ✅ Supported | ~/.claude/settings.json |
| Linux | ⚠️ Untested | ~/.claude/settings.json |
start [id] for session-local GLM shell (no global settings changes)env [id] --shell <shell> for shell export outputtoken, haiku, sonnet, opusinit, set, setall, list, delete~/.claude/glm-switch/MIT © Supermeo & Inwave DR Team
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
CLI utility to switch between Claude API and GLM 4.6 models in Claude Code
We found that glm-switch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.