Skip to content

Instantly share code, notes, and snippets.

@jbaznik
Forked from RuiNelson/README.md
Created October 12, 2025 05:59
Show Gist options
  • Save jbaznik/2643b4e9acd26445df68950caa2439ce to your computer and use it in GitHub Desktop.
Save jbaznik/2643b4e9acd26445df68950caa2439ce to your computer and use it in GitHub Desktop.
How to Use GLM Coding Plan and Claude Pro/Max Simultaneously with Claude Code on macOS
#!/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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment