Merge pull request #6004 from gukoff/support-azure-foundry-endpoints

feat: Normalize modern Microsoft Foundry Responses API endpoints
This commit is contained in:
Mario Zechner
2026-06-24 10:38:57 +02:00
committed by GitHub
4 changed files with 23 additions and 4 deletions
+10 -2
View File
@@ -180,12 +180,20 @@ function normalizeAzureBaseUrl(baseUrl: string): string {
}
const isAzureHost =
url.hostname.endsWith(".openai.azure.com") || url.hostname.endsWith(".cognitiveservices.azure.com");
url.hostname.endsWith(".openai.azure.com") ||
url.hostname.endsWith(".cognitiveservices.azure.com") ||
url.hostname.endsWith(".ai.azure.com");
const normalizedPath = url.pathname.replace(/\/+$/, "");
// Ensure Azure hosts have /openai/v1 as base path so the AzureOpenAI SDK
// can append /deployments/<model>/... and ?api-version=v1 correctly.
if (isAzureHost && (normalizedPath === "" || normalizedPath === "/" || normalizedPath === "/openai")) {
if (
isAzureHost &&
(normalizedPath === "" ||
normalizedPath === "/" ||
normalizedPath === "/openai" ||
normalizedPath === "/openai/v1/responses")
) {
url.pathname = "/openai/v1";
url.search = "";
}