@ssweens/pi-vertex
v1.4.0
Published
Google Vertex AI provider for Pi coding agent - supports Gemini, Claude, and all MaaS models
Maintainers
Readme
pi-vertex

pi install @ssweens/pi-vertex
export GOOGLE_CLOUD_PROJECT=your-project-id
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.jsonSet your GCP project and credentials. Vertex AI models (Gemini, Claude, OpenAI GPT, Grok, Meta Muse and Llama, DeepSeek, Mistral, and others) appear in pi's model selector, billed through your GCP project.
Features
58 models across 4 categories:
- Gemini (15): 4 Neon, 4 Hydrogen, 4 Carbon, 4 Argon, 3.8 Flash, 3.7 Flash, 3.6 Flash, 3.5 Flash, 3.5 Flash-Lite, 3.1 Pro, 3.1 Flash-Lite, 3 Flash, 2.5 Pro, 2.5 Flash, 2.5 Flash-Lite
- Claude (18): Fable 5.2, Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1, Opus 5, Sonnet 5, Fable 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 4.6, Opus/Sonnet/Haiku 4.5, Opus 4.1, Opus 4, Sonnet 4
- Meta (5): Muse Wonder 1.0, Muse Spark 1.3, Muse Ember 1.0, Llama 4 Maverick, Llama 4 Scout
- Other MaaS (20): OpenAI GPT-6 (6), Grok (5, including 4.20 Non-Reasoning), DeepSeek V4.1 Flash and Flash 1017, Mistral (4), OpenAI GPT-OSS 120B, Gemma 4, GLM 5.2
Unified streaming: Single provider, multiple model families
Full tool calling support: All models with multi-turn tool use and proper tool result handling
Thinking/reasoning: Gemini 3/4 thinking levels (including XHIGH on Gemini 4 Neon and Hydrogen), Gemini 2.5 thinking budgets, per-model reasoning effort for Claude, OpenAI GPT, Muse, and DeepSeek, thought signature preservation
Automatic auth: Uses Google Application Default Credentials
Region awareness: Global endpoints where supported, regional where required
Pricing tracking: Token cost tracking includes thinking tokens and supported regional premiums. GPT-6 rates are public-API estimates, not Vertex private-offer prices.
Installation
# Via pi (recommended)
pi install @ssweens/pi-vertex
# Or via npm
npm install @ssweens/pi-vertexSetup
1. Authenticate with Google Cloud
# Option A: User credentials (development)
gcloud auth application-default login
# Option B: Service account (production)
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json2. Set environment variables
# Required: Your GCP project ID
export GOOGLE_CLOUD_PROJECT=your-project-id
# Optional: Override default region
export GOOGLE_CLOUD_LOCATION=us-central13. Configuration file (optional)
For persistent settings, create ~/.pi/agent/settings/pi-vertex.json:
{
"googleCloudProject": "my-gcp-project",
"googleCloudLocation": "us-central1",
"googleApplicationCredentials": "/path/to/service-account.json"
}Config file values take priority over environment variables.
4. Verify setup
pi --provider vertex --model gemini-2.5-pro --versionUsage
Command line
# Use any supported model
pi --provider vertex --model claude-opus-5-5
pi --provider vertex --model claude-sonnet-5-5
pi --provider vertex --model claude-fable-5-2
pi --provider vertex --model claude-haiku-5-5
pi --provider vertex --model grok-4.7
pi --provider vertex --model glm-5.2
pi --provider vertex --model gemini-4-neon
pi --provider vertex --model gemini-4-hydrogen
pi --provider vertex --model gemini-4-argon
pi --provider vertex --model gemini-3.8-flash
pi --provider vertex --model muse-wonder-1.0
pi --provider vertex --model llama-4-maverick
pi --provider vertex --model deepseek-v4.1-flash-1017
pi --provider vertex --model gpt-6.2-sol
# With options
pi --provider vertex --model gemini-4-neon --thinking xhighShell alias (recommended)
Add to ~/.bashrc or ~/.zshrc:
# Claude 4.8 Opus
alias pic="GOOGLE_CLOUD_PROJECT=your-project pi --provider vertex --model claude-opus-4-8"
# Grok 4.3
alias pig4="GOOGLE_CLOUD_PROJECT=your-project pi --provider vertex --model grok-4.3"
# Gemini 2.5 Pro
alias pig="GOOGLE_CLOUD_PROJECT=your-project pi --provider vertex --model gemini-2.5-pro"
# Llama 4 Maverick
alias pil="GOOGLE_CLOUD_PROJECT=your-project pi --provider vertex --model llama-4-maverick"Model Reference
Gemini Models
| Model | Context | Max Tokens | Input | Reasoning | Price (in/out) | |-------|---------|------------|-------|-----------|----------------| | gemini-4-neon | 1M | 65,536 | text, image | ✅ | $3.00/$15.00 | | gemini-4-hydrogen | 1M | 65,536 | text, image | ✅ | $1.50/$7.50 | | gemini-4-carbon | 1M | 65,536 | text, image | ✅ | $2.00/$10.00 | | gemini-4-argon | 1M | 65,536 | text, image | ✅ | $2.00/$10.00 | | gemini-3.8-flash | 1M | 65,536 | text, image | ✅ | $0.75/$3.75 | | gemini-3.7-flash | 1M | 65,536 | text, image | ✅ | $0.75/$3.75 | | gemini-3.6-flash | 1M | 65,536 | text, image | ✅ | $1.50/$7.50 | | gemini-3.5-flash | 1M | 65,536 | text, image | ✅ | $1.50/$9.00 | | gemini-3.5-flash-lite | 1M | 65,536 | text, image | ✅ | $0.30/$2.50 | | gemini-3.1-pro | 1M | 65,536 | text, image | ✅ | $2.00/$12.00 | | gemini-3.1-flash-lite | 1M | 65,536 | text, image | ✅ | $0.25/$1.50 | | gemini-3-flash | 1M | 65,536 | text, image | ✅ | $0.50/$3.00 | | gemini-2.5-pro | 1M | 65,536 | text, image | ✅ | $1.25/$10.00 | | gemini-2.5-flash | 1M | 65,536 | text, image | ✅ | $0.30/$2.50 | | gemini-2.5-flash-lite | 1M | 65,536 | text, image | ✅ | $0.10/$0.40 |
gemini-4-argon and gemini-4-carbon use introductory pricing of $2.00/$10.00 per 1M tokens (cached input $0.10) through 2026-11-30, rising to $4.00/$20.00 after. Argon supports "long decode" up to 1M output tokens; this extension uses the default 65,536 synchronous limit. gemini-4-carbon is a Frontier Model available only to verified enterprise customers.
gemini-4-neon is a Frontier Model with a unified 1M input/output limit. This extension uses the 65,536-token foreground segment limit, not long decode. Global input/output prices are $3.00/$15.00 per 1M tokens, with $0.15 cached input; non-global prices are $3.30/$16.50, with $0.165 cached input. Cost tracking uses the endpoint's rates.
gemini-4-hydrogen is a short-term release: Google retires it with 45 days' notice. Its 1M token limit covers input and output together. Neon and Hydrogen accept the xhigh thinking level.
Gemini 4 models reject the MINIMAL thinking level, so pi does not offer minimal for them.
gemini-3.1-pro is still a Preview offering on Vertex (API id gemini-3.1-pro-preview); everything else in this table is GA.
Retired: gemini-2.0-flash and gemini-2.0-flash-lite were shut down on Vertex on 2026-06-01 and have been removed. gemini-2.5-* retires on 2026-10-16 — migrate to a 3.x Flash model before then.
Claude Models
Prices shown are for the global endpoint. Non-global regions (us-east5, europe-west1, asia-southeast1, us/eu multi-region) carry a 10% premium — cost tracking adjusts automatically based on your configured GOOGLE_CLOUD_LOCATION.
| Model | Context | Max Tokens | Input | Reasoning | Price global (in/out) | Price regional (in/out) | |-------|---------|------------|-------|-----------|----------------------|------------------------| | claude-fable-5-2 | 1M | 128,000 | text, image | ✅ | $8.00/$40.00 | $8.80/$44.00 | | claude-opus-5-5 | 1M | 128,000 | text, image | ✅ | $4.00/$20.00 | $4.40/$22.00 | | claude-sonnet-5-5 | 1M | 128,000 | text, image | ✅ | $2.00/$10.00 | $2.20/$11.00 | | claude-haiku-5-5 | 1M | 128,000 | text, image | ✅ | $0.10/$0.50 | $0.11/$0.55 | | claude-fable-5-1 | 1M | 128,000 | text, image | ✅ | $10.00/$50.00 | $11.00/$55.00 | | claude-opus-5 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 | | claude-sonnet-5 | 1M | 128,000 | text, image | ✅ | $2.00/$10.00 | $2.20/$11.00 | | claude-fable-5 | 1M | 128,000 | text, image | ✅ | $10.00/$50.00 | $11.00/$55.00 | | claude-opus-4-8 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 | | claude-opus-4-7 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 | | claude-opus-4-6 | 1M | 128,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 | | claude-sonnet-4-6 | 1M | 128,000 | text, image | ✅ | $3.00/$15.00 | $3.30/$16.50 | | claude-opus-4-5 | 200K | 32,000 | text, image | ✅ | $5.00/$25.00 | $5.50/$27.50 | | claude-sonnet-4-5 | 200K | 64,000 | text, image | ✅ | $3.00/$15.00 | $3.30/$16.50 | | claude-haiku-4-5 | 200K | 64,000 | text, image | ✅ | $1.00/$5.00 | $1.10/$5.50 | | claude-opus-4-1 | 200K | 32,000 | text, image | ✅ | $15.00/$75.00 | (uniform) | | claude-opus-4 | 200K | 32,000 | text, image | ✅ | $15.00/$75.00 | (uniform) | | claude-sonnet-4 | 200K | 64,000 | text, image | ✅ | $3.00/$15.00 | (uniform) |
Claude 5, 5.5, and Fable models require provider data sharing on your project's publisher model config. Without it Vertex returns HTTP 403 asking you to set PublisherModelConfig.data_sharing_enabled_provider. Fable 5.1 and 5.2 also require the Advanced AI Safety Addendum in Model Garden. Every Claude model must be enabled on its Model Garden card first; until then Vertex returns HTTP 404.
claude-haiku-5-5 prices apply below 100K input tokens. At 100K input tokens or more, every token in the request bills at 5x. Claude 3.5 Sonnet v2 was shut down on Vertex on 2026-02-19 and has been removed.
Meta Models
| Model | Context | Max Tokens | Input | Reasoning | Price (in/out) | Region | |-------|---------|------------|-------|-----------|----------------|--------| | muse-wonder-1.0 | 1M | 128,000 | text, image | ✅ | $4.00/$20.00 | global | | muse-spark-1.3 | 1M | 128,000 | text, image | ✅ | $1.25/$4.25 | global | | muse-ember-1.0 | 1M | 128,000 | text, image | ✅ | $0.10/$0.50 | global | | llama-4-maverick | 524K | 32,000 | text | ✅ | $0.35/$1.15 | global | | llama-4-scout | 1,310K | 32,000 | text | ✅ | $0.25/$0.70 | global |
The Muse models are in Preview. They run only on the global endpoint and only through Meta's stateless Responses API (publishers/meta/v1/responses), which pi-vertex calls for them automatically. Their 1,048,576-token context covers input and output together; 128,000 is the default output cap. Reasoning effort is minimal to xhigh; muse-ember-1.0 also accepts max. At thinking level off, pi-vertex sends no effort and the model uses its default. Above 200K input tokens, muse-ember-1.0 bills every token at 3x.
Other MaaS Models
| Model | Context | Publisher | Price (in/out) | Region | |-------|---------|-----------|----------------|--------| | mistral-medium-3 | 128K | mistralai | $0.40/$2.00 | global | | mistral-small-3.1 | 128K | mistralai | $0.10/$0.30 | global | | mistral-ocr | 30 pages | mistralai | $0.0005/page | global | | codestral-2 | 128K | mistralai | $0.30/$0.90 | global | | deepseek-v4.1-flash | 1M | deepseek-ai | $0.30/$1.20 | global | | deepseek-v4.1-flash-1017 | 1M | deepseek-ai | $0.30/$1.20 | global | | gpt-6.2-astra | 1,050K | openai | $8.00/$40.00 (estimate) | global | | gpt-6.2-sol | 1,050K | openai | $2.00/$10.00 (estimate) | global | | gpt-6-astra | 1,050K | openai | $10.00/$50.00 (estimate) | global | | gpt-6.1-sol | 1,050K | openai | $2.00/$10.00 (estimate) | global | | gpt-6.1-terra | 1,050K | openai | $1.00/$5.00 (estimate) | global | | gpt-6-luna | 1,050K | openai | $0.10/$0.50 (estimate) | global | | gpt-oss-120b | 131K | openai | $0.09/$0.36 | global | | glm-5.2 | 1M | zai-org | $1.40/$4.40 | global | | grok-4.7 | 524K | xai | $2.00/$6.00 | global | | grok-4.6 | 524K | xai | $2.00/$6.00 | global | | grok-4.3 | 1M | xai | $1.25/$2.50 | global | | grok-4.20-reasoning | 1M | xai | $1.25/$2.50 | global | | grok-4.20-non-reasoning | 1M | xai | $1.25/$2.50 | global | | gemma-4-26b-a4b-it | 262K | google | $0.15/$0.60 | global |
deepseek-v4.1-flash and deepseek-v4.1-flash-1017 accept text and image input. They think only when a reasoning effort is set (minimal to high, or max); at thinking level off they answer without thinking. Flash 1017 cached input costs $0.006 per 1M tokens, compared with $0.03 for the original Flash.
OpenAI GPT-6 models require Private Preview access, a Marketplace private offer, and Model Garden enablement with the Advanced AI Safety Addendum. They use the publisher Responses API, not Chat Completions. They accept text and images, support tools, and have a 1,050,000-token combined context (922,000 max input, 128,000 max output). Use GOOGLE_CLOUD_LOCATION=global.
GPT-6 reasoning levels are low, medium, high, xhigh, and max. At off, Astra and Sol use the model default; Terra and Luna send none to disable reasoning. Requests omit reasoning summaries and preserve encrypted reasoning for tool replay. store: false makes requests stateless; it does not enable Zero Data Retention, which requires separate project approval.
GPT-6 cost estimates: Google does not list these models on its public partner-pricing page. Displayed costs use OpenAI's public Standard API model rates, at up to 272K input tokens. Your Vertex private-offer prices can differ. Long-context surcharges and explicit cache-write charges are not tracked.
Retired: Google shut down these open model endpoints on 2026-10-21, and they have been removed: deepseek-v3.2, deepseek-v3.1, deepseek-r1, deepseek-ocr, qwen3-235b, qwen3-next-instruct, qwen3-next-thinking, qwen3-coder, gpt-oss-20b, kimi-k2-thinking, minimax-m2, glm-5, glm-4.7, and llama-3.3-70b. grok-4.1-fast-reasoning was shut down on 2026-08-20 and has also been removed.
Regional Endpoints
Models use different endpoints based on availability:
- Global (most models):
aiplatform.googleapis.com - Regional (older Claude models):
{region}-aiplatform.googleapis.com
Default regions by model:
- Gemini:
global - Claude (all):
global - MaaS:
global
Override with:
export GOOGLE_CLOUD_LOCATION=us-central1Architecture
┌─────────────┐
│ Pi │
└──────┬──────┘
│ registerProvider("vertex")
▼
┌─────────────┐
│ pi-vertex │
└──────┬──────┘
│ streamSimple(model, context, options)
▼
┌─────────────────────────────────────┐
│ Handler Dispatch │
├──────────────┬──────────────────────┤
│ Gemini │ MaaS │
│ (@google/ │ (OpenAI-compatible │
│ genai) │ endpoint) │
└──────────────┴──────────────────────┘Dependencies
@google/genai: Google GenAI SDK for Gemini models@anthropic-ai/vertex-sdk: Official Anthropic-on-Vertex SDK for Claude models (native streaming)google-auth-library: ADC authentication for all models@earendil-works/pi-ai: Peer dependency@earendil-works/pi-coding-agent: Peer dependency
Acknowledgments
lhl maintains lhl/pi-vertex, an independent fork that added comprehensive unit tests and CI, and identified several important bugs. Several fixes in v1.1.6 were co-discovered through review of that work, including the maxTokens/2 halving bug, Gemini cached-token double-counting, sanitizeText emoji corruption, missing tool result flushing, and image tool result forwarding. Kudos.
License
MIT
