Google Vertex AI in Practice

Migrating from anthropic.Anthropic to AnthropicVertex in Python

Moving an existing Claude integration from the first-party API to Google Vertex AI is mostly a constructor swap. Here is exactly what changes, and what doesn't.

Claude 3P 101 · Updated July 2026 · Unofficial guide

Anthropic ships Vertex AI support inside the same anthropic Python package you already use. That is the good news for any team asked to move a working Claude integration onto Google Cloud: you are not rewriting an application, you are changing how the client is constructed and authenticated. The request and response shapes — messages.create, streaming, tool use — carry over unchanged.

The lines that change

Four things differ between the first-party client and the Vertex client.

1. The install. Vertex support lives behind an extra: pip install -U google-cloud-aiplatform "anthropic[vertex]".

2. The client class and constructor. Anthropic() becomes AnthropicVertex(project_id="...", region="..."). There is no API key parameter at all. The region argument accepts "global" (the global endpoint, Google's dynamically routed option), "us" or "eu" (multi-region), or a specific region such as "us-east1" or "europe-west1".

3. Authentication. Instead of an ANTHROPIC_API_KEY, the client uses Google Cloud Application Default Credentials (ADC) — locally that means running gcloud auth application-default login once; in production it means the identity attached to your workload. The calling identity needs the aiplatform.endpoints.predict permission, which is included in the Vertex AI User role (roles/aiplatform.user).

4. Model IDs, sometimes. Current-generation models keep their bare first-party IDs on Vertex: claude-opus-4-8, claude-sonnet-5, claude-fable-5. Only some older models pick up an @date suffix — Haiku 4.5, for example, is claude-haiku-4-5@20251001. There is no anthropic. prefix here; that convention is Bedrock-only.

# Before — first-party Claude API
from anthropic import Anthropic
client = Anthropic()  # reads ANTHROPIC_API_KEY

# After — Google Vertex AI
from anthropic import AnthropicVertex
client = AnthropicVertex(project_id="my-project", region="global")

# Identical on both platforms
message = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(message.content[0].text)

The lines that stay identical

The Vertex API is nearly identical to the Anthropic Messages API. The SDK hides the two wire-level differences from you: on Vertex the model name travels in the endpoint URL rather than the request body, and an anthropic_version field (fixed at "vertex-2023-10-16") goes in the body instead of a header. If you use the SDK, you never touch either. Your message lists, system prompts, tool definitions, streaming handlers (client.messages.stream(...)), and response parsing all work as before. One cosmetic difference you may notice in logs: response message IDs from Vertex carry a msg_vrtx_ prefix.

Rule of thumb: if a line of your code mentions Anthropic(, an API key, or a model ID, review it. Everything else in the request path can usually ship untouched.

Prerequisites that aren't code

Before the new client returns anything but errors, someone with the right roles must enable each Claude model in the project: a Google Cloud project with billing, the Vertex AI API (aiplatform.googleapis.com) enabled, then a click of Enable on each model's Model Garden card and acceptance of the terms. Enabling models requires the Consumer Procurement Entitlement Manager role (roles/consumerprocurement.entitlementManager); day-to-day callers only need roles/aiplatform.user. See the Model Garden setup guide for the walkthrough.

Feature gaps to audit before you cut over

Not everything on the first-party API exists on Vertex. Before migrating, grep your codebase for: the Anthropic Message Batches API, the Files API, code execution, web fetch, the MCP connector, Agent Skills, programmatic tool calling, and the Models and Admin API endpoints — none are supported on Vertex. Google offers its own Vertex batch prediction mechanism (BigQuery or Cloud Storage input, 50% batch pricing) as a different route to bulk workloads. Web search exists but only in its basic variant. Also note that the server-side fallbacks parameter is unsupported — implement fallback on the client side. The feature gaps overview and batch workaround article cover the alternatives.

Where to go next

If you are starting from zero rather than migrating, begin with your first Claude call on Vertex AI. For the authentication story in depth, read the local development workflow and the ADC explainer.

Sources