Skip to content

The agent that grows with you

docs(gemini): scope the base-URL normalization claim to the Google host and TTS

teknium1123db986358f
diff --git a/agent/gemini_native_adapter.py b/agent/gemini_native_adapter.py
index df3bef3a126..82d4a45828a 100644
--- a/agent/gemini_native_adapter.py
+++ b/agent/gemini_native_adapter.py
@@ -105,7 +105,9 @@ def normalize_gemini_base_url(base_url: Optional[str]) -> str:
proxy root like ``http://localhost:4000/gemini``) that way; our request builders expect
``{base}/models/{model}:generateContent`` — without ``/v1beta`` that is a guaranteed 404. Trailing
slashes and an ``/openai`` suffix are stripped; an existing version segment (``v1``, ``v1beta``,
- ``v1alpha``, ...) is kept; empty input returns ``DEFAULT_GEMINI_BASE_URL``."""
+ ``v1alpha``, ...) is kept; empty input returns ``DEFAULT_GEMINI_BASE_URL``. Only the LAST path
+ segment is inspected, so ``.../v1beta/extra`` still gets ``/v1beta`` appended; this does not
+ decide routing (see ``is_native_gemini_base_url``)."""
trimmed = str(base_url or "").strip().rstrip("/")
trimmed = re.sub(r"/openai\Z", "", trimmed, flags=re.IGNORECASE).rstrip("/")
if not trimmed:
diff --git a/website/docs/guides/google-gemini.md b/website/docs/guides/google-gemini.md
index 4783c5a28f8..eac7bd4214b 100644
--- a/website/docs/guides/google-gemini.md
+++ b/website/docs/guides/google-gemini.md
@@ -103,11 +103,14 @@ If you previously set `GEMINI_BASE_URL` to the `/openai` URL, remove it or chang
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
```
-Host-root base URLs are normalized automatically: if the URL doesn't end with
-an API version segment (`v1beta`, `v1alpha`, `v1`, ...), Hermes appends
-`/v1beta` for you. Setting `GEMINI_BASE_URL=https://generativelanguage.googleapis.com`
-or pointing at a proxy root like `http://localhost:4000/gemini` works the same
-as spelling out the `/v1beta` suffix.
+Host-root base URLs on the Google host are normalized automatically: if the URL
+doesn't end with an API version segment (`v1beta`, `v1alpha`, `v1`, ...), Hermes
+appends `/v1beta` for you, so `GEMINI_BASE_URL=https://generativelanguage.googleapis.com`
+works the same as spelling out the `/v1beta` suffix. The same normalization
+applies to the Gemini TTS base URL (`tts.gemini.base_url`). Chat requests only
+take the native Gemini path when the base URL points at
+`generativelanguage.googleapis.com`; a proxy on another host is treated as an
+OpenAI-compatible endpoint, so configure it with its `/openai`-style URL.
## Available Models