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 <noreply@anthropic.com>
This commit is contained in:
Oskar Kapala 2026-05-28 13:07:58 +02:00
parent 99200e6690
commit bd7f955e4e

View file

@ -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", "<not set>"),
# 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', '<not set>')!r}",
flush=True,
)
try: