April 13, 2026
Set up Claude Code with Vertex AI
As part of my job I work a lot with Google AI Development tools such as Gemini Code Assist, Gemini CLI and Antigravity, to help our…
Giovanni Galloro
5 min read
As part of my job I work a lot with Google AI Development tools such as Gemini Code Assist, Gemini CLI and Antigravity, to help our customers make the most of them. You can find examples of this work in my medium.com profile too.
One use case that is arising recently with some Google Cloud customers is using Claude Code with Vertex AI, some of the reasons to do that are:
- Use Claude models through Google Cloud's enterprise infrastructure
- Leverage existing Google Cloud credits and billing
- Benefit from Google Cloud's compliance and security features
- Keep everything within your organization's GCP environment
Anthropic models are available through Vertex AI Model Garden, the Google Cloud's catalog of foundation models from Google and third-party providers. Model Garden provides a single place to discover, test, and deploy models, including Anthropic's Claude family, directly within your GCP project. Models accessed through Model Garden are served on Google Cloud infrastructure and integrate with standard GCP services like IAM, billing, and Cloud Logging.
Since Anthropic recently also made available the /setup-vertex wizard in Claude Code, making this set up even simpler, I wanted to share a quick walkthrough on how to configure Claude Code to use Anthropic models from Vertex AI Model Garden.
Prerequisites
Before starting, ensure you have:
- A Google Cloud account with billing enabled
- Appropriate IAM permissions to create projects and enable APIs
- Claude Code installed on your machine (download from Anthropic)
- gcloud CLI installed and configured
Part 1: Google Cloud Setup
Step 1: Create or Select a Google Cloud Project
First, create a new project or select an existing one:
# Create a new project
gcloud projects create claude-code-project --name="Claude Code"
# Set it as your active project
gcloud config set project claude-code-project# Create a new project
gcloud projects create claude-code-project --name="Claude Code"
# Set it as your active project
gcloud config set project claude-code-projectStep 2: Enable Required APIs
Enable the Vertex AI API and related services:
# Enable Vertex AI API
gcloud services enable aiplatform.googleapis.com
# Enable additional required APIs
gcloud services enable cloudresourcemanager.googleapis.com
gcloud services enable serviceusage.googleapis.com# Enable Vertex AI API
gcloud services enable aiplatform.googleapis.com
# Enable additional required APIs
gcloud services enable cloudresourcemanager.googleapis.com
gcloud services enable serviceusage.googleapis.comStep 3: Request Access to Claude Models
- Navigate to the Vertex AI Model Garden in Google Cloud Console
- Search for "Claude" in the model catalog
- Select the Claude model you want to use (e.g., Claude Sonnet 4.5)
- Click "Enable" and fill the request form with your data
To give Claude Code maximum flexibility you may want to enable at least the default versions of Claude Sonnet (primary Claude Code model) and Claude Haiku used by Claude Code (4.5 at time of writing). Without Sonnet, Claude Code won't have a primary model and may not start at all. Some subagents use Haiku by default or you may want to use it for simpler task so it's better to have it enabled.
My suggestion is to enable Opus too so you have it available in case you need it for a more complex task.
Step 4: Enable Web Search (Optional)
Claude models on Vertex AI support web search, which allows Claude to augment its responses with real-time data from the web. This is particularly useful for tasks that require up-to-date information, such as looking up latest documentation, gathering market data, or researching current events.
Web search is controlled by the organization policy constraint constraints/vertexai.allowedPartnerModelFeatures and is disabled by default. If you want Claude Code to be able to search the web when needed, you need to update this policy for your project.
Note: For Claude Sonnet 4.0/4.5, Opus 4.0/4.1/4.5, and Haiku 4.5, the default denial enforcement is delayed until July 2026. Organizations should configure their policies by June 2026 to avoid disruption.
To enable web search, reset the organization policy constraint on your project (change your-google-cloud-projectto the project you're using) so that it inherits the parent's policy (or allows all features):
gcloud org-policies reset constraints/vertexai.allowedPartnerModelFeatures \
--project=your-google-cloud-projectgcloud org-policies reset constraints/vertexai.allowedPartnerModelFeatures \
--project=your-google-cloud-projectAlternatively, you can configure this through the Organization Policies page in the Google Cloud Console by finding the Vertex AI - Allowed Partner Model Features constraint and updating it to allow web search.
A few things to keep in mind:
- Web search queries are sent to a third-party search provider, so standard Google Cloud data residency and CMEK commitments do not apply to the search portion of the request. Check the documentation for details.
- If your project uses VPC Service Controls, web search requests will be blocked — you will need to adjust your perimeter configuration or use web search from a project outside the perimeter
- Web search incurs additional charges on top of standard model usage — check the Vertex AI pricing page for current rates
Step 5: Set Up Authentication
Google Cloud offers multiple authentication methods for accessing Vertex AI, the ones you can use with Claude Code running locally on a developer workstation are typically:
- Application Default Credentials (ADC)
- API Key (Service Account-Bound)
- Service Account Key File
In this example I will use ADC, because, in brief, it is the most secure and easier to implement due to not requiring a service account or API key:
# Authenticate with your Google Cloud account
gcloud auth application-default login
# Grant your user account the Vertex AI User role
gcloud projects add-iam-policy-binding claude-code-project \
--member="user:YOUR_EMAIL@example.com" \
--role="roles/aiplatform.user"# Authenticate with your Google Cloud account
gcloud auth application-default login
# Grant your user account the Vertex AI User role
gcloud projects add-iam-policy-binding claude-code-project \
--member="user:YOUR_EMAIL@example.com" \
--role="roles/aiplatform.user"Part 2: Claude Code Configuration
Step 6: Configure Claude Code with the /setup-vertex Wizard
Starting from Claude Code v2.1.98, Claude Code includes a built-in interactive setup wizard that automates the entire Vertex AI configuration. This is the recommended approach for most users.
- First-Time Setup: You need to set an environment variable to toggle the Vertex integration so that Claude Code doesn't try to authenticate directly with Anthropic, you can do this temporarily for one session:
export CLAUDE_CODE_USE_VERTEX=1export CLAUDE_CODE_USE_VERTEX=1- Start Claude Code:
claudeclaude- Once the chat starts, type:
/setup-vertex/setup-vertex- The wizard will ask you to choose an authentication method, select ADC:
- The wizard will ask you to pick a Google Cloud project, defaulting to the one in your gcloud configuration:
- Next, it will ask to pick a region:
- Then it will check that its default models are enabled, it will start with Haiku and then test Sonnet and Opus too (at least at time of writing).
- As said above, my suggestion is to enable all the 3 models in Vertex AI Model Garden so that Claude has the flexibility of using Haiku for simpler tasks and you can also manually leverage Opus if needed.
- Then you must choose if you want to pin the working models or use Claude Code default models. Use the former to avoid errors in case Claude Code wants to use a new model and it's not enabled in the Model Garden.
- Last step is a recap of your settings and a confirmation to save them:
After Claude Code restarts you will be able to use it leveraging Vertex AI.
By running Claude Code through Vertex AI, you can manage access with IAM, authenticate using your existing credentials, consolidate billing under your Google Cloud account, and apply the same compliance and audit controls you use for any other GCP service. This setup lets teams adopt Claude Code as a development tool without introducing separate credential systems or billing relationships. The configuration steps in this guide should have you up and running with a setup that fits naturally into a standard Google Cloud workflow.