Connect Google Gemini
Connect Google Gemini — easy-to-understand guide based on official docs
Think of Hermes Agent as a universal remote—it can control many different AI services, and today we’re going to pair it with Google Gemini, Google’s powerful AI model.
Why Use Gemini with Hermes?
Gemini is fast, smart, and great at handling text, images, and even videos. By connecting it to Hermes, you get an AI agent that can browse the web, use tools, and remember context across long conversations—all powered by Gemini’s brain.
The best part? Hermes talks to Gemini using Gemini’s own native language (API), not a translation layer. This means smoother tool calling, better streaming, and fewer hiccups when your agent needs to do complex tasks.
What You’ll Need
Before we start, grab these three things:
- A Google AI Studio API key – Get one free at aistudio.google.com/apikey
- A Google Cloud project with billing enabled – Recommended, because the free tier is too small for long agent sessions
- Hermes installed – No extra packages needed!
Step 1: Add Your API Key
Open your terminal and add your key to Hermes’ environment file:
echo "GOOGLE_API_KEY=your_api_key_here" >> ~/.hermes/.env
Hermes checks for both GOOGLE_API_KEY and GEMINI_API_KEY, so either works.
Step 2: Select Gemini as Your Provider
Run this command to open the model picker:
hermes model
Then follow these steps:
- Choose “More providers…”
- Select “Google AI Studio”
- Hermes will check your key and show available Gemini models
- Pick a model (like
gemini-3-flash-preview)
Step 3: Start Chatting
Once selected, just run:
hermes chat
That’s it! You’re now talking to Gemini through Hermes.
What Happens Behind the Scenes?
If you peek at your config file (~/.hermes/config.yaml), you’ll see something like:
model:
default: gemini-3-flash-preview
provider: gemini
base_url: https://generativelanguage.googleapis.com/v1beta
This tells Hermes to use Gemini’s native endpoint. Hermes translates its internal messages into Gemini’s format automatically—so you don’t have to worry about the technical details.
A Quick Note on Endpoints
Google also offers an OpenAI-compatible endpoint. But for Hermes, always prefer the native one (https://generativelanguage.googleapis.com/v1beta). The native adapter gives you better tool calling, streaming, and metadata support—things that make your agent work reliably.
If you previously set GEMINI_BASE_URL to the /openai URL, change it back:
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
Summary
Connecting Gemini to Hermes takes less than a minute:
- Add your API key to
~/.hermes/.env - Run
hermes modeland pick Google AI Studio - Choose a model and start chatting
Practical tip: Start with the free tier to test things out, but switch to a billing-enabled project once you’re running real agent tasks. Gemini’s free tier runs out quickly when your agent makes multiple calls per turn—you’ll thank yourself later!
📖 Official Docs
This article is based on the official Hermes Agent documentation:Official docs › guides/google-gemini