@twogiants/pi-anthropic-vertex
v0.1.2
Published
Anthropic Claude models on Google Cloud Vertex AI for pi
Downloads
395
Maintainers
Readme
pi-anthropic-vertex
Anthropic Claude models on Google Cloud Vertex AI for pi.
Prerequisites
- Google Cloud project with Vertex AI API enabled
- Claude models enabled in Model Garden
gcloudCLI installed and authenticated
How it works
This extension injects an AnthropicVertex client into pi's built-in anthropic-messages streaming implementation. All message transformation, prompt caching, tool call normalization, thinking block replay, partial JSON streaming, and usage tracking are handled by pi's battle-tested internals, nothing is reimplemented.
Other Vertex AI extensions (pi-vertex-claude, pi-vertex, pi-anthropic-vertex) reimplement the Anthropic streaming protocol from scratch at 500–1500 lines, losing features like prompt caching, tool call adjacency enforcement, aborted message filtering, and partial JSON parsing. This extension delegates to pi's built-in at ~160 lines and inherits everything for free.
Model definitions are pulled at runtime from pi's built-in Anthropic provider via getModels("anthropic"), so new Claude models are picked up automatically when pi updates.
Install
pi install npm:@twogiants/pi-anthropic-vertexOr install from git:
pi install git:github.com/twoGiants/pi-anthropic-vertexSetup
Authenticate with Google Cloud:
gcloud auth application-default loginSet your project and region:
export GOOGLE_CLOUD_PROJECT=your-project-id
export GOOGLE_CLOUD_LOCATION=us-east5 # optional, defaults to us-east5Usage
pi --provider anthropic-vertex --model claude-opus-4-6
pi --provider anthropic-vertex --model claude-sonnet-4-6All Claude models available on Vertex AI are registered automatically.
License
MIT
