A command-line interface for launching Claude Code with GLM (ChatGLM) settings via BigModel API, using temporary session-based configuration.
- 🚀 Session-Based Launch: Launch Claude with GLM settings temporarily (no persistent config changes)
- 🎯 Model Selection: Choose different GLM models at launch time (glm-4.6, glm-4.5, glm-4.5-air, etc.)
- 📦 Auto-Install: Install Claude Code with built-in npm dependency checking
- 🔄 Auto-Update: Check for and install updates with interactive update command
- ⚙️ Token Management: Securely manage your authentication token
Automatic Installer:
curl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh | bashAlternative - Manual Quick Install:
# Create user bin directory and download GLM CLI
mkdir -p ~/.local/bin
curl -L -o ~/.local/bin/glm "https://github.com/xqsit94/glm/releases/download/v1.1.0/glm-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/')"
chmod +x ~/.local/bin/glm
# Add to PATH (one-time setup)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcBoth methods will:
- Detect your operating system and architecture
- Download the latest binary release
- Install to your user directory
- Set up PATH for easy access
- Go to the releases page
- Download the binary for your platform:
- macOS Intel:
glm-darwin-amd64 - macOS Apple Silicon:
glm-darwin-arm64 - Linux x64:
glm-linux-amd64 - Linux ARM64:
glm-linux-arm64
- macOS Intel:
- Make it executable and move to PATH:
chmod +x glm-* sudo mv glm-* /usr/local/bin/glm
Prerequisites:
- Go 1.24 or later
- Your GLM API token
git clone https://github.com/xqsit94/glm.git
cd glm
go mod tidy
go build -o glm
sudo mv glm /usr/local/bin/The GLM CLI supports multiple ways to provide your Anthropic API token:
On first run, the CLI will automatically prompt you to set up your token:
glm # Will prompt for token if not foundglm token set # Enter your token securelyexport ANTHROPIC_AUTH_TOKEN="your_token_here"
glmToken Priority Order:
- Environment variable
ANTHROPIC_AUTH_TOKEN - Config file
~/.glm/config.json - Interactive prompt
Launch Claude with the default model (glm-4.6):
glmLaunch Claude with a specific model:
glm --model glm-4.5-air
glm -m glm-4.5-airHow it works:
- Sets temporary environment variables for the Claude session
- No persistent changes to Claude's configuration files
- Settings only apply to the launched Claude session
- To use Claude without GLM, just run
claudedirectly
Install Claude Code via npm (with automatic Node.js detection):
glm install claudeSet your API token:
glm token setView current token (masked):
glm token showClear stored token:
glm token clearCheck for updates:
glm update --checkUpdate to latest version:
glm updateUpdate without confirmation:
glm update --forceGet help for any command:
glm --help
glm install --help
glm token --help
glm update --help| Command | Description | Example |
|---|---|---|
glm |
Launch Claude with GLM (temporary config) | glm --model glm-4.6 |
glm install claude |
Install Claude Code | glm install claude |
glm token set |
Set authentication token | glm token set |
glm token show |
Show current token (masked) | glm token show |
glm token clear |
Clear stored token | glm token clear |
glm update |
Update GLM to latest version | glm update |
glm update --check |
Check for updates only | glm update --check |
These commands still work but are deprecated. Use glm with --model flag instead:
| Command | Status | Replacement |
|---|---|---|
glm enable |
Use glm instead |
|
glm disable |
Run claude directly |
|
glm set |
❌ Removed | Use glm --model X |
glm-4.6(default)glm-4.5glm-4.5-air- Any other GLM model supported by BigModel API
The CLI manages the following files:
~/.glm/config.json- Your authentication token and preferences
Note: GLM no longer modifies ~/.claude/settings.json. All configuration is passed via temporary environment variables.
-
Launch (
glm): Launches Claude Code with temporary environment variables:ANTHROPIC_BASE_URL=https://open.bigmodel.cn/api/anthropicANTHROPIC_AUTH_TOKEN=<your_token>ANTHROPIC_MODEL=<selected_model>
-
Session-Based: Settings only exist for the launched Claude session. No persistent file modifications.
-
Token Storage: Your authentication token is securely stored in
~/.glm/config.jsonfor convenience. -
Install: Checks for npm and installs Claude Code globally.
-
Update: Downloads and replaces the GLM binary with the latest version from GitHub.
# Install GLM CLI
curl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh | bash
# First time setup
glm install claude # Install Claude Code
glm token set # Enter your token securely
# Launch Claude with GLM (default model: glm-4.6)
glm
# Launch with specific model
glm --model glm-4.5-air
# Use Claude without GLM
claude
# Check for updates
glm update --check
# Update to latest version
glm updateIf you get a "curl not found" error:
- macOS: Install Xcode Command Line Tools:
xcode-select --install - Linux: Install curl:
sudo apt install curl(Ubuntu/Debian) orsudo yum install curl(CentOS/RHEL)
If the installer fails with permission errors:
# Download and run manually with explicit sudo
curl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh -o install.sh
chmod +x install.sh
sudo ./install.shIf no binary is available for your platform:
- Check the releases page for available binaries
- Build from source using the manual installation instructions
If you get an npm error when running glm install claude:
- Install Node.js from https://nodejs.org/
- Restart your terminal
- Run
glm install claudeagain
Set up your token using any of these methods:
glm token set(recommended)- Set environment variable:
export ANTHROPIC_AUTH_TOKEN="your_token"
The session-based configuration means:
- Settings only apply to Claude sessions launched via
glm - If you run
claudedirectly, it uses default settings - This is intentional - use
glmto launch with GLM settings
If glm command is not found after installation:
- Check if
/usr/local/binor~/.local/binis in your PATH:echo $PATH - Add to PATH if missing (add to
.bashrc,.zshrc, etc.):export PATH="$HOME/.local/bin:$PATH"
- Restart your terminal or run:
source ~/.bashrc(or.zshrc)
If glm update fails with permission denied:
sudo glm updateIf you're upgrading from version 1.0.x:
You MUST remove the old persistent configuration file to avoid conflicts:
rm -f ~/.claude/settings.jsonWhy this is required:
- Version 1.0.x created a persistent
~/.claude/settings.jsonfile that made Claude always use GLM settings - This conflicts with v1.1.0's session-based approach
- Without removing this file: Running
claudedirectly will still use GLM settings (not the default) - After removing this file:
glm→ Uses GLM settings (temporary, session-based)claude→ Uses default Claude settings (no GLM)
- Deprecated commands:
glm enableandglm disablestill work but show deprecation warnings - Removed command:
glm sethas been removed - useglm --model Xinstead - New usage: Just run
glmto launch Claude with GLM, orglm --model Xto specify a model
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and feature requests, please create an issue in the repository.