---
title: "GCP Vertex AI"
description: "Access Google's Gemini models and open-source models through Vertex AI. Enterprise-grade infrastructure with Google Cloud security and compliance."
seo:
  title: "GCP Vertex AI Integration"
  description: "Access Gemini and open-source models through Google Cloud Vertex AI. Enterprise-grade security with Google Cloud infrastructure."
---

## What is the Autohand GCP Vertex AI integration? [#quick-answer]

The Autohand GCP Vertex AI integration sends coding-agent requests through a Google Cloud project and region. It uses Google Cloud authentication and a Vertex AI model that is available to the configured project.

|  |  |
| --- | --- |
| Status | Available |
| Requires | A Google Cloud project with Vertex AI enabled, supported credentials, a region, and model access. |
| Configure with | Add a `vertexai` block to the Autohand config with `projectId`, `region` (default `global`), `authToken` and `model`, and set `provider` to `vertexai`. |
| Best for | Teams operating model access and identity through Google Cloud. |

:::warning
**Know before you start:** Model availability, quotas, endpoints, and data residency depend on the project and selected Google Cloud region.
:::

## Overview

Google Cloud Vertex AI provides enterprise access to AI models with Google Cloud infrastructure. When integrated with Autohand, you get:

- Access to Gemini models such as `google/gemini-3.1-pro` and `google/gemini-3.1-flash`
- Partner and open models from Model Garden, such as Claude and GLM
- Enterprise security with Google Cloud IAM
- Regional endpoints for data residency
- Integration with existing GCP infrastructure

## Setup

Get started with GCP Vertex AI.

### Prerequisites

- Google Cloud project with Vertex AI API enabled
- A user or service account with the Vertex AI User role
- gcloud CLI installed and signed in

### Enable Vertex AI

```bash
# Enable the Vertex AI API
gcloud services enable aiplatform.googleapis.com

# Set your project
gcloud config set project YOUR_PROJECT_ID
```

### Configure authentication

```bash
# Sign in as a user
gcloud auth login

# Or activate a service account
gcloud auth activate-service-account --key-file=/path/to/service-account.json

# Print an access token for the authToken setting
gcloud auth print-access-token
```

Autohand authenticates with the bearer token in `vertexai.authToken`. It does not read Application Default Credentials or `GOOGLE_APPLICATION_CREDENTIALS`. When the token is a gcloud token (it starts with `ya29.`), Autohand refreshes it by running `gcloud auth print-access-token`, caching the result for 25 minutes and retrying once after an authentication error, so keep gcloud on your `PATH`. Other tokens are used as written and stop working when they expire.

### Configure Autohand

```bash
# Guided setup: choose Vertex AI, then enter the token, project ID and region
autohand --setup
```

Or edit the config file directly (see [CLI configuration](#cli-configuration)). Autohand does not read `GOOGLE_CLOUD_PROJECT` or a region environment variable.

Verify your configuration:

```bash
autohand --prompt "Hello, which model are you?"
```

## CLI configuration [#cli-configuration]

Configure Vertex AI in your `~/.autohand/config.json`:

```json
{
  "provider": "vertexai",
  "vertexai": {
    "projectId": "your-project-id",
    "region": "global",
    "authToken": "ya29.your-gcloud-access-token",
    "model": "google/gemini-3.1-pro"
  }
}
```

Write values literally; Autohand does not expand `${VAR}` placeholders. `projectId`, `authToken` and `model` are required. Autohand calls the Vertex AI OpenAI-compatible endpoint at `https://{endpoint}/v1/projects/{projectId}/locations/{region}/endpoints/openapi`.

### Configuration options

| Option | Description | Default |
| --- | --- | --- |
| `projectId` | Google Cloud project ID | \- |
| `region` | Vertex AI location, such as `global` or `us-central1` | `global` |
| `authToken` | Google Cloud access token from `gcloud auth print-access-token` | \- |
| `model` | Model ID in publisher/model form | `anthropic/claude-opus-4-7` in the bundled catalog |
| `endpoint` | Vertex AI API host | `aiplatform.googleapis.com` |

## Available models [#models]

Vertex AI offers Google's Gemini models and open-source alternatives.

### Gemini models

| Model | Context | Best for |
| --- | --- | --- |
| `google/gemini-3.1-pro` | See Vertex AI | Long context, complex tasks |
| `google/gemini-3.1-flash` | See Vertex AI | Fast and cost-effective |

### Model Garden (partner and open models)

| Model | Context | Best for |
| --- | --- | --- |
| `anthropic/claude-opus-4-7` | See Vertex AI | Autohand's default Vertex AI model |
| `zai-org/glm-5-maas` | See Vertex AI | Open model served by Vertex AI |

### Switch models

```bash
# Set the default Vertex AI model
autohand config set vertexai.model "google/gemini-3.1-flash"

# During a session, open the model picker (it takes no arguments)
/model
```

## Best practices

- **Use gcloud tokens**: a `ya29.` token from `gcloud auth print-access-token` is refreshed automatically while gcloud is installed.
- **Use service accounts in production**: Create dedicated service accounts with minimal permissions and activate them in gcloud.
- **Choose the right region**: Deploy in regions close to your users for lower latency.
- **Monitor costs**: Use Google Cloud Billing to track AI spending.
- **Use a Gemini Pro model for large context**: Check the model's context window in Vertex AI before analyzing large codebases.

### Recommended configuration

```json
{
  "provider": "vertexai",
  "vertexai": {
    "projectId": "your-project-id",
    "region": "global",
    "authToken": "ya29.your-gcloud-access-token",
    "model": "google/gemini-3.1-pro"
  }
}
```

## Resources

- [Vertex AI Overview](https://cloud.google.com/vertex-ai)
- [Vertex AI Documentation](https://cloud.google.com/vertex-ai/docs)
- [Generative AI on Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview)
- [Vertex AI Console](https://console.cloud.google.com/vertex-ai)
- [Pricing](https://cloud.google.com/vertex-ai/pricing)
- [Google Cloud Status](https://status.cloud.google.com)

## Troubleshooting

### Common issues

| Issue | Solution |
| --- | --- |
| Permission denied | Grant Vertex AI User role to service account |
| API not enabled | Run `gcloud services enable aiplatform.googleapis.com` |
| Region not supported | Use `global` or a region where the model is available, such as `us-central1` |
| Authentication failed | Refresh `vertexai.authToken` with `gcloud auth print-access-token` |
| Quota exceeded | Request quota increase in [GCP Console](https://console.cloud.google.com/iam-admin/quotas) |

### Debug mode

```bash
# Enable verbose logging
AUTOHAND_DEBUG=true AUTOHAND_PROVIDER=vertexai autohand

# Test authentication
gcloud auth print-access-token
```

**How do I configure the Autohand GCP Vertex AI integration?**

Add a `vertexai` block to the Autohand config with `projectId`, `region` (default `global`), `authToken` and `model`, and set `provider` to `vertexai`.

**What does the Autohand GCP Vertex AI integration require?**

A Google Cloud project with Vertex AI enabled, supported credentials, a region, and model access.

**What limitations should I know about?**

Model availability, quotas, endpoints, and data residency depend on the project and selected Google Cloud region.
