From 7f26cea390664c0cd39da27447f40556ee8664ac Mon Sep 17 00:00:00 2001 From: "Brian D. Evans" <252620095+briandevans@users.noreply.github.com> Date: Fri, 24 Apr 2026 05:46:59 -0700 Subject: [PATCH] fix(models): strip models/ prefix in Gemini validator (#12532) Salvage of the Gemini-specific piece from PR #12585 by @briandevans. Gemini's OpenAI-compat /v1beta/openai/models endpoint returns IDs prefixed with 'models/' (native Gemini-API convention), so set-membership against curated bare IDs drops every model. Strip the prefix before comparison. The Anthropic static-catalog piece of #12585 was subsumed by #12618's _fetch_anthropic_models() branch landing earlier in the same salvage PR. Full branch cherry-pick was skipped because it also carried unrelated catalog-version regressions. --- hermes_cli/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hermes_cli/models.py b/hermes_cli/models.py index d0853bd3..691742a4 100644 --- a/hermes_cli/models.py +++ b/hermes_cli/models.py @@ -2740,6 +2740,16 @@ def validate_requested_model( api_models = fetch_api_models(api_key, base_url) if api_models is not None: + # Gemini's OpenAI-compat /v1beta/openai/models endpoint returns IDs + # prefixed with "models/" (e.g. "models/gemini-2.5-flash") — native + # Gemini-API convention. Our curated list and user input both use + # the bare ID, so a direct set-membership check drops every known + # Gemini model. Strip the prefix before comparison. See #12532. + if normalized == "gemini": + api_models = [ + m[len("models/"):] if isinstance(m, str) and m.startswith("models/") else m + for m in api_models + ] if requested_for_lookup in set(api_models): # API confirmed the model exists return {