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
This commit is contained in:
@@ -10,6 +10,15 @@
|
|||||||
# assumed, since guessing one could silently pick something you don't
|
# 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.
|
# 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
|
# 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
|
# 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
|
# word. This is the most expensive tier in latency and real dollar
|
||||||
@@ -63,7 +72,7 @@ payload = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
url.rstrip("/") + "/chat/completions" if not url.rstrip("/").endswith("/chat/completions") else url,
|
url,
|
||||||
data=json.dumps(payload).encode(),
|
data=json.dumps(payload).encode(),
|
||||||
headers={
|
headers={
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
Reference in New Issue
Block a user