hermes - 💡(How to fix) Fix 【Bug】set_runtime_main() missing base_url/api_key causes custom: provider fallback to wrong endpoint

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…

Root Cause

In agent/auxiliary_client.py, _resolve_auto() Step 1 (line ~3016):

if runtime_base_url and (main_provider == "custom" or main_provider.startswith("custom:")):
    resolved_provider = "custom"
    explicit_base_url = runtime_base_url

runtime_base_url is always empty because set_runtime_main() (called from conversation_loop.py:392) only sets:

set_runtime_main(
    getattr(agent, "provider", "") or "",
    getattr(agent, "model", "") or "",
)

It does not pass base_url, api_key, or api_mode.

Fix Action

Workaround

Set auxiliary task config explicitly in config.yaml:

auxiliary:
  approval:
    provider: custom
    model: glm-5.1
    base_url: https://your-domain.com/v1
    api_key: your-key

Code Example

model:
     default: glm-5.1
     provider: custom:openclaw-router
     base_url: ''
   custom_providers:
     - name: openclaw-router
       base_url: https://your-domain.com/v1
       model: glm-5.1
       api_key: your-key

---

if runtime_base_url and (main_provider == "custom" or main_provider.startswith("custom:")):
    resolved_provider = "custom"
    explicit_base_url = runtime_base_url

---

set_runtime_main(
    getattr(agent, "provider", "") or "",
    getattr(agent, "model", "") or "",
)

---

auxiliary:
  approval:
    provider: custom
    model: glm-5.1
    base_url: https://your-domain.com/v1
    api_key: your-key
RAW_BUFFERClick to expand / collapse

Bug Description

set_runtime_main() in agent/conversation_loop.py:392 only passes provider and model to the auxiliary client router, but omits base_url, api_key, and api_mode. For users with a custom: provider (e.g. custom:openclaw-router), this causes _resolve_auto() in agent/auxiliary_client.py to fail at Step 1 because it cannot construct a valid client without base_url.

When Step 1 fails, the auto-detect chain falls through to Step 2 (aggregator/fallback chain), which may route auxiliary tasks (approval, compression, title generation, etc.) to completely different providers instead of the user's configured main provider.

Reproduction

  1. Configure a custom provider in config.yaml:
    model:
      default: glm-5.1
      provider: custom:openclaw-router
      base_url: ''
    custom_providers:
      - name: openclaw-router
        base_url: https://your-domain.com/v1
        model: glm-5.1
        api_key: your-key
  2. Set auxiliary.approval.provider: auto (default)
  3. Trigger a smart approval (e.g. execute_code with a flagged command)
  4. Observe logs: Auxiliary approval: using auto (glm-5.1) at https://api.minimaxi.com/anthropic — the request goes to minimaxi instead of the custom endpoint

Root Cause

In agent/auxiliary_client.py, _resolve_auto() Step 1 (line ~3016):

if runtime_base_url and (main_provider == "custom" or main_provider.startswith("custom:")):
    resolved_provider = "custom"
    explicit_base_url = runtime_base_url

runtime_base_url is always empty because set_runtime_main() (called from conversation_loop.py:392) only sets:

set_runtime_main(
    getattr(agent, "provider", "") or "",
    getattr(agent, "model", "") or "",
)

It does not pass base_url, api_key, or api_mode.

Expected Behavior

Auxiliary tasks should use the user's main provider endpoint when provider: auto is configured, including the correct base_url for custom: providers.

Workaround

Set auxiliary task config explicitly in config.yaml:

auxiliary:
  approval:
    provider: custom
    model: glm-5.1
    base_url: https://your-domain.com/v1
    api_key: your-key

Environment

  • Hermes Agent version: 0.15.1
  • Platform: Linux
  • Provider: custom:openclaw-router (OpenAI-compatible endpoint)

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】set_runtime_main() missing base_url/api_key causes custom: provider fallback to wrong endpoint