diff --git a/plugins/festinger/festinger/main.py b/plugins/festinger/festinger/main.py index c4fce01..1362650 100644 --- a/plugins/festinger/festinger/main.py +++ b/plugins/festinger/festinger/main.py @@ -727,7 +727,13 @@ async def _route_agent_chat( "content-type": "application/json", } else: - oai_upstream = agent_model.base_url or cfg.get("upstream_openai", "https://api.openai.com") + # call_openai() appends /v1/chat/completions to whatever upstream it gets. + # DB base_url often ends in /v1 (correct for the OpenAI SDK used by the + # resolution job), so strip that suffix to avoid /v1/v1/chat/completions. + raw_base = agent_model.base_url or cfg.get("upstream_openai", "https://api.openai.com") + oai_upstream = raw_base.rstrip("/") + if oai_upstream.endswith("/v1"): + oai_upstream = oai_upstream[:-3] oai_headers = { "authorization": f"Bearer {agent_model.api_key or 'lm-studio'}", "content-type": "application/json",