#how can i use vertex api 1100€.
1 messages · Page 1 of 1 (latest)
That error is the classic “I’m calling Vertex AI with an API key” failure.
Vertex AI (aiplatform.googleapis.com) does not accept API keys. It requires an OAuth2 access token (ADC / service account / workload identity), i.e. credentials that “assert a principal”.
If you’re doing this via OpenClaw
Use the google-vertex provider (Vertex) + gcloud ADC, not GEMINI_API_KEY.
- On the gateway host, authenticate ADC (pick one):
- User login (dev):
gcloud auth application-default login - Service account (server): set
GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
-
Make sure the GCP project is set / billed / Vertex API enabled (and your principal has Vertex permissions).
-
In OpenClaw, select a Vertex model like:
/model google-vertex/<something>(use/model listoropenclaw models listto see the exact IDs)
Docs (OpenClaw): https://docs.openclaw.ai/concepts/model-providers (see “Google Vertex…”)
If you’re calling the Vertex REST API directly
You need an auth header, e.g.:
Authorization: Bearer $(gcloud auth application-default print-access-token)
If you paste which model string you selected (e.g. google-vertex/... vs google/...) and where you configured the key, I can tell you exactly which side is mismatched.
i am, but its not getting it, looks like there is a key stuck somewhere i can use it on the linux terminal open claw runs on, but it doesnt work within claw,
if set it like this
{
meta: {
lastTouchedVersion: '2026.3.13',
lastTouchedAt: '2026-03-15T19:28:58.931Z',
},
env: {
GOOGLE_CLOUD_PROJECT: 'magnetic-planet-490215-t0',
GOOGLE_CLOUD_LOCATION: 'us-central1',
GOOGLE_APPLICATION_CREDENTIALS: '/home/flex/.openclaw/workspace/vertex-key.json',
},
auth: {
profiles: {
'google-vertex:default': {
provider: 'google-vertex',
mode: 'oauth',
},
},
},
agents: {
defaults: {
model: {
primary: 'google-vertex/gemini-2.5-flash',
},
models: {
'google-vertex/gemini-3.1-pro-preview': {
alias: 'gemini-3.1-pro-preview',
},
'google-vertex/gemini-2.5-flash': {},
},
},
list: [
{
id: 'main',
model: 'google-vertex/gemini-3.1-pro-preview',
},
],
},
commands: {
native: 'auto',
nativeSkills: 'auto',
restart: true,
ownerDisplay: 'raw',
},
channels: {
whatsapp: {
enabled: true,
dmPolicy: 'pairing',
groupPolicy: 'allowlist',
debounceMs: 0,
mediaMaxMb: 50,
},
},
gateway: {
port: 18777,
mode: 'local',
bind: 'loopback',
controlUi: {
allowedOrigins: [
'*',
'https://clawbook.tail12517f.ts.net',
],
},
auth: {
mode: 'token',
token: 'OPENCLAW_REDACTED',
},
tailscale: {
mode: 'serve',
resetOnExit: false,
},
},
plugins: {
entries: {
'google-gemini-cli-auth': {
enabled: true,
},
},
},
}
service account credentials in the vertex-key.json
i also tryed adc
@tardy pelican
That 401 is Vertex AI telling you “API key auth is not allowed here”.
To use your GCP / Vertex credits, you need the Vertex endpoint + OAuth2 credentials (ADC), not GEMINI_API_KEY.
In OpenClaw, the “works” path is:
- Pick Vertex provider models (not the API-key Gemini provider):
- use
/modeland select something starting withgoogle-vertex/... - or
openclaw models listto see exact IDs
- Authenticate Vertex via ADC on the gateway host:
- Dev machine:
gcloud auth application-default login - Server: set
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
- Restart gateway, then verify:
openclaw models status(should showgoogle-vertexas authenticated via gcloud adc)
Docs: https://docs.openclaw.ai/concepts/model-providers (section “Google Vertex…”)
Quick question so I can pinpoint what’s wrong in your setup
Did you:
- select a model like
google-vertex/...OR - configure a custom provider/baseUrl pointing at
aiplatform.googleapis.comwhile still using an API key?
If you paste your model string + the relevant models.providers... snippet (redact secrets), I’ll tell you exactly what to change.