hermes - ✅(Solved) Fix Hermes Doctor flags Google Gemini API key as invalid even when the key works [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#23354Fetched 2026-05-11 03:29:55
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
labeled ×5commented ×1cross-referenced ×1referenced ×1

hermes doctor reports the Google Gemini API key as invalid API key, but the same key successfully authenticates against the Gemini API directly.

Error Message

hermes doctor should validate Gemini API keys using the Gemini API's ?key= auth flow, or otherwise avoid reporting a false invalid-key error when the key is actually valid.

Root Cause

hermes doctor reports the Google Gemini API key as invalid API key, but the same key successfully authenticates against the Gemini API directly.

Fix Action

Fixed

PR fix notes

PR #23364: fix(doctor): use ?key= auth for Gemini API key validation

Description (problem / solution / changelog)

What does this PR do?

_probe_apikey_provider uses Authorization: Bearer for all providers, but Google's generativelanguage.googleapis.com requires the API key as a ?key= query parameter. Sending a Bearer token to /v1beta/models always returns HTTP 401 — even for a perfectly valid key — causing hermes doctor to falsely report Gemini credentials as invalid.

Fix: before firing the health-check request, detect URLs pointing to generativelanguage.googleapis.com and switch to params={"key": key} auth, matching the Gemini REST API contract. All other providers continue through the existing Bearer path unchanged.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

References

Fixes #23354

Checklist

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • My PR contains only changes related to this fix

Changed files

  • hermes_cli/doctor.py (modified, +672/-218)
RAW_BUFFERClick to expand / collapse

Summary

hermes doctor reports the Google Gemini API key as invalid API key, but the same key successfully authenticates against the Gemini API directly.

What I verified

From this host:

  • GET https://generativelanguage.googleapis.com/v1beta/models?key=<API_KEY> returned HTTP 200
  • POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=<API_KEY> returned HTTP 200 and generated a valid response
  • GET /v1beta/models with Authorization: Bearer <API_KEY> returned HTTP 401, which suggests the doctor check is using the wrong auth style for this provider

Expected behavior

hermes doctor should validate Gemini API keys using the Gemini API's ?key= auth flow, or otherwise avoid reporting a false invalid-key error when the key is actually valid.

Actual behavior

hermes doctor prints a Gemini connectivity warning/invalid key message even though the Gemini API calls succeed.

Notes

  • OpenAI/Codex remains the default provider; Gemini was configured only as an optional credential.
  • This appears to be a false positive in the doctor connectivity check, not a billing issue.

Environment

  • Hermes Agent on AWS Lightsail Ubuntu 24.04
  • hermes update completed successfully before this check

Reproduction steps

  1. Set GEMINI_API_KEY in ~/.hermes/.env
  2. Run hermes doctor
  3. Observe Gemini being flagged invalid
  4. Call the Gemini API directly with the same key and observe success

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

hermes doctor should validate Gemini API keys using the Gemini API's ?key= auth flow, or otherwise avoid reporting a false invalid-key error when the key is actually valid.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Hermes Doctor flags Google Gemini API key as invalid even when the key works [1 pull requests, 1 comments, 2 participants]