mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
Local: doctor uses x-goog-api-key for Google generativelanguage endpoint
This commit is contained in:
parent
fdd455bc58
commit
364a1dd290
1 changed files with 9 additions and 0 deletions
|
|
@ -1474,6 +1474,15 @@ def run_doctor(args):
|
|||
}
|
||||
if base_url_host_matches(base, "api.kimi.com"):
|
||||
headers["User-Agent"] = "claude-code/0.1.0"
|
||||
# Google's Generative Language API (generativelanguage.googleapis.com)
|
||||
# rejects ``Authorization: Bearer <api-key>`` with 401
|
||||
# ``ACCESS_TOKEN_TYPE_UNSUPPORTED`` — that header is reserved for
|
||||
# OAuth 2 access tokens, not plain API keys. Plain keys use
|
||||
# ``x-goog-api-key`` (or ``?key=``). Without this, a perfectly valid
|
||||
# GOOGLE_API_KEY/GEMINI_API_KEY always shows red in ``hermes doctor``.
|
||||
if url and base_url_host_matches(url, "generativelanguage.googleapis.com"):
|
||||
headers.pop("Authorization", None)
|
||||
headers["x-goog-api-key"] = key
|
||||
r = httpx.get(url, headers=headers, timeout=10)
|
||||
if (
|
||||
pname == "Alibaba/DashScope"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue