Skip to content

aberoham/claude-code-gcp-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code on GCP Vertex AI Setup

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.

What it does

  1. Creates an isolated gcloud configuration (claude-code) so it doesn't interfere with your default profile
  2. Helps you select a GCP project (prioritizes projects with "vertexai" in the name)
  3. Checks if Vertex AI API is enabled
  4. Configures application-default credentials
  5. Adds required environment variables to ~/.zshrc

Prerequisites

  • macOS with Python 3 (system default)
  • Google Cloud SDK (gcloud CLI)
  • A GCP project with Vertex AI API enabled and Claude model access

Usage

curl -O https://raw.githubusercontent.com/aberoham/claude-code-gcp-setup/main/setup-claude-vertex.py
python3 setup-claude-vertex.py

Or clone and run:

git clone https://github.com/aberoham/claude-code-gcp-setup.git
cd claude-code-gcp-setup
python3 setup-claude-vertex.py

Environment variables configured

CLAUDE_CODE_USE_VERTEX=1
CLOUDSDK_ACTIVE_CONFIG_NAME=claude-code
CLOUD_ML_REGION=global
ANTHROPIC_VERTEX_PROJECT_ID=<your-project>

Undo

To disable Vertex AI mode and revert to standard Claude Code:

python3 setup-claude-vertex.py --undo

This comments out the environment variables in your ~/.zshrc.

About

Setup script for Claude Code with GCP Vertex AI on macOS

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages