mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[GH-ISSUE #321] [Enhancement]: Native Google Vertex AI provider (service-account auth) #104
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mrigankad on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/vxcontrol/pentagi/issues/321
Summary
Add a native Google Vertex AI provider (
vertex) so users can authenticate with GCP project credentials instead of an API key. Today the only Google option,gemini(GEMINI_SERVER_URL=https://generativelanguage.googleapis.com), targets AI Studio and does not accept Vertex project/service-account credentials. Anthropic Claude-on-Vertex is likewise unsupported.Motivated by #310, where a user could not configure Vertex AI keys. The current workaround is to front Vertex with a LiteLLM proxy and use the
customprovider — functional but requires running extra infrastructure.Goals
Non-goals
geminiprovider (kept as-is).Proposed implementation
Follows the repo's documented "Adding a New LLM Provider" checklist (CLAUDE.md). Concrete touch points verified against
main:backend/pkg/providers/vertex/vertex.goimplementingprovider.Provider. The officialgenai/Vertex Go SDK exposes Gemini-on-Vertex; the existingbackend/pkg/providers/gemini/gemini.gois the closest reference and the request-shaping logic may be largely reusable behind a Vertex transport/auth layer.ProviderVertex ProviderType = "vertex"andDefaultProviderNameVertexinbackend/pkg/providers/provider/provider.go.DefaultProviderConfig,NewProvider,buildProviderFromConfig,GetProviderinbackend/pkg/providers/providers.go.vertexto theValid()whitelist inbackend/pkg/server/models/providers.go(without this the REST API returns 422).backend/pkg/config/config.go, e.g.:VERTEX_PROJECT_IDVERTEX_LOCATION(e.g.us-central1)VERTEX_CREDENTIALS_FILE(path to service-account JSON; fall back to ADC /GOOGLE_APPLICATION_CREDENTIALSwhen empty)VERTEX_SERVER_URLfor regional/private endpointsbackend/migrations/sql/adding'vertex'to thePROVIDER_TYPEenum, following the enum-swap pattern in20260227_120000_add_cn_providers.sql(Up: recreate enum incl.vertex; Down: deletevertexrows then recreate without it).frontend/src/components/icons/vertex.tsxregistered inprovider-icon.tsx, plus settings-page wiring..env.example— document the new keys.Open questions for maintainers
geminiadapter to support a Vertex transport+auth mode, or a fully separatevertexpackage? (Affects code reuse vs. clean separation.)anthropicadapter with a Vertex auth/endpoint mode instead.I'm happy to implement this once direction on Q1–Q2 is confirmed. Note the DB migration + GCP auth flow are areas that will need maintainer review and GCP credentials to test end-to-end.
References