#!/usr/bin/env zsh # Create a fake `security` executable # # This executable provides access to macOS Keychain for command-line # apps like claude. Denying access to it, will force claude to save # the credentials to config.json TEMP_DIR="${HOME}/$(uuidgen).tmp" mkdir -p "${TEMP_DIR}" cat << 'EOF' > "${TEMP_DIR}/security" #!/bin/sh echo "Keychain access denied" >&2 exit 1 EOF chmod +x "${TEMP_DIR}/security" # Add the temporary directory to the top of PATH for this process export PATH="${TEMP_DIR}":$PATH # Setup the custom environment variables export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic export ANTHROPIC_AUTH_TOKEN=------Your GLM API Key goes here!------ export ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-4.5-air export ANTHROPIC_DEFAULT_SONNET_MODEL=glm-4.6 export ANTHROPIC_DEFAULT_OPUS_MODEL=glm-4.6 # Setup the custom config dir, creating it if it doesn't exists export CLAUDE_CONFIG_DIR="${HOME}/.glm" mkdir -p "${CLAUDE_CONFIG_DIR}" # Run claude claude "$@" # Clean up the temporary files created rm -rf "${TEMP_DIR}"