fix(doctor): use x-goog-api-key for Google generativelanguage endpoint#26961
Closed
zwolniony wants to merge 1 commit into
Closed
fix(doctor): use x-goog-api-key for Google generativelanguage endpoint#26961zwolniony wants to merge 1 commit into
zwolniony wants to merge 1 commit into
Conversation
This was referenced May 17, 2026
teknium1
added a commit
that referenced
this pull request
May 17, 2026
…tors Adds release-note attribution mappings for 9 contributors from group 4: - @EloquentBrush0x (PR #26657) - @subtract0 (PR #25658) - @zwolniony (PR #26961) - @that-ambuj (PR #26582) - @zccyman (PR #25294) - @lidge-jun (PR #26814) - @phoenixshen (PR #26768) - @AhmetArif0 (PR #26635) - (francip already mapped from prior PR #26134 attribution) #27147 dropped from this batch — already landed on main as 4b17c24.
Contributor
|
Merged via PR #27308 — your commit was cherry-picked onto current |
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…tors Adds release-note attribution mappings for 9 contributors from group 4: - @EloquentBrush0x (PR NousResearch#26657) - @subtract0 (PR NousResearch#25658) - @zwolniony (PR NousResearch#26961) - @that-ambuj (PR NousResearch#26582) - @zccyman (PR NousResearch#25294) - @lidge-jun (PR NousResearch#26814) - @phoenixshen (PR NousResearch#26768) - @AhmetArif0 (PR NousResearch#26635) - (francip already mapped from prior PR NousResearch#26134 attribution) NousResearch#27147 dropped from this batch — already landed on main as 4b17c24.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hermes doctorreports a validGOOGLE_API_KEY/GEMINI_API_KEYas "invalid API key" with the hint "Check GOOGLE_API_KEY in .env", even when the key works perfectly at runtime. The generic API-key probe sendsAuthorization: Bearer <key>, but Google's Generative Language API doesn't accept that header for plain API keys — it's reserved for OAuth 2 access tokens. The runtime path uses the correct auth scheme, so only the doctor check is affected.Reproduction
GOOGLE_API_KEY(e.g. from https://aistudio.google.com/app/apikey) on a project where the Gemini API is enabled.hermes doctor.Expected: ✓ Google / Gemini
Actual: ✗ Google / Gemini (invalid API key) → "Check GOOGLE_API_KEY in .env"
Root cause
In
hermes_cli/doctor.py,_probe_apikey_providersends:Google's response:
Plain API keys for
generativelanguage.googleapis.commust be sent via?key=<key>or thex-goog-api-keyheader. TheAuthorization: Bearerheader is reserved for OAuth 2 access tokens, and Google explicitly rejects API keys sent that way.Fix
Mirror the existing
api.kimi.comspecial-case directly above: after computingurl, detect when the host isgenerativelanguage.googleapis.comand swapAuthorization: Bearerforx-goog-api-key.base_url_host_matchesis already imported and used a few lines up.Matches against the final
url(not justbase), so it works for both*_BASE_URL-overridden setups and the default URL from the Gemini provider profile.Test plan
hermes doctorwith a workingGOOGLE_API_KEYnow reports ✓ Google / Gemini.Authorization: Bearer <key>request returns 401ACCESS_TOKEN_TYPE_UNSUPPORTED, while the same key withx-goog-api-keyreturns 200 + model list.