hermes - 💡(How to fix) Fix [Bug]: Vision module routes Gemini API calls through native adapter even when OpenAI-compatible endpoint is configured

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…

When configuring the auxiliary vision module to use Gemini models via the OpenAI-compatible endpoint (/v1beta/openai), Hermes's Gemini native adapter still intercepts the request and converts it to the native Gemini REST API format, causing a GenerateContentRequest.model: unexpected model name format error.

Error Message

When configuring the auxiliary vision module to use Gemini models via the OpenAI-compatible endpoint (/v1beta/openai), Hermes's Gemini native adapter still intercepts the request and converts it to the native Gemini REST API format, causing a GenerateContentRequest.model: unexpected model name format error. 3. Call vision_analyze with any image → Error 400

Root Cause

is_native_gemini_base_url() in agent/gemini_native_adapter.py should return False when base_url ends with /openai, but in the resolve_vision_provider_client() flow, the native adapter is triggered regardless.

Even with explicit base_url: .../openai, requests are converted to Gemini native :generateContent format instead of OpenAI-compatible /chat/completions.

Fix Action

Fix / Workaround

Verified Working Workaround

Code Example

auxiliary:
  vision:
    provider: gemini
    model: gemini-2.5-flash
    base_url: https://generativelanguage.googleapis.com/v1beta/openai
    api_key: <key>

---

url = "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"
headers = {"Authorization": "Bearer <KEY>"}
body = {"model": "gemini-2.5-flash", "messages": [...]}
# → 200 OK
RAW_BUFFERClick to expand / collapse

Description

When configuring the auxiliary vision module to use Gemini models via the OpenAI-compatible endpoint (/v1beta/openai), Hermes's Gemini native adapter still intercepts the request and converts it to the native Gemini REST API format, causing a GenerateContentRequest.model: unexpected model name format error.

Steps to Reproduce

  1. Set environment variable GOOGLE_API_KEY with a valid Gemini API key
  2. Configure vision module:
auxiliary:
  vision:
    provider: gemini
    model: gemini-2.5-flash
    base_url: https://generativelanguage.googleapis.com/v1beta/openai
    api_key: <key>
  1. Call vision_analyze with any image → Error 400

Root Cause

is_native_gemini_base_url() in agent/gemini_native_adapter.py should return False when base_url ends with /openai, but in the resolve_vision_provider_client() flow, the native adapter is triggered regardless.

Even with explicit base_url: .../openai, requests are converted to Gemini native :generateContent format instead of OpenAI-compatible /chat/completions.

Verified Working Workaround

Direct API calls work fine:

url = "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"
headers = {"Authorization": "Bearer <KEY>"}
body = {"model": "gemini-2.5-flash", "messages": [...]}
# → 200 OK

Environment

  • Hermes Agent v0.14.0
  • Python 3.10
  • Ubuntu 22.04

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 - 💡(How to fix) Fix [Bug]: Vision module routes Gemini API calls through native adapter even when OpenAI-compatible endpoint is configured