A custom provider whose API has no /v1 listed its models under
base/v1/models only; every models fetch then rewrote the saved chat and
responses URLs to …/v1 (fixV1), so the user's removal of /v1 came back each
time and requests went to /v1/chat/completions. fixV1 now POSTs an empty body
to base/chat/completions (or /responses) first; any answer but 404/405 (a 400
for the model, a 401) means the URL as typed has its endpoint and it is kept.
Only a base whose endpoint is missing and whose models sit under /v1 gets it.
Run (mote): new TestFetchKeepsTypedBaseThatServesChat red on the old code
(chat changed to …/v1), green after; go test ./internal/provider ok;
TestFetchAddsMissingV1 and TestArkBaseKeepsItsPath unchanged; go vet darwin,
linux, windows. Not tried: a real vendor; the GUI is unchanged (respellURL
only fills an empty URL), so no GUI run.
Propagate providers.json read and decode errors through catalog writes. Only a missing file allows first-use creation; failed reads preserve the original file.