{"id":31446634,"url":"https://github.com/xqsit94/glm","last_synced_at":"2026-01-25T14:08:39.612Z","repository":{"id":314799187,"uuid":"1056787496","full_name":"xqsit94/glm","owner":"xqsit94","description":"CLI tool for GLM-4.5/4.6 and Claude Code integration. Switch between GLM \u0026 Claude easily, manage API tokens, and setup AI-powered development environment with a single command.","archived":false,"fork":false,"pushed_at":"2025-12-26T06:25:15.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-27T18:04:41.059Z","etag":null,"topics":["anthropic","bigmodel","chatglm","claude-code","glm","glm-4","golang","zhipuai"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xqsit94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-14T19:56:18.000Z","updated_at":"2025-12-26T06:23:31.000Z","dependencies_parsed_at":"2025-09-14T22:08:34.591Z","dependency_job_id":"3cb3fa4e-9dbb-402b-8ce4-ac9071fa33f6","html_url":"https://github.com/xqsit94/glm","commit_stats":null,"previous_names":["xqsit94/glm"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xqsit94/glm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xqsit94%2Fglm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xqsit94%2Fglm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xqsit94%2Fglm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xqsit94%2Fglm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xqsit94","download_url":"https://codeload.github.com/xqsit94/glm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xqsit94%2Fglm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","bigmodel","chatglm","claude-code","glm","glm-4","golang","zhipuai"],"created_at":"2025-10-01T00:07:49.331Z","updated_at":"2026-01-25T14:08:39.597Z","avatar_url":"https://github.com/xqsit94.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GLM CLI\n\nA command-line interface for launching Claude Code with GLM (ChatGLM) settings via BigModel API, using temporary session-based configuration.\n\n## Features\n\n- 🚀 **Session-Based Launch**: Launch Claude with GLM settings temporarily (no persistent config changes)\n- 🎯 **Model Selection**: Choose different GLM models at launch time (glm-4.7, glm-4.6, glm-4.5, glm-4.5-air, etc.)\n- 🔀 **Flag Passthrough**: Pass any claude CLI flags directly through glm (e.g., `--allowedTools`, `--verbose`)\n- ⚡ **YOLO Mode**: Skip permission prompts with `--yolo` flag for faster workflows\n- 📦 **Auto-Install**: Install Claude Code with built-in npm dependency checking\n- 🔄 **Auto-Update**: Check for and install updates with interactive update command\n- ⚙️ **Token Management**: Securely manage your authentication token\n\n## Installation\n\n### Quick Install (Recommended)\n\n**Automatic Installer:**\n```bash\ncurl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh | bash\n```\n\n**Alternative - Manual Quick Install:**\n```bash\n# Create user bin directory and download GLM CLI\nmkdir -p ~/.local/bin\ncurl -L -o ~/.local/bin/glm \"https://github.com/xqsit94/glm/releases/download/v1.2.0/glm-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/amd64/')\"\nchmod +x ~/.local/bin/glm\n\n# Add to PATH (one-time setup)\necho 'export PATH=\"$HOME/.local/bin:$PATH\"' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\nBoth methods will:\n- Detect your operating system and architecture\n- Download the latest binary release\n- Install to your user directory\n- Set up PATH for easy access\n\n### Manual Installation\n\n#### Option 1: Download Pre-built Binary\n\n1. Go to the [releases page](https://github.com/xqsit94/glm/releases)\n2. Download the binary for your platform:\n   - macOS Intel: `glm-darwin-amd64`\n   - macOS Apple Silicon: `glm-darwin-arm64`\n   - Linux x64: `glm-linux-amd64`\n   - Linux ARM64: `glm-linux-arm64`\n3. Make it executable and move to PATH:\n   ```bash\n   chmod +x glm-*\n   sudo mv glm-* /usr/local/bin/glm\n   ```\n\n#### Option 2: Build from Source\n\n**Prerequisites:**\n- Go 1.24 or later\n- Your GLM API token\n\n```bash\ngit clone https://github.com/xqsit94/glm.git\ncd glm\ngo mod tidy\ngo build -o glm\nsudo mv glm /usr/local/bin/\n```\n\n## Authentication Setup\n\nThe GLM CLI supports multiple ways to provide your Anthropic API token:\n\n### Option 1: Interactive Setup (Recommended)\nOn first run, the CLI will automatically prompt you to set up your token:\n```bash\nglm  # Will prompt for token if not found\n```\n\n### Option 2: Manual Token Setup\n```bash\nglm token set  # Enter your token securely\n```\n\n### Option 3: Environment Variable\n```bash\nexport ANTHROPIC_AUTH_TOKEN=\"your_token_here\"\nglm\n```\n\n**Token Priority Order:**\n1. Environment variable `ANTHROPIC_AUTH_TOKEN`\n2. Config file `~/.glm/config.json`\n3. Interactive prompt\n\n## Usage\n\n### Launch Claude with GLM (Primary Usage)\n\nLaunch Claude with the default model (glm-4.7):\n```bash\nglm\n```\n\nLaunch Claude with a specific model:\n```bash\nglm --model glm-4.5-air\nglm -m glm-4.5-air\n```\n\nLaunch Claude in YOLO mode (skip permission prompts):\n```bash\nglm --yolo\nglm --yolo --model glm-4.5-air\n```\n\nPass additional flags directly to claude:\n```bash\nglm --allowedTools \"Bash,Read,Write\"\nglm --verbose\nglm --yolo --allowedTools \"Bash,Read\"\n```\n\n**How it works:**\n- Sets temporary environment variables for the Claude session\n- No persistent changes to Claude's configuration files\n- Settings only apply to the launched Claude session\n- To use Claude without GLM, just run `claude` directly\n\n### Install Claude Code\n\nInstall Claude Code via npm (with automatic Node.js detection):\n```bash\nglm install claude\n```\n\n### Manage Authentication Token\n\nSet your API token:\n```bash\nglm token set\n```\n\nView current token (masked):\n```bash\nglm token show\n```\n\nClear stored token:\n```bash\nglm token clear\n```\n\n### Update GLM\n\nCheck for updates:\n```bash\nglm update --check\n```\n\nUpdate to latest version:\n```bash\nglm update\n```\n\nUpdate without confirmation:\n```bash\nglm update --force\n```\n\n### Help\n\nGet help for any command:\n```bash\nglm --help\nglm install --help\nglm token --help\nglm update --help\n```\n\n## Commands Reference\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `glm` | Launch Claude with GLM (temporary config) | `glm --model glm-4.7` |\n| `glm --yolo` | Launch with permission prompts skipped | `glm --yolo` |\n| `glm --\u003cflag\u003e` | Pass any flag through to claude | `glm --allowedTools \"Bash\"` |\n| `glm install claude` | Install Claude Code | `glm install claude` |\n| `glm token set` | Set authentication token | `glm token set` |\n| `glm token show` | Show current token (masked) | `glm token show` |\n| `glm token clear` | Clear stored token | `glm token clear` |\n| `glm update` | Update GLM to latest version | `glm update` |\n| `glm update --check` | Check for updates only | `glm update --check` |\n\n### Deprecated Commands\n\nThese commands still work but are deprecated. Use `glm` with `--model` flag instead:\n\n| Command | Status | Replacement |\n|---------|--------|-------------|\n| `glm enable` | ⚠️ Deprecated | Use `glm` instead |\n| `glm disable` | ⚠️ Deprecated | Run `claude` directly |\n| `glm set` | ❌ Removed | Use `glm --model X` |\n\n## Available Models\n\n- `glm-4.7` (default)\n- `glm-4.6`\n- `glm-4.5`\n- `glm-4.5-air`\n- Any other GLM model supported by BigModel API\n\n## Configuration Files\n\nThe CLI manages the following files:\n- `~/.glm/config.json` - Your authentication token and preferences\n\n**Note:** GLM no longer modifies `~/.claude/settings.json`. All configuration is passed via temporary environment variables.\n\n## How It Works\n\n1. **Launch (`glm`)**: Launches Claude Code with temporary environment variables:\n   - `ANTHROPIC_BASE_URL=https://open.bigmodel.cn/api/anthropic`\n   - `ANTHROPIC_AUTH_TOKEN=\u003cyour_token\u003e`\n   - `ANTHROPIC_MODEL=\u003cselected_model\u003e`\n\n2. **Session-Based**: Settings only exist for the launched Claude session. No persistent file modifications.\n\n3. **Token Storage**: Your authentication token is securely stored in `~/.glm/config.json` for convenience.\n\n4. **Install**: Checks for npm and installs Claude Code globally.\n\n5. **Update**: Downloads and replaces the GLM binary with the latest version from GitHub.\n\n## Example Workflow\n\n```bash\n# Install GLM CLI\ncurl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh | bash\n\n# First time setup\nglm install claude        # Install Claude Code\nglm token set            # Enter your token securely\n\n# Launch Claude with GLM (default model: glm-4.7)\nglm\n\n# Launch with specific model\nglm --model glm-4.5-air\n\n# Launch in YOLO mode (skip permission prompts)\nglm --yolo\n\n# Pass additional flags to claude\nglm --allowedTools \"Bash,Read,Write\"\n\n# Use Claude without GLM\nclaude\n\n# Check for updates\nglm update --check\n\n# Update to latest version\nglm update\n```\n\n## Troubleshooting\n\n### Installation Issues\n\n#### curl not found\nIf you get a \"curl not found\" error:\n- **macOS**: Install Xcode Command Line Tools: `xcode-select --install`\n- **Linux**: Install curl: `sudo apt install curl` (Ubuntu/Debian) or `sudo yum install curl` (CentOS/RHEL)\n\n#### Permission denied during installation\nIf the installer fails with permission errors:\n```bash\n# Download and run manually with explicit sudo\ncurl -fsSL https://raw.githubusercontent.com/xqsit94/glm/main/install.sh -o install.sh\nchmod +x install.sh\nsudo ./install.sh\n```\n\n#### Binary not found for your platform\nIf no binary is available for your platform:\n1. Check the [releases page](https://github.com/xqsit94/glm/releases) for available binaries\n2. Build from source using the manual installation instructions\n\n### Runtime Issues\n\n#### npm not found\nIf you get an npm error when running `glm install claude`:\n1. Install Node.js from https://nodejs.org/\n2. Restart your terminal\n3. Run `glm install claude` again\n\n#### Authentication token not found\nSet up your token using any of these methods:\n- `glm token set` (recommended)\n- Set environment variable: `export ANTHROPIC_AUTH_TOKEN=\"your_token\"`\n\n#### Claude still using default settings\nThe session-based configuration means:\n- Settings only apply to Claude sessions launched via `glm`\n- If you run `claude` directly, it uses default settings\n- This is intentional - use `glm` to launch with GLM settings\n\n#### Command not found after installation\nIf `glm` command is not found after installation:\n1. Check if `/usr/local/bin` or `~/.local/bin` is in your PATH: `echo $PATH`\n2. Add to PATH if missing (add to `.bashrc`, `.zshrc`, etc.):\n   ```bash\n   export PATH=\"$HOME/.local/bin:$PATH\"\n   ```\n3. Restart your terminal or run: `source ~/.bashrc` (or `.zshrc`)\n\n#### Update fails with permission error\nIf `glm update` fails with permission denied:\n```bash\nsudo glm update\n```\n\n## Migration from Previous Versions\n\nIf you're upgrading from version 1.0.x:\n\n### ⚠️ IMPORTANT: Remove Old Configuration File\n\n**You MUST remove the old persistent configuration file to avoid conflicts:**\n\n```bash\nrm -f ~/.claude/settings.json\n```\n\n**Why this is required:**\n- Version 1.0.x created a persistent `~/.claude/settings.json` file that made Claude always use GLM settings\n- This conflicts with v1.1.0's session-based approach\n- **Without removing this file:** Running `claude` directly will still use GLM settings (not the default)\n- **After removing this file:**\n  - `glm` → Uses GLM settings (temporary, session-based)\n  - `claude` → Uses default Claude settings (no GLM)\n\n### Other Changes:\n\n1. **Deprecated commands**: `glm enable` and `glm disable` still work but show deprecation warnings\n2. **Removed command**: `glm set` has been removed - use `glm --model X` instead\n3. **New usage**: Just run `glm` to launch Claude with GLM, or `glm --model X` to specify a model\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## Support\n\nFor issues and feature requests, please create an issue in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxqsit94%2Fglm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxqsit94%2Fglm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxqsit94%2Fglm/lists"}