Feature request: Add native Google Vertex AI provider for Claude models
Feature request: Add native Google Vertex AI provider for Claude models
Problem
Nanobot currently ships providers for Anthropic (direct), OpenAI, Azure OpenAI, AWS Bedrock, GitHub Copilot, xAI, and various OpenAI-compat gateways, but no first-class provider for Anthropic Claude models running on Google Vertex AI.
Enterprise/GCP-native users who consume Claude through Vertex (rather than the Anthropic API directly or AWS Bedrock) currently have no supported path in nanobot.
What's missing vs. what already exists
I looked through the repo and prior work before filing this:
nanobot/providers/hasanthropic_provider.pyandbedrock_provider.pybut novertex_ai_provider.py.- Existing open PRs #1943 and #2377 both add Vertex AI support for Gemini models (via LiteLLM /
google-cloud-aiplatform). Neither adds a path for Claude on Vertex. - Previous closed PRs (#111, #131, #1324) and closed issue #2082 also focused on Gemini or were closed as mistakes.
- So this is a distinct feature: Claude models on Vertex AI via Anthropic's own SDK, not Gemini via Google's SDK.
Proposed solution
Add a VertexAIProvider that subclasses AnthropicProvider and uses the official AsyncAnthropicVertex client from the anthropic Python package:
from anthropic import AsyncAnthropicVertex
client = AsyncAnthropicVertex(
project_id=project, # ANTHROPIC_VERTEX_PROJECT_ID or GOOGLE_CLOUD_PROJECT
region=region, # CLOUD_ML_REGION or GOOGLE_CLOUD_LOCATION, default us-central1
max_retries=0,
)
This is a very small change because:
- The
anthropicSDK already exposesAsyncAnthropicVertexwith the same interface asAsyncAnthropic, so almost all ofAnthropicProvider's logic (streaming, tool_use, prompt caching, etc.) is reusable via subclassing. - Authentication uses Google Application Default Credentials (ADC) — obtained via
gcloud auth application-default login— so no API key needs to be stored in config.
Sketch of the changes
nanobot/providers/vertex_ai_provider.py(new, ~120 lines)VertexAIProvider(AnthropicProvider)that instantiatesAsyncAnthropicVertexin__init__.- Strips provider prefixes like
google_vertex_ai/,vertex/,anthropic/from the model string. - Helpers:
get_adc_status(),login_vertex_ai()(runsgcloud auth application-default login),logout_vertex_ai()(runsgcloud auth application-default revoke).
nanobot/providers/factory.py— new branch:elif backend == "google_vertex_ai": from nanobot.providers.vertex_ai_provider import VertexAIProvider provider = VertexAIProvider( default_model=model, project=getattr(p, "project", None) if p else None, region=getattr(p, "region", None) if p else None, )nanobot/providers/registry.py— newProviderSpec:ProviderSpec( name="google_vertex_ai", keywords=("vertex", "vertex_ai", "google_vertex"), env_key="", display_name="Google Vertex AI", backend="google_vertex_ai", is_oauth=True, strip_model_prefix=True, ),config/schema.py— add optionalprojectandregionfields underproviders.googleVertexAi.Optional dependency:
pip install nanobot-ai[vertex]→ pulls ingoogle-auth(already a transitive dep of theanthropicSDK's Vertex extras).
Example config
providers:
googleVertexAi:
project: my-gcp-project
region: us-east5
model: google_vertex_ai/claude-sonnet-4-5@20250929
Why do this in addition to PRs #1943 and #2377
Those PRs address Gemini on Vertex. Claude on Vertex is a common enterprise pattern (Anthropic Claude models are GA on Vertex in us-central1, us-east5, europe-west1, etc.) and can't be served by the Gemini-focused providers because the on-the-wire API is Anthropic's, not Google's — hence needing AsyncAnthropicVertex.
Ideally the two efforts land as sibling providers under the same google_vertex_ai umbrella, with the model prefix (or an explicit provider setting) selecting the correct backend client. Happy to coordinate with the authors of #1943 / #2377.
Prior art / working implementation
I have this working locally in a downstream fork against main. Total change is ~200 lines across the four files listed above, with no changes required to the base AnthropicProvider. Happy to open a PR if there's interest — please let me know before I put in the effort so we don't add to the pile of stalled Vertex PRs.
Environment
- nanobot version: latest
main - Python: 3.11
anthropic>=0.39.0(any version exposingAsyncAnthropicVertex)- Auth: Google Application Default Credentials via
gcloud auth application-default login
Source: HKUDS/nanobot