Vertex AI Claude
Use Claude models through Vertex AI with Agno agents.
Use Claude models through Vertex AI. Agno sends synchronous and asynchronous requests with Anthropic's AnthropicVertex clients.
We recommend experimenting to find the best-suited model for your use case. Here are some general recommendations:
claude-sonnet-4-6is the newer Sonnet model (Claude Sonnet 4.6). Current-generation models use bare IDs on Vertex AI, with no@datesuffix.claude-sonnet-4@20250514is the Agno default. It is deprecated on Vertex AI; useclaude-sonnet-4-6for new work.
Installation
uv pip install -U 'anthropic[vertex]' agnoAuthentication
Before authenticating, follow Google's Claude setup: select a billing-enabled project, enable the Vertex AI API, enable Claude in Model Garden and accept its terms, and grant the caller the required prediction permissions. Install the Google Cloud CLI. Select a region that serves your model; us-east5 is an example for Sonnet 4.6.
Set GOOGLE_CLOUD_PROJECT and CLOUD_ML_REGION for that project and region. Application Default Credentials (ADC) supplies the project when project_id is not explicit. The Agno-specific override ANTHROPIC_VERTEX_PROJECT_ID is also supported.
export GOOGLE_CLOUD_PROJECT="your_value_here"
export CLOUD_ML_REGION="us-east5"And then authenticate your CLI session:
gcloud auth application-default loginExample
Use Claude with your Agent:
from agno.agent import Agent
from agno.models.vertexai.claude import Claude
agent = Agent(
model=Claude(id="claude-sonnet-4-6"),
)
# Print the response on the terminal
agent.print_response("Share a 2 sentence dramatic story.")Parameters
The table records the adapter default. Runnable examples explicitly use Sonnet 4.6; older cookbook examples may still show the deprecated Sonnet 4 route. Check Anthropic's Vertex model table for platform-specific availability.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | str | "claude-sonnet-4@20250514" | The specific Vertex AI Claude model ID to use |
name | str | "Claude" | The name identifier for the Vertex AI Claude model |
provider | str | "VertexAI" | The provider of the model |
region | Optional[str] | None | The region to use for the model (defaults to CLOUD_ML_REGION env var) |
project_id | Optional[str] | None | The project ID to use for the model (defaults to ANTHROPIC_VERTEX_PROJECT_ID env var) |
base_url | Optional[str] | None | The base URL to use for the model (defaults to ANTHROPIC_VERTEX_BASE_URL env var) |
Claude (Vertex AI) extends the Anthropic Claude model with Vertex AI integration and has access to most of the same parameters.