hermes - 💡(How to fix) Fix [Bug]: hermes doctor falsely reports valid Google AI Studio Gemini API key as invalid [1 pull requests]

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…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

Not collected yet. Runtime validation and code-level diagnosis are included below.

---

Relevant doctor output:

API Connectivity
  Checking gemini API...
gemini (invalid API key)
RAW_BUFFERClick to expand / collapse

Bug Description

hermes doctor reports a working Google AI Studio / Gemini API key as invalid.

Runtime Gemini chat succeeds with provider gemini, model gemma-4-31b-it, base URL https://generativelanguage.googleapis.com/v1beta, and GOOGLE_API_KEY set. For example, hermes chat -Q -q "Reply with exactly: hermes-ok" --max-turns 3 returns hermes-ok.

However, hermes doctor reports gemini (invalid API key) under API Connectivity.

Steps to Reproduce

  1. Set a working Google AI Studio key as GOOGLE_API_KEY.
  2. Configure:
    • model.provider = gemini
    • model.default = gemma-4-31b-it
    • model.base_url = https://generativelanguage.googleapis.com/v1beta
  3. Confirm runtime works: hermes chat -Q -q "Reply with exactly: hermes-ok" --max-turns 3 returns hermes-ok.
  4. Run hermes doctor.
  5. Observe gemini (invalid API key) under API Connectivity.

Expected Behavior

hermes doctor should report Gemini API connectivity as healthy for a valid Google AI Studio key.

Actual Behavior

hermes doctor reports gemini (invalid API key) and suggests checking GOOGLE_API_KEY, even though runtime Gemini chat works with the same key.

Affected Component

Other

Messaging Platform (if gateway-related)

No response

Debug Report

Not collected yet. Runtime validation and code-level diagnosis are included below.

Operating System

Linux

Python Version

3.11.15

Hermes Version

Config version 23; exact hermes version not captured yet.

Additional Logs / Traceback (optional)

Relevant doctor output:

◆ API Connectivity
  Checking gemini API...
  ✗ gemini (invalid API key)

Root Cause Analysis (optional)

hermes_cli/doctor.py dynamically includes the gemini API-key provider via _build_apikey_providers_list(). The dynamic tuple includes GOOGLE_API_KEY / GEMINI_API_KEY and https://generativelanguage.googleapis.com/v1beta/models.

The API-key health-check loop then uses the generic OpenAI-compatible probe: GET {base}/models with Authorization: Bearer <key>. Google AI Studio Gemini API keys are not OpenAI-compatible bearer tokens; they require Google-style auth such as x-goog-api-key: <key> or ?key=<key> against Gemini endpoints.

Proposed Fix (optional)

Add a Gemini-specific doctor connectivity path that probes GET {base}/models using x-goog-api-key, with default base URL https://generativelanguage.googleapis.com/v1beta and optional GEMINI_BASE_URL override. Also ensure GOOGLE_API_KEY, GEMINI_API_KEY, and GEMINI_BASE_URL are recognized by the .env provider-config detector.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING