From 3ec540288be42200ceabcdd06c21e1f935abc9cb Mon Sep 17 00:00:00 2001 From: uroma Date: Thu, 15 Jan 2026 14:52:07 +0000 Subject: [PATCH] Integrate official Z.AI GLM configuration into automation scripts - Add GLM model mappings (glm-4.5-air, glm-4.7) to settings.json - Update both new and existing file creation paths - Add version verification guidance (2.0.14+ recommended) - Reference official Z.AI documentation (https://docs.z.ai/devpack/tool/claude) - Add troubleshooting steps from official docs - Add /status command verification instructions - Display GLM configuration summary after setup - Update API help text to include official docs link --- interactive-install-claude.sh | 100 +++++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 20 deletions(-) diff --git a/interactive-install-claude.sh b/interactive-install-claude.sh index 410178a..c8a5ee7 100755 --- a/interactive-install-claude.sh +++ b/interactive-install-claude.sh @@ -640,7 +640,7 @@ install_settings() { if [ "$USE_ZAI_MODELS" = true ]; then API_BASE="https://api.z.ai/api/anthropic" API_NAME="Z.AI / GLM Coding Plan" - API_HELP="Get your API key from: https://open.bigmodel.cn/usercenter/apikeys" + API_HELP="Get your API key from: https://z.ai/ (Official docs: https://docs.z.ai/devpack/tool/claude)" API_TOKEN_NAME="Z.AI API Key" else API_BASE="https://api.anthropic.com" @@ -672,6 +672,59 @@ install_settings() { done # Update existing file + if [ "$USE_ZAI_MODELS" = true ]; then + cat > "$settings_file" << EOF +{ + "env": { + "ANTHROPIC_AUTH_TOKEN": "$API_TOKEN", + "ANTHROPIC_BASE_URL": "$API_BASE", + "API_TIMEOUT_MS": "3000000", + "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7" + }, + "enabledPlugins": {} +} +EOF + else + cat > "$settings_file" << EOF +{ + "env": { + "ANTHROPIC_AUTH_TOKEN": "$API_TOKEN", + "ANTHROPIC_BASE_URL": "$API_BASE", + "API_TIMEOUT_MS": "3000000", + "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" + }, + "enabledPlugins": {} +} +EOF + fi + log_success "API token updated" + fi + else + read -p "Enter your $API_TOKEN_NAME: " API_TOKEN + while [ -z "$API_TOKEN" ]; do + echo -e "${RED}API token cannot be empty${NC}" + read -p "Enter your $API_TOKEN_NAME: " API_TOKEN + done + + if [ "$USE_ZAI_MODELS" = true ]; then + cat > "$settings_file" << EOF +{ + "env": { + "ANTHROPIC_AUTH_TOKEN": "$API_TOKEN", + "ANTHROPIC_BASE_URL": "$API_BASE", + "API_TIMEOUT_MS": "3000000", + "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7" + }, + "enabledPlugins": {} +} +EOF + else cat > "$settings_file" << EOF { "env": { @@ -683,26 +736,7 @@ install_settings() { "enabledPlugins": {} } EOF - log_success "API token updated" fi - else - read -p "Enter your $API_TOKEN_NAME: " API_TOKEN - while [ -z "$API_TOKEN" ]; do - echo -e "${RED}API token cannot be empty${NC}" - read -p "Enter your $API_TOKEN_NAME: " API_TOKEN - done - - cat > "$settings_file" << EOF -{ - "env": { - "ANTHROPIC_AUTH_TOKEN": "$API_TOKEN", - "ANTHROPIC_BASE_URL": "$API_BASE", - "API_TIMEOUT_MS": "3000000", - "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" - }, - "enabledPlugins": {} -} -EOF log_success "API token configured" fi @@ -722,6 +756,32 @@ EOF fi log_success "Settings configured for $API_NAME" + + # Version verification and Z.AI documentation reference + if [ "$USE_ZAI_MODELS" = true ]; then + echo "" + echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}" + echo -e "${BOLD}Z.AI GLM Configuration${NC}" + echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}" + echo "" + echo -e "${GREEN}✓ GLM Models Configured:${NC}" + echo " • glm-4.5-air (Haiku equivalent - fast, efficient)" + echo " • glm-4.7 (Sonnet/Opus equivalent - high quality)" + echo "" + echo -e "${YELLOW}📖 Official Documentation:${NC}" + echo " https://docs.z.ai/devpack/tool/claude" + echo "" + echo -e "${YELLOW}🔍 Verify Installation:${NC}" + echo " 1. Check version: ${CYAN}claude --version${NC} (recommended: 2.0.14+)" + echo " 2. Start Claude: ${CYAN}claude${NC}" + echo " 3. Check status: ${CYAN}/status${NC} (when prompted)" + echo "" + echo -e "${YELLOW}🔧 Troubleshooting:${NC}" + echo " • Close all Claude Code windows and reopen" + echo " • Or delete ~/.claude/settings.json and reconfigure" + echo " • Verify JSON format is correct (no missing/extra commas)" + echo "" + fi } install_local_settings() {