feat: add Vertex AI provider support#88
Open
ngattusohw wants to merge 2 commits intosteipete:mainfrom
Open
Conversation
added 2 commits
February 15, 2026 13:38
Add support for Google Cloud Vertex AI as a new provider, enabling authentication via service account credentials and Application Default Credentials (ADC) instead of API keys. New provider prefix: vertex/... (e.g. vertex/gemini-2.5-flash-preview) Environment variables: - GOOGLE_CLOUD_PROJECT / VERTEX_AI_PROJECT_ID - GCP project ID - GOOGLE_CLOUD_LOCATION / VERTEX_AI_LOCATION - GCP region - VERTEX_AI_SERVICE_ACCOUNT_KEY - inline service account JSON - GOOGLE_APPLICATION_CREDENTIALS - path to SA JSON file - Also supports GCE metadata server for auth when on GCP Changes: - New vertex provider (src/llm/providers/vertex.ts) with JWT-based service account auth and token caching - Leverages pi-ai's existing google-vertex API for streaming - Added 'vertex' to LlmProvider type union - Updated model-id, model-spec, model-auto for vertex provider - Threaded vertexConfig through generate-text, summary-engine, summary-llm, runner, and daemon flow-context - Updated CLI help text to document vertex env vars and model prefix - All existing tests pass (56/56 in relevant test files)
Fix build errors by adding 'vertex' to provider type unions in: - costs.ts, attachments.ts, streaming.ts, types.ts - flows/url/markdown.ts, flows/asset/preprocess.ts - summary-engine.ts (envHasKeyFor + error message)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Google Cloud Vertex AI as a new LLM provider, enabling authentication via service account credentials and Application Default Credentials (ADC) instead of requiring a
GEMINI_API_KEY.This is useful for teams and production environments that use GCP service accounts, or for anyone running on GCP infrastructure where ADC is automatically available.
New Provider
Prefix:
vertex/...(e.g.summarize --model vertex/gemini-2.5-flash-preview https://example.com)Environment Variables
GOOGLE_CLOUD_PROJECTVERTEX_AI_PROJECT_ID)GOOGLE_CLOUD_LOCATIONus-central1(alias:VERTEX_AI_LOCATION)VERTEX_AI_SERVICE_ACCOUNT_KEYGOOGLE_APPLICATION_CREDENTIALSAlso supports GCE metadata server for auth when running on GCP.
Architecture
src/llm/providers/vertex.tswith JWT-based service account auth and token cachingpi-ai's existinggoogle-vertexAPI provider for streaming (which uses@google/genaiwithvertexai: true)Auth Priority
VERTEX_AI_SERVICE_ACCOUNT_KEY/GOOGLE_SERVICE_ACCOUNT_KEY(inline JSON)GOOGLE_APPLICATION_CREDENTIALS(file path to SA JSON)gcloud auth print-access-token(local dev fallback)Changes
vertextoLlmProvidertype unionmodel-id.ts,model-spec.ts,model-auto.tsfor vertex provider routingvertexConfigthroughgenerate-text.ts,summary-engine.ts,summary-llm.ts,runner.ts, and daemonflow-context.tsFiles Changed (12)
src/llm/providers/vertex.ts— new Vertex AI providersrc/llm/providers/models.ts— addedresolveVertexModel()src/llm/model-id.ts— addedvertexprovidersrc/llm/generate-text.ts— vertex dispatch for complete + streamsrc/model-spec.ts— vertex model spec parsingsrc/model-auto.ts— vertex env key detection for auto modesrc/run/run-env.ts—vertexConfig+vertexConfiguredin env statesrc/run/summary-engine.ts— threadedvertexConfigsrc/run/summary-llm.ts— threadedvertexConfigsrc/run/runner.ts— destructure + passvertexConfigsrc/run/help.ts— CLI help textsrc/daemon/flow-context.ts— daemon integration