hermes - 💡(How to fix) Fix [Bug]: ACP `/model ... --provider <named custom provider>` still gets re-routed by model auto-detection

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

Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with hermes model. 5. Observe that ACP fails with a native Gemini credential error instead of switching to the named custom provider. Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with hermes model.

Additional Logs / Traceback (optional)

-> Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found.

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

Local patch prepared and verified.

Code Example

providers:
  quotio:
    name: Quotio
    base_url: http://127.0.0.1:8317/v1
    transport: openai_chat
    api_key: ${QUOTIO_API_KEY}
    model: gemini-3.1-flash-lite-preview

---

/model gemini-3-flash-preview --provider quotio

---

Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with `hermes model`.

---

providers:
     quotio:
       name: Quotio
       base_url: http://127.0.0.1:8317/v1
       transport: openai_chat
       api_key: ${QUOTIO_API_KEY}
       model: gemini-3.1-flash-lite-preview

---

/model gemini-3-flash-preview --provider quotio

---

/model gemini-3-flash-preview --provider quotio

---

"gemini-3-flash-preview" -> provider auto-detected as "gemini"

---

Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with `hermes model`.

---

Report       https://paste.rs/N7tBg
agent.log    https://paste.rs/3o8MB
gateway.log  https://paste.rs/6mUvX

---

## 


Reproduced directly against the current installed source:

parse_model_flags:
  model_input='gemini-3-flash-preview'
  explicit_provider='quotio'

ACP resolution before fix:
  HermesACPAgent._resolve_model_selection('gemini-3-flash-preview', 'quotio')
  -> ('gemini', 'gemini-3-flash-preview')

ACP slash command before fix:
  /model gemini-3-flash-preview --provider quotio
  -> Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found.

CLI shared switch path for the same input:
  switch_model.success = True
  switch_model.target_provider = quotio
  switch_model.new_model = gemini-3-flash-preview
  switch_model.base_url = http://127.0.0.1:8317/v1

---

current_provider = quotio
raw_model = gemini-3-flash-preview

---

target_provider = gemini
new_model = gemini-3-flash-preview

---

preserve_provider: bool = False

---

self._resolve_model_selection(
         new_model,
         target_provider,
         preserve_provider=bool(explicit_provider),
     )
RAW_BUFFERClick to expand / collapse

Bug Description

This appears related to [Bug]: /model --provider flag ignored when sent via ACP (Scarf, Zed, etc.) #27119, but it is not the same bug.

Issue #27119 was about ACP not parsing --provider / --global correctly. In the current ACP path, parse_model_flags() is already called, but an explicit provider can still be silently overridden later by model-name auto-detection.

With a named custom provider in config.yaml, for example:

providers:
  quotio:
    name: Quotio
    base_url: http://127.0.0.1:8317/v1
    transport: openai_chat
    api_key: ${QUOTIO_API_KEY}
    model: gemini-3.1-flash-lite-preview

sending this command through an ACP client:

/model gemini-3-flash-preview --provider quotio

should route the request to the named custom provider quotio.

Instead, ACP detects gemini-3-flash-preview as a native Gemini-family model and rewrites the provider from quotio to gemini. That causes Hermes to try to resolve native Gemini credentials and fail with:

Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with `hermes model`.

The CLI shared /model path does not have this problem: the same command resolves correctly to quotio.

Steps to Reproduce

  1. Configure a named custom provider in ~/.hermes/config.yaml, for example:

    providers:
      quotio:
        name: Quotio
        base_url: http://127.0.0.1:8317/v1
        transport: openai_chat
        api_key: ${QUOTIO_API_KEY}
        model: gemini-3.1-flash-lite-preview
  2. Start Hermes ACP and connect with an ACP client such as Scarf or Zed.

  3. Use a config where the current/default provider is not quotio (for example openai-codex).

  4. Send:

    /model gemini-3-flash-preview --provider quotio
  5. Observe that ACP fails with a native Gemini credential error instead of switching to the named custom provider.

