How-To Guide
Use Hermes Agent with Google Gemini (Full Setup Guide)
Connect Hermes Agent to Google Gemini models using Code Assist API OAuth, including 1M token context and multi-tool support.
Quick answer
Use Hermes with Google Gemini for huge context windows (up to 1M tokens). Via the Code Assist API, Gemini uses OAuth authentication rather than a simple API key, so setup is a sign-in flow. Once authenticated, you get Google's latest models with plenty of room for long agent sessions.
Google Gemini offers competitive models with massive context windows (1M tokens). Connecting Hermes to Gemini via the Code Assist API requires OAuth authentication rather than a simple API key, but once set up, it provides access to Gemini's full capabilities including the 1M context window.
Managed cloud · API costs included · Skill library · Cancel anytime
Before you start:
- ☑Hermes Agent installed
- ☑Google account with Gemini access
- ☑Gemini CLI installed for OAuth flow
Steps
- 1
Install Gemini CLI
Install Google's official Gemini CLI for OAuth authentication
- 2
Authenticate via device code
Run the Gemini CLI auth flow — Hermes will adopt these tokens automatically
- 3
Configure Hermes for Gemini
Set model: provider: gemini-oauth in config.yaml
- 4
Enable full context window
Manually set context length to 1M tokens — Hermes can't auto-detect from Code Assist API
- 5
Apply multi-tool fix (if needed)
Apply the thoughtSignature replay fix if multi-turn tool calling breaks
Pro Tips
- 💡The community has a detailed setup guide: github.com/synthalorian/hermes-gemini-setup-guide
- 💡Hermes doesn't auto-detect context length from Code Assist — set it manually in config.yaml
- 💡Free tier has rate limits — configure server-guided retry instead of blind backoff for better handling
Troubleshooting
❌ Responses are extremely slow
✅ Gemini can be slow with thinking-heavy tasks. This is normal — as long as it doesn't timeout or crash, let it complete.
❌ Multi-turn tool calling fails
✅ Apply the thoughtSignature replay fix from the community setup guide. This is a known issue with the Code Assist API.
❌ Context window seems limited to 128k
✅ Hermes can't auto-detect context from Code Assist. Manually set 'model: contextLength: 1000000' in config.yaml.
FAQ
Why does Gemini need OAuth instead of an API key?
Through the Code Assist API, Gemini authenticates with OAuth — a sign-in flow rather than a pasted key. Once authorized, Hermes uses your Gemini access directly.
What's the advantage of Gemini for Hermes?
Very large context windows (up to 1M tokens), which suit long agent sessions and big inputs, plus competitive pricing on the Flash models for high-volume tasks.
Is there a simpler way to use Gemini?
Yes — the native Gemini provider uses a standard API key if you don't need the Code Assist path. Choose based on which access you already have.