hermes - ✅(Solved) Fix [Bug]: Regression: /model command validation blocks switching to Gemini models after native adapter update [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

PR fix notes

PR #13557: fix(gemini): validate native model switches against the AI Studio catalog

Description (problem / solution / changelog)

Summary

  • validate gemini /model switches against the built-in Google AI Studio catalog instead of probing an OpenAI-style /models endpoint
  • keep valid Gemini model switches working after the native Gemini adapter migration
  • add regression coverage for recognized and unrecognized Gemini model names when the API probe is unavailable

Why

Fixes #13186.

Google AI Studio's native Gemini API does not expose an OpenAI-compatible /models listing. After the native adapter migration, validate_requested_model() still fell through to the generic /models probe path, so valid /model gemini-* switches were rejected even though the provider's static catalog already knew about those models.

Verification

  • python3 -m pytest -o addopts='' -q tests/hermes_cli/test_gemini_model_validation.py
  • python3 -m pytest -o addopts='' -q tests/test_minimax_model_validation.py
  • python3 -m pytest -o addopts='' -q tests/hermes_cli/test_gemini_provider.py

Changed files

  • hermes_cli/models.py (modified, +45/-0)
  • tests/hermes_cli/test_gemini_model_validation.py (added, +44/-0)

Code Example

version:          0.10.0 (2026.4.16) [b7e71fb7]
    os:               Linux 6.6.87.2-microsoft-standard-WSL2 x86_64
    python:           3.11.15
    openai_sdk:       2.32.0
    profile:          default
    hermes_home:      ~/.hermes
    model:            gemini-3.1-pro-preview
    provider:         gemini
    terminal:         local

---
RAW_BUFFERClick to expand / collapse

Bug Description

Description:
Commit 3dea497b migrated the gemini provider to a native API adapter (removing the OpenAI translation layer). However, the CLI model validation logic in hermescli/models.py (validaterequested_model) still probes for an OpenAI-compatible /models endpoint to verify model existence.

Since the native Google AI Studio endpoint doesn't return an OpenAI-compatible model list, the probe fails (HTTP 404), causing validaterequestedmodel to return accepted: False. This completely blocks users from dynamically switching to Gemini models via /model <name> in the CLI or gateway.

Steps to Reproduce

1. Ensure the default provider is set to gemini.
2. Run /model gemini-3.1-pro-preview in the CLI or Gateway.
3. The system rejects the switch with: "Could not reach the Google AI Studio API to validate... If the service isn't down, this model may not be valid."

Expected Behavior

Switch to a different gemini model

Actual Behavior

Cannot find model errors

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

version:          0.10.0 (2026.4.16) [b7e71fb7]
    os:               Linux 6.6.87.2-microsoft-standard-WSL2 x86_64
    python:           3.11.15
    openai_sdk:       2.32.0
    profile:          default
    hermes_home:      ~/.hermes
    model:            gemini-3.1-pro-preview
    provider:         gemini
    terminal:         local

Operating System

Ubuntu 22.04.5 LTS

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

Update the validaterequested_model function in hermescli/models.py to accommodate the native Google AI Studio API adapter.

Guidance

  • Review the validaterequested_model function to understand how it probes for model existence and how it can be modified to work with the native Google AI Studio API.
  • Investigate the Google AI Studio API documentation to determine the correct endpoint and response format for model validation.
  • Consider adding a conditional check in the validaterequested_model function to handle the difference between OpenAI-compatible and native Google AI Studio API adapters.
  • Test the updated function with different model names and providers to ensure it works as expected.

Example

# Example of how the validaterequested_model function might be updated
def validaterequested_model(model_name, provider):
    if provider == 'gemini':
        # Use the native Google AI Studio API adapter
        # Replace with the actual API endpoint and response handling
        response = requests.get(f'https://api.google.com/studio/models/{model_name}')
        if response.status_code == 200:
            return True
    else:
        # Use the OpenAI-compatible API adapter
        # Replace with the actual API endpoint and response handling
        response = requests.get(f'https://api.openai.com/models/{model_name}')
        if response.status_code == 200:
            return True
    return False

Notes

The provided code snippet is a simplified example and may require modifications to work with the actual API endpoints and response formats. Additionally, the validaterequested_model function may need to handle errors and exceptions more robustly.

Recommendation

Apply a workaround by updating the validaterequested_model function to accommodate the native Google AI Studio API adapter, as the issue is specific to the gemini provider and the current implementation is blocking users from switching to Gemini models.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: Regression: /model command validation blocks switching to Gemini models after native adapter update [1 pull requests]