Connect Google Vertex AI
Connect Google Vertex AI — easy-to-understand guide based on official docs
Think of Google Vertex AI as the “business-class lounge” for Google’s Gemini AI models—same great models, but with enterprise perks like stable rates, billing through your Google Cloud account, and no random rate-limit surprises.
Why Not Just Use a Regular API Key?
If you’ve used other AI providers, you’re used to copying a static API key into a config file. Vertex doesn’t work that way. Instead of a key that never changes, Vertex uses short-lived OAuth2 tokens—like a boarding pass that expires after about an hour.
The good news? Hermes Agent handles all the minting and refreshing automatically. You never touch a token. This is also why you can’t just paste a temporary token into a custom provider’s api_key field—it would expire mid-conversation and break your session.
What You’ll Need (Prerequisites)
- A Google Cloud project with Vertex AI API enabled and billing active
- One of these credential types:
- A service account JSON key file (recommended for servers)
- Application Default Credentials (ADC) via
gcloud auth application-default login(great for local development)
That’s it. Hermes will auto-install google-auth the first time you select Vertex.
Quick Start: Two Options
Option A — Service Account JSON (for servers/gateways)
Just add one line to your ~/.hermes/.env file:
echo "VERTEX_CREDENTIALS_PATH=/path/to/service-account.json" >> ~/.hermes/.env
Option B — Application Default Credentials (for local dev)
Run this in your terminal:
gcloud auth application-default login
Then select Vertex as your provider:
hermes model
Choose “More providers…” → “Google Vertex AI” → enter your GCP project ID (or leave blank to use the one in your credentials) → pick a region (default: global) → select a Gemini model.
Finally, start chatting:
hermes chat
Where Settings Live (Simple Breakdown)
Hermes splits Vertex settings into two files based on sensitivity:
~/.hermes/.env — holds the secret pointer (the path to your credentials):
# Use one of these (checked in this order); omit both to use ADC:
VERTEX_CREDENTIALS_PATH=/path/to/service-account.json
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
~/.hermes/config.yaml — holds non-secret routing settings (project ID and region):
model:
default: google/gemini-...
Summary & Practical Tip
Vertex AI gives you enterprise-grade reliability with Gemini models, and Hermes handles the tricky OAuth2 token refresh automatically. You just point Hermes at your credentials once, and you’re set.
Pro tip: If you’re running Hermes on a server or gateway, always use the service account JSON method (Option A)—it’s more secure and predictable than ADC. And if you ever get stuck, run hermes setup to repair a managed install if the lazy install of google-auth fails. Happy building!
📖 Official Docs
This article is based on the official Hermes Agent documentation:Official docs › guides/google-vertex