diff --git a/gateway/run.py b/gateway/run.py index 7e07d06b6..3c2abd834 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -2029,21 +2029,8 @@ class GatewayRunner: ) return - # Read model from config (same as _run_agent) - model = os.getenv("HERMES_MODEL") or os.getenv("LLM_MODEL") or "anthropic/claude-opus-4.6" - try: - import yaml as _y - _cfg_path = _hermes_home / "config.yaml" - if _cfg_path.exists(): - with open(_cfg_path, encoding="utf-8") as _f: - _cfg = _y.safe_load(_f) or {} - _model_cfg = _cfg.get("model", {}) - if isinstance(_model_cfg, str): - model = _model_cfg - elif isinstance(_model_cfg, dict): - model = _model_cfg.get("default", model) - except Exception: - pass + # Read model from config via shared helper + model = _resolve_gateway_model() # Determine toolset (same logic as _run_agent) default_toolset_map = { @@ -3128,21 +3115,7 @@ class GatewayRunner: except Exception: pass - model = os.getenv("HERMES_MODEL") or os.getenv("LLM_MODEL") or "anthropic/claude-opus-4.6" - - try: - import yaml as _y - _cfg_path = _hermes_home / "config.yaml" - if _cfg_path.exists(): - with open(_cfg_path, encoding="utf-8") as _f: - _cfg = _y.safe_load(_f) or {} - _model_cfg = _cfg.get("model", {}) - if isinstance(_model_cfg, str): - model = _model_cfg - elif isinstance(_model_cfg, dict): - model = _model_cfg.get("default", model) - except Exception: - pass + model = _resolve_gateway_model() try: runtime_kwargs = _resolve_runtime_agent_kwargs()