From 1fc1f87be5a2c06bdd80ed1ec54f5081b930816f Mon Sep 17 00:00:00 2001 From: Daveswo <969dwi@gmail.com> Date: Tue, 18 Aug 2026 03:07:40 -0400 Subject: [PATCH] Fix 80-remote-api.sh: stop auto-appending /chat/completions, take FX_REMOTE_API_URL exactly as given -- found by testing live against a real third-party API (a local FastAPI service) whose endpoint path did not match the guessed OpenAI convention --- contrib/fx/sources.d/80-remote-api.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/fx/sources.d/80-remote-api.sh b/contrib/fx/sources.d/80-remote-api.sh index fc44d4d..af8d316 100755 --- a/contrib/fx/sources.d/80-remote-api.sh +++ b/contrib/fx/sources.d/80-remote-api.sh @@ -10,6 +10,15 @@ # assumed, since guessing one could silently pick something you don't # want to pay for. Silently no-ops if any of the three is missing. # +# FX_REMOTE_API_URL is the exact URL to POST to -- no "/chat/completions" +# auto-appended. An earlier version guessed that suffix onto whatever +# base URL was given, which works for OpenAI/OpenRouter/Groq's actual +# convention but broke, silently, against a real third-party API that +# used a different path (a local FastAPI service with a plain "/chat" +# endpoint, not "/chat/.../completions" -- confirmed live: the guessed +# URL 404'd, the real one worked). Silent failure on a wrong guess is +# worse than requiring the full URL up front. +# # Numbered 80: after the free local-LLM source (70) and before # 90-team-shared.sh, which is a human-curated source and gets the final # word. This is the most expensive tier in latency and real dollar @@ -63,7 +72,7 @@ payload = { } req = urllib.request.Request( - url.rstrip("/") + "/chat/completions" if not url.rstrip("/").endswith("/chat/completions") else url, + url, data=json.dumps(payload).encode(), headers={ "Content-Type": "application/json",