Feature Request
Please add service_account ADC support to the google-vertex provider, in addition to the existing authorized_user flow.
Problem Statement
The google-vertex provider's ADC layer silently rejects standard GCP service-account JSON key files. In dist/vertex-adc-CXnQBcxJ.js (source: extensions/google/vertex-adc.ts), the credential-reader bails out immediately if the credentials file is not authorized_user:
// extensions/google/vertex-adc.ts (line ~38 in dist)
if (record.type !== "authorized_user") return;
hasGoogleVertexAuthorizedUserAdcSync also hard-codes the same check:
parsed.type === "authorized_user"
So if GOOGLE_APPLICATION_CREDENTIALS (or ~/.config/gcloud/application_default_credentials.json) points to a service-account JSON key, OpenClaw silently falls through to "no credentials" and the request fails.
Why This Matters
Google's ADC documentation defines two standard credential types that ADC consumers are expected to handle:
| Type |
Source |
authorized_user |
gcloud auth application-default login |
service_account |
Downloaded SA JSON key, set via GOOGLE_APPLICATION_CREDENTIALS |
For headless/server-side deployments (VMs, containers, systemd services like OpenClaw), service-account JSON is the standard GCP practice. authorized_user requires an interactive browser flow and binds auth to a human's Google session — it's unsuitable for:
- Credential durability (user sessions expire)
- Service-account isolation (least-privilege per workload)
- CI/CD and server environments
Repro
- Create a GCP service account with
roles/aiplatform.user
- Download the SA JSON key and set
GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
- Configure OpenClaw with
google-vertex provider (ADC path)
- Attempt any
google-vertex model call
- Observed: Call fails — OpenClaw does not pick up SA credentials; falls through to "No API key found" or similar
- Verified independently: Direct curl with
gcloud auth application-default print-access-token (which does support SA JSON) returns valid responses against us-central1-aiplatform.googleapis.com Vertex endpoints for gemini-2.5-flash and gemini-2.5-pro
We provisioned vertex-ai-runtime@alberto-openclaw.iam.gserviceaccount.com with roles/aiplatform.user and confirmed SA key auth works end-to-end via curl — just can't plug it into OpenClaw.
Expected Behavior
The provider should accept both ADC credential types, mirroring standard Google ADC semantics:
type === "authorized_user" → existing refresh-token OAuth flow (unchanged)
type === "service_account" → use google-auth-library's GoogleAuth (or equivalent) with keyFile and scopes ["https://www.googleapis.com/auth/cloud-platform"] to mint an access token, then attach it as Authorization: Bearer <token>
Proposed Fix Sketch
In extensions/google/vertex-adc.ts, add a parallel service_account path:
// After reading the credentials file:
if (record.type === "service_account") {
// Use google-auth-library (already a transitive dep via @google/genai)
const { GoogleAuth } = await import("google-auth-library");
const auth = new GoogleAuth({
keyFile: credentialsPath,
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
});
const client = await auth.getClient();
const tokenResponse = await client.getAccessToken();
return { token: tokenResponse.token!, expiresAtMs: Date.now() + 3600_000 };
}
The rest of the Vertex transport request-signing logic (constructing the Vertex AI endpoint URL, attaching Authorization: Bearer) should not need to change — only the credential-resolution step.
Note: google-auth-library is already a transitive dependency of @google/genai so no new package dependency is needed.
Additional Notes
Environment
- OpenClaw version: 2026.5.x (installed via npm global, Linux x64)
- GCP project: server-side Linux deployment
- Auth target:
us-central1-aiplatform.googleapis.com
- Models tested:
gemini-2.5-flash, gemini-2.5-pro
Feature Request
Please add
service_accountADC support to thegoogle-vertexprovider, in addition to the existingauthorized_userflow.Problem Statement
The
google-vertexprovider's ADC layer silently rejects standard GCP service-account JSON key files. Indist/vertex-adc-CXnQBcxJ.js(source:extensions/google/vertex-adc.ts), the credential-reader bails out immediately if the credentials file is notauthorized_user:hasGoogleVertexAuthorizedUserAdcSyncalso hard-codes the same check:So if
GOOGLE_APPLICATION_CREDENTIALS(or~/.config/gcloud/application_default_credentials.json) points to a service-account JSON key, OpenClaw silently falls through to "no credentials" and the request fails.Why This Matters
Google's ADC documentation defines two standard credential types that ADC consumers are expected to handle:
authorized_usergcloud auth application-default loginservice_accountGOOGLE_APPLICATION_CREDENTIALSFor headless/server-side deployments (VMs, containers, systemd services like OpenClaw), service-account JSON is the standard GCP practice.
authorized_userrequires an interactive browser flow and binds auth to a human's Google session — it's unsuitable for:Repro
roles/aiplatform.userGOOGLE_APPLICATION_CREDENTIALS=/path/to/key.jsongoogle-vertexprovider (ADC path)google-vertexmodel callgcloud auth application-default print-access-token(which does support SA JSON) returns valid responses againstus-central1-aiplatform.googleapis.comVertex endpoints forgemini-2.5-flashandgemini-2.5-proWe provisioned
vertex-ai-runtime@alberto-openclaw.iam.gserviceaccount.comwithroles/aiplatform.userand confirmed SA key auth works end-to-end via curl — just can't plug it into OpenClaw.Expected Behavior
The provider should accept both ADC credential types, mirroring standard Google ADC semantics:
type === "authorized_user"→ existing refresh-token OAuth flow (unchanged)type === "service_account"→ usegoogle-auth-library'sGoogleAuth(or equivalent) withkeyFileand scopes["https://www.googleapis.com/auth/cloud-platform"]to mint an access token, then attach it asAuthorization: Bearer <token>Proposed Fix Sketch
In
extensions/google/vertex-adc.ts, add a parallelservice_accountpath:The rest of the Vertex transport request-signing logic (constructing the Vertex AI endpoint URL, attaching
Authorization: Bearer) should not need to change — only the credential-resolution step.Note:
google-auth-libraryis already a transitive dependency of@google/genaiso no new package dependency is needed.Additional Notes
gemini-3.1-pro-preview— this model is not in the Vertex catalog. This affects users on Vertex who want stable Gemini models;gemini-2.5-flashandgemini-2.5-prowork fine.Environment
us-central1-aiplatform.googleapis.comgemini-2.5-flash,gemini-2.5-pro