Skip to content

The agent that grows with you

fix(doctor): accept vendor/model slugs for openai-api on a custom endpoint

bergc2b590841cdc
diff --git a/hermes_cli/doctor_config.py b/hermes_cli/doctor_config.py
index d488aebe7a0..cdf959f0aac 100644
--- a/hermes_cli/doctor_config.py
+++ b/hermes_cli/doctor_config.py
@@ -246,6 +246,12 @@ def _validate_model_config(config_path, issues: list) -> None:
f"Fix: run 'hermes config set model.provider <valid_provider>'", issues)
policy_id = str(runtime_provider or catalog_provider or "").strip().lower()
accepts_vendor_slug = policy_id in _VENDOR_SLUG_PROVIDERS or policy_id == "custom" or policy_id.startswith("custom:")
+ # openai-api pointed at a non-OpenAI endpoint (local router, proxy) is an aggregator in all but name:
+ # the router owns the model namespace, so vendor/model slugs are the correct IDs there.
+ model_base_url = str(model_section.get("base_url") or "").strip()
+ if policy_id == "openai-api" and model_base_url:
+ from utils import base_url_host_matches
+ accepts_vendor_slug = accepts_vendor_slug or not base_url_host_matches(model_base_url, "api.openai.com")
if default_model and "/" in default_model and policy_id and not accepts_vendor_slug:
check_warn(f"model.default '{default_model}' uses a vendor/model slug but provider is '{provider_raw}'",
"(vendor-prefixed slugs belong to aggregators like openrouter)")
diff --git a/tests/hermes_cli/test_doctor.py b/tests/hermes_cli/test_doctor.py
index fddb011581f..b9e86822355 100644
--- a/tests/hermes_cli/test_doctor.py
+++ b/tests/hermes_cli/test_doctor.py
@@ -733,6 +733,58 @@ def test_run_doctor_accepts_vendor_slugs_for_named_custom_provider(monkeypatch,
assert "Either set model.provider to 'openrouter', or drop the vendor prefix." not in out
+ ("base_url", "expects_warning"),
+ [
+ ("http://localhost:20128/v1", False),
+ ("https://api.openai.com/v1", True),
+ ],
+)
+def test_run_doctor_vendor_slug_policy_for_openai_api_endpoint(
+ monkeypatch, tmp_path, base_url, expects_warning
+):
+ """openai-api behind a custom router owns a vendor/model namespace (#69912); the real
+ OpenAI endpoint keeps the warning."""
+ home = tmp_path / ".hermes"
+ home.mkdir(parents=True, exist_ok=True)
+ (home / "config.yaml").write_text(
+ "model:\n"
+ " provider: openai-api\n"
+ " default: nvidia/z-ai/glm-5.2\n"
+ f" base_url: {base_url}\n",
+ encoding="utf-8",
+ )
+
+ monkeypatch.setattr(doctor_mod, "HERMES_HOME", home)
+ monkeypatch.setattr(doctor_mod, "PROJECT_ROOT", tmp_path / "project")
+ monkeypatch.setattr(doctor_mod, "_DHH", str(home))
+ (tmp_path / "project").mkdir(exist_ok=True)
+
+ fake_model_tools = types.SimpleNamespace(
+ check_tool_availability=lambda *a, **kw: ([], []),
+ TOOLSET_REQUIREMENTS={},
+ )
+ monkeypatch.setitem(sys.modules, "model_tools", fake_model_tools)
+
+ try:
+ from hermes_cli import auth as _auth_mod
+ monkeypatch.setattr(_auth_mod, "get_nous_auth_status_local", lambda: {})
+ monkeypatch.setattr(_auth_mod, "get_codex_auth_status", lambda: {})
+ monkeypatch.setattr(_auth_mod, "get_xai_oauth_auth_status", lambda: {})
+ except Exception:
+ pass
+
+ buf = io.StringIO()
+ with contextlib.redirect_stdout(buf):
+ doctor_mod.run_doctor(Namespace(fix=False))
+
+ warning = (
+ "model.default 'nvidia/z-ai/glm-5.2' uses a vendor/model slug "
+ "but provider is 'openai-api'"
+ )
+ assert (warning in buf.getvalue()) is expects_warning
+
+
def test_run_doctor_accepts_kimi_coding_cn_provider(monkeypatch, tmp_path):