Skip to main content

Using GCP Vertex AI With Roo Code

Roo Code supports accessing models through Google Cloud Platform's Vertex AI, a managed machine learning platform that provides access to various foundation models, including Anthropic's Claude family.

Website: https://cloud.google.com/vertex-ai


Prerequisites

  • Google Cloud Account: You need an active Google Cloud Platform (GCP) account.
  • Project: You need a GCP project with the Vertex AI API enabled.
  • Model Access: You must request and be granted access to the specific Claude models on Vertex AI you want to use. See the Google Cloud documentation for instructions.
  • Application Default Credentials (ADC): Roo Code uses Application Default Credentials to authenticate with Vertex AI. The easiest way to set this up is to:
    1. Install the Google Cloud CLI: https://cloud.google.com/sdk/docs/install
    2. Authenticate using: gcloud auth application-default login
  • Service Account Key (Alternative): Alternatively, you can authenticate using a Google Cloud Service Account key file. You'll need to generate this key in your GCP project. See the Google Cloud documentation on creating service account keys.

Supported Models

Roo Code supports the following models through Vertex AI:

Default Model

If no model is specified, Roo Code defaults to claude-sonnet-4@20250514.

Google Gemini Models

Vertex AI exposes multiple Gemini model families. Roo Code focuses on the main families and tracks Google's stable releases instead of requiring you to hard-code versioned model IDs.

  • Gemini 3 Pro Preview
    • Up to a 1M-token context window for very large workspaces and long-running conversations
    • Reasoning-capable behavior for complex coding and refactoring tasks
    • Roo Code's cost estimation supports tiered pricing (short vs long requests) to better match Vertex AI billing for this model
  • Gemini Pro family
    • Stable Pro models for complex reasoning and analysis
    • When you select a Gemini model without overriding it in a profile, Roo Code prefers a stable Pro variant by default where available
  • Gemini Flash family
    • Faster, lower-cost models ideal for quick iterations and non-critical tasks

Reasoning / thinking models

Some Gemini models provide dedicated reasoning or "thinking" tokens:

  • Roo Code treats these as reasoning models and uses them for deeper multi-step planning when enabled.
  • The reasoning budget must be enabled in Roo Code settings to take full advantage of these models.
  • When Vertex AI reports separate reasoning or "thought" tokens, Roo Code includes them in token usage and cost estimates. Compared to older versions, you may see slightly higher but more accurate token counts.

Refer to the Google Cloud Vertex AI models documentation for up-to-date Gemini model IDs and capabilities.

Anthropic Claude Models

  • claude-opus-4-1@20250805
  • claude-opus-4@20250514
  • claude-sonnet-4@20250514 (Default)
  • claude-3-7-sonnet@20250219
  • claude-3-7-sonnet@20250219:thinking - With reasoning support
  • claude-3-5-sonnet-v2@20241022
  • claude-3-5-sonnet@20240620
  • claude-3-5-haiku@20241022
  • claude-3-opus@20240229
  • claude-3-haiku@20240307

Other Models

  • llama-4-maverick-17b-128e-instruct-maas - Meta Llama 4 model with 128K context window

Refer to the Google Cloud documentation on Vertex AI Models for the most up-to-date list of available models and their IDs.


Configuration in Roo Code

  1. Open Roo Code Settings: Click the gear icon () in the Roo Code panel.

  2. Select Provider: Choose "GCP Vertex AI" from the "API Provider" dropdown.

  3. Configure Authentication:

    Roo Code uses the following authentication priority:

    1. Google Cloud Credentials (JSON): If provided, this takes precedence
    2. Google Cloud Key File Path: If provided and no JSON credentials, this is used
    3. Application Default Credentials (ADC): Used as fallback when neither above is provided

    Option 1 - Using ADC (Simplest):

    • Install the Google Cloud CLI and run gcloud auth application-default login
    • No further configuration needed in Roo Code

    Option 2 - Using Service Account Key:

    • Either paste the JSON content directly into Google Cloud Credentials field
    • Or provide the file path in Google Cloud Key File Path field
  4. Enter Project ID: Enter your Google Cloud Project ID.

  5. Select Region: Choose the region where your Vertex AI resources are located (e.g., us-east5).

  6. Select Model: Choose your desired model from the "Model" dropdown.


Advanced Features

Gemini-Specific Features

When using Gemini models through Vertex AI, additional grounding features become available:

URL Context

Enable URL context to allow Gemini models to access and analyze web content directly. This feature allows Roo to:

  • Read and understand web pages in real-time
  • Analyze documentation from URLs
  • Review online code repositories
  • Access current information from websites

Enabling URL Context:

  1. Select a Gemini model in your Vertex AI configuration
  2. Enable the "URL Context" option that appears
  3. Save your settings

Google Search Grounding

Enable Google Search grounding to enhance Gemini's responses with real-time search results. This provides:

  • Up-to-date information from web searches
  • Fact-checking capabilities
  • Current event awareness
  • Enhanced accuracy for technical queries

Enabling Search Grounding:

  1. Select a Gemini model in your Vertex AI configuration
  2. Enable the "Google Search Grounding" option that appears
  3. Save your settings
note

URL Context and Google Search Grounding options only appear when a Gemini model is selected. These features may incur additional costs.


Tips and Notes

  • Permissions: Ensure your Google Cloud account has the necessary permissions to access Vertex AI and the specific models you want to use.
  • Pricing: Refer to the Vertex AI pricing page for details.