[GH-ISSUE #4852] [FEAT]: Google Cloud Authentication Support for Generic OpenAI Provider #3057

Closed
opened 2026-02-22 18:32:26 -05:00 by yindo · 1 comment
Owner

Originally created by @juwy on GitHub (Jan 10, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4852

What would you like to see?

Feature Request: Google Cloud Authentication Support for Generic OpenAI Provider

Is your feature request related to a problem? Please describe.

Currently, the Generic OpenAI provider only supports static API keys for authentication. This makes it impractical to use with Google Cloud Vertex AI, which requires OAuth2 access tokens that expire after ~1 hour.

Users who want to connect AnythingLLM to Vertex AI (e.g. for compliance reasons) must either:

  • Manually refresh tokens every hour (not feasible for production)
  • Use third-party proxies like LiteLLM (adds complexity and latency)
  • Wait for native Vertex AI support (Issue #771, open since Feb 2024)

Describe the solution you'd like

Add Google Cloud Authentication support to the existing Generic OpenAI provider by:

  1. Optional Google Auth mode - Toggle between API Key and Google Cloud Auth
  2. Service Account support - Upload Service Account JSON file
  3. Automatic token refresh - Handle token expiration transparently using google-auth-library
  4. Minimal code changes - Extend Generic OpenAI provider rather than creating a new one

Implementation approach:

// Pseudo-code
if (useGoogleAuth) {
  const token = await googleAuthHelper.getAccessToken(); // Auto-refresh
  headers.Authorization = `Bearer ${token}`;
} else {
  headers.Authorization = `Bearer ${apiKey}`; // Existing behavior
}
Originally created by @juwy on GitHub (Jan 10, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4852 ### What would you like to see? ### Feature Request: Google Cloud Authentication Support for Generic OpenAI Provider **Is your feature request related to a problem? Please describe.** Currently, the Generic OpenAI provider only supports static API keys for authentication. This makes it impractical to use with Google Cloud Vertex AI, which requires OAuth2 access tokens that expire after ~1 hour. Users who want to connect AnythingLLM to Vertex AI (e.g. for compliance reasons) must either: - Manually refresh tokens every hour (not feasible for production) - Use third-party proxies like LiteLLM (adds complexity and latency) - Wait for native Vertex AI support (Issue #771, open since Feb 2024) **Describe the solution you'd like** Add Google Cloud Authentication support to the existing Generic OpenAI provider by: 1. **Optional Google Auth mode** - Toggle between API Key and Google Cloud Auth 2. **Service Account support** - Upload Service Account JSON file 3. **Automatic token refresh** - Handle token expiration transparently using `google-auth-library` 4. **Minimal code changes** - Extend Generic OpenAI provider rather than creating a new one **Implementation approach:** ```javascript // Pseudo-code if (useGoogleAuth) { const token = await googleAuthHelper.getAccessToken(); // Auto-refresh headers.Authorization = `Bearer ${token}`; } else { headers.Authorization = `Bearer ${apiKey}`; // Existing behavior }
yindo added the enhancementfeature request labels 2026-02-22 18:32:26 -05:00
yindo closed this issue 2026-02-22 18:32:27 -05:00
Author
Owner

@timothycarambat commented on GitHub (Jan 13, 2026):

It would indeed be better to support a full solution rather than a monkey-patch to work around the auth issue. This auth issue is the main blocker since it is quite involved. However are API keys short lived? The cloud API key page should allow you to associate a service account with an API key that does not rotate and can be used for vertex authenticated requests?

@timothycarambat commented on GitHub (Jan 13, 2026): It would indeed be better to support a full solution rather than a monkey-patch to work around the auth issue. This auth issue is the main blocker since it is quite involved. However are API keys short lived? The cloud API key page should allow you to associate a service account with an API key that does not rotate and can be used for vertex authenticated requests?
yindo changed title from [FEAT]: Google Cloud Authentication Support for Generic OpenAI Provider to [GH-ISSUE #4852] [FEAT]: Google Cloud Authentication Support for Generic OpenAI Provider 2026-06-05 14:50:04 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3057