From e5327912a65283b80c7a705ae5c919189691704f Mon Sep 17 00:00:00 2001 From: Doron Chen Date: Tue, 11 Aug 2026 16:20:41 +0300 Subject: [PATCH] fix(terminus-2): don't guess litellm provider from "/" in EVAL_MODEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EVAL_MODEL is a bare, opaque handle that may already carry a routing prefix like aws/claude-opus-4-8 (gateways/RULES.md rule 2). The old `if "/" not in model: model = f"openai/{model}"` check treated any "/" as proof of a real litellm provider, so prefixed handles reached litellm unmodified and litellm.get_llm_provider raised BadRequestError: LLM Provider NOT provided (aws is not a litellm provider — its real Bedrock name is bedrock). Force the wire explicitly via llm_kwargs={"custom_llm_provider": "openai"}, which harbor's LiteLLM class forwards straight into every litellm.acompletion() call, regardless of what prefix EVAL_MODEL carries. Signed-off-by: Doron Chen --- containers/agents/terminus-2/run.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/containers/agents/terminus-2/run.py b/containers/agents/terminus-2/run.py index c6d595b2..03b4b698 100644 --- a/containers/agents/terminus-2/run.py +++ b/containers/agents/terminus-2/run.py @@ -98,12 +98,13 @@ async def main(): print("Error: TASK environment variable is empty", file=sys.stderr) sys.exit(1) - model = os.environ.get("EVAL_MODEL", os.environ.get("MODEL", "openai/gpt-4o")) - # litellm needs a provider prefix on the model name (e.g. - # `openai/`); EVAL_MODEL is just the bare model name in our - # framework, so add the openai/ prefix if it's missing. - if "/" not in model: - model = f"openai/{model}" + model = os.environ.get("EVAL_MODEL", os.environ.get("MODEL", "gpt-4o")) + # litellm needs to know which wire to speak. EVAL_MODEL is a bare, + # opaque handle (gateways/RULES.md rule 2) that MAY already carry a + # routing prefix (e.g. `aws/claude-opus-4-8`) which litellm can't + # resolve to a real provider on its own — so force the wire via + # custom_llm_provider instead of guessing from the presence of "/". + llm_kwargs = {"custom_llm_provider": "openai"} api_base = os.environ.get("OPENAI_BASE_URL", "http://model:4000") api_key = os.environ.get("OPENAI_API_KEY", "sk-proxy") os.environ["OPENAI_API_KEY"] = api_key @@ -115,7 +116,11 @@ async def main(): trial_dir = Path(tempfile.mkdtemp(prefix="terminus2-trial-")) agent = Terminus2( - logs_dir=logs_dir, model_name=model, api_base=api_base, temperature=0.7 + logs_dir=logs_dir, + model_name=model, + api_base=api_base, + temperature=0.7, + llm_kwargs=llm_kwargs, ) env = LocalEnvironmentShim(trial_dir) context = AgentContext()