Feat: Add configurable AI provider base URL flag and update documentation (#3059)

* feat: add FLAG_ALLOW_UNSAFE_AI_BASE_URL for configurable AI provider base URLs

* feat: add FLAG_ALLOW_UNSAFE_AI_BASE_URL documentation

* fix: remove AI_ALLOWED_BASE_URLS from documentation and environment variable reference

---------

Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
This commit is contained in:
SirSKillz
2026-05-13 19:01:37 -06:00
committed by GitHub
parent 6c4a4b2aa5
commit c71f3b0b92
8 changed files with 20 additions and 28 deletions
+6 -2
View File
@@ -27,6 +27,7 @@ import {
resumePatchProposalToolOutputSchema,
} from "@reactive-resume/ai/tools/patch-proposal";
import { AI_PROVIDER_DEFAULT_BASE_URLS, aiProviderSchema } from "@reactive-resume/ai/types";
import { env } from "@reactive-resume/env/server";
import { resumeAnalysisOutputSchema, resumeAnalysisSchema } from "@reactive-resume/schema/resume/analysis";
import { applyResumePatches } from "@reactive-resume/utils/resume/patch";
import { isPrivateOrLoopbackHost, parseUrl } from "@reactive-resume/utils/url-security.node";
@@ -79,9 +80,12 @@ function resolveBaseUrl(input: GetModelInput): string {
const parsedBaseURL = parseUrl(baseURL);
if (!parsedBaseURL) throw new Error("INVALID_AI_BASE_URL");
if (parsedBaseURL.protocol !== "https:") throw new Error("INVALID_AI_BASE_URL");
if (parsedBaseURL.username || parsedBaseURL.password) throw new Error("INVALID_AI_BASE_URL");
if (isPrivateOrLoopbackHost(parsedBaseURL.hostname)) throw new Error("INVALID_AI_BASE_URL");
if (!env.FLAG_ALLOW_UNSAFE_AI_BASE_URL) {
if (parsedBaseURL.protocol !== "https:") throw new Error("INVALID_AI_BASE_URL");
if (isPrivateOrLoopbackHost(parsedBaseURL.hostname)) throw new Error("INVALID_AI_BASE_URL");
}
return parsedBaseURL.toString();
}