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",