Minimal direct reproduction from the ACP code path:

  • parse_model_flags("gemini-3-flash-preview --provider quotio") returns:
    • model_input = "gemini-3-flash-preview"
    • explicit_provider = "quotio"
  • but HermesACPAgent._resolve_model_selection("gemini-3-flash-preview", "quotio") returns:
    • ("gemini", "gemini-3-flash-preview")

Expected Behavior

When ACP receives:

/model gemini-3-flash-preview --provider quotio

it should:

  • preserve the explicit provider override (quotio)
  • resolve the runtime via the named custom provider
  • rebuild the ACP session agent against http://127.0.0.1:8317/v1
  • switch the model to gemini-3-flash-preview

In other words, explicit --provider should remain authoritative, just as it does in the CLI model-switch path.

Actual Behavior

ACP parses --provider quotio, but later re-routes the request based on the model name:

"gemini-3-flash-preview" -> provider auto-detected as "gemini"

That causes the ACP session to resolve native Gemini runtime credentials instead of the named custom provider, and the command fails with:

Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found. Set the GOOGLE_API_KEY environment variable, or switch to a different provider with `hermes model`.

Affected Component

CLI (interactive chat), Other, Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Report       https://paste.rs/N7tBg
agent.log    https://paste.rs/3o8MB
gateway.log  https://paste.rs/6mUvX

Operating System

macOS 15.7.7

Python Version

3.11.15

Hermes Version

0.14.0 (2026.5.16)

Additional Logs / Traceback (optional)

## 


Reproduced directly against the current installed source:

parse_model_flags:
  model_input='gemini-3-flash-preview'
  explicit_provider='quotio'

ACP resolution before fix:
  HermesACPAgent._resolve_model_selection('gemini-3-flash-preview', 'quotio')
  -> ('gemini', 'gemini-3-flash-preview')

ACP slash command before fix:
  /model gemini-3-flash-preview --provider quotio
  -> Error executing /model: Provider 'gemini' is set in config.yaml but no API key was found.

CLI shared switch path for the same input:
  switch_model.success = True
  switch_model.target_provider = quotio
  switch_model.new_model = gemini-3-flash-preview
  switch_model.base_url = http://127.0.0.1:8317/v1

Root Cause Analysis (optional)

Relevant code paths:

  • acp_adapter/server.py:584_resolve_model_selection(...)
  • acp_adapter/server.py:1524_cmd_model(...)
  • hermes_cli/model_switch.py:297parse_model_flags(...)
  • hermes_cli/model_switch.py:615 — shared CLI switch_model(...)

ACP currently does two different things:

  1. _cmd_model(...) correctly parses --provider quotio via parse_model_flags().
  2. _resolve_model_selection(...) then calls detect_provider_for_model(...) if the parsed model name looks like it belongs to a known native provider family.

That second step is what breaks explicit provider overrides for named custom providers. In this case:

current_provider = quotio
raw_model = gemini-3-flash-preview

and ACP turns that into:

target_provider = gemini
new_model = gemini-3-flash-preview

So the explicit provider is silently clobbered after it was already parsed correctly.

This makes the bug related to #27119, but distinct from it:

  • #27119: ACP did not parse the --provider flag correctly
  • this bug: ACP parses the flag, but later overrides it during model-family auto-detection

Proposed Fix (optional)

Local patch prepared and verified.

Code changes:

  1. acp_adapter/server.py

    • extended _resolve_model_selection(...) with:

      preserve_provider: bool = False
    • when preserve_provider=True, skip provider auto-detection and keep the explicit provider authoritative after parse_model_input(...)

  2. acp_adapter/server.py

    • updated _cmd_model(...) to call:

      self._resolve_model_selection(
          new_model,
          target_provider,
          preserve_provider=bool(explicit_provider),
      )

Are you willing to submit a PR for this?

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

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]: ACP `/model ... --provider <named custom provider>` still gets re-routed by model auto-detection