A setup script for macOS users who want to use Claude Code via Google Cloud Vertex AI.
See the official Vertex AI documentation for full details.
- Creates an isolated gcloud configuration (
claude-code) so it doesn't interfere with your default profile - Helps you select a GCP project (prioritizes projects with "vertexai" in the name)
- Checks if Vertex AI API is enabled
- Configures application-default credentials
- Adds required environment variables to
~/.zshrc
- macOS with Python 3 (system default)
- Google Cloud SDK (
gcloudCLI) - A GCP project with Vertex AI API enabled and Claude model access
curl -O https://raw.githubusercontent.com/aberoham/claude-code-gcp-setup/main/setup-claude-vertex.py
python3 setup-claude-vertex.pyOr clone and run:
git clone https://github.com/aberoham/claude-code-gcp-setup.git
cd claude-code-gcp-setup
python3 setup-claude-vertex.pyCLAUDE_CODE_USE_VERTEX=1
CLOUDSDK_ACTIVE_CONFIG_NAME=claude-code
CLOUD_ML_REGION=global
ANTHROPIC_VERTEX_PROJECT_ID=<your-project>To disable Vertex AI mode and revert to standard Claude Code:
python3 setup-claude-vertex.py --undoThis comments out the environment variables in your ~/.zshrc.