fix(doctor): use ?key= query auth for Gemini connectivity probe#26067
Closed
ai920wisco wants to merge 1 commit into
Closed
fix(doctor): use ?key= query auth for Gemini connectivity probe#26067ai920wisco wants to merge 1 commit into
ai920wisco wants to merge 1 commit into
Conversation
The Gemini connectivity probe in hermes doctor sent the API key as a Bearer header against https://generativelanguage.googleapis.com/v1beta/models, but Google's native v1beta surface only accepts ?key=<value> query auth. Bearer always returns 401, producing a false 'invalid API key' verdict for valid keys. Switch the probe to ?key= when the URL targets generativelanguage.googleapis.com and drop the Authorization header for that case.
Collaborator
This was referenced May 15, 2026
Contributor
|
Closing as duplicate — #26961 by @zwolniony lands the same Gemini doctor 401 fix using |
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.
Problem
hermes doctoralways reportsgemini (invalid API key)— even for keys that work perfectly against the Gemini API — because the connectivity probe sends the key as aBearerAuthorization header:Google's native v1beta surface does not accept Bearer auth on this endpoint; it requires
?key=<value>query auth. The result is a hard 401, and the probe interprets that as "invalid API key" — a false positive that's misleading users into thinking their valid key is broken.Verified locally: same key returns 200 with
?key=, 401 with Bearer.Fix
When the probe URL targets
generativelanguage.googleapis.com, append?key=<value>and drop theAuthorizationheader. All other providers are unchanged.Test plan
hermes doctoragainst a validGEMINI_API_KEY/GOOGLE_API_KEY→ now shows ✓HTTP 400from Google's API-key validation path)_probe_apikey_provider(DeepSeek, GLM, Kimi, etc.) unaffected — gated on URL host.