From bd7f955e4e8815623ade91553d7425f7283c9c39 Mon Sep 17 00:00:00 2001 From: Oskar Kapala Date: Thu, 28 May 2026 13:07:58 +0200 Subject: [PATCH] fix+debug(planner-agent): use base_url (not api_base) for litellm.acompletion, add print [TEMP] litellm.acompletion() has base_url as a named param; api_base only works via **kwargs fallback path. Switching to base_url ensures the value lands correctly in completion_kwargs and reaches the ollama provider. Print() added (not logger) so base_url is always visible in docker logs regardless of log level. Co-Authored-By: Claude Sonnet 4.6 --- services/planner-agent/src/llm_router.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/planner-agent/src/llm_router.py b/services/planner-agent/src/llm_router.py index b820803..5213ad6 100644 --- a/services/planner-agent/src/llm_router.py +++ b/services/planner-agent/src/llm_router.py @@ -337,13 +337,16 @@ class LLMRouter: **cfg.extra_kwargs, } if cfg.api_base: - kwargs["api_base"] = cfg.api_base + # Use "base_url" — the officially named param of litellm.acompletion(). + # "api_base" also works (via **kwargs → kwargs.get("api_base")), but + # "base_url" is what acompletion() maps directly into completion_kwargs. + kwargs["base_url"] = cfg.api_base - # DEBUG — temporary, remove after confirming OLLAMA_API_BASE routing - logger.info( - "[llm_router][DEBUG] calling litellm model=%s api_base=%s", - cfg.name, - kwargs.get("api_base", ""), + # DEBUG [TEMP] — print() to stdout so it's always visible regardless of log level + print( + f"[llm_router][DEBUG] litellm call: model={cfg.name!r}" + f" base_url={kwargs.get('base_url', '')!r}", + flush=True, ) try: