diff --git a/src/api/providers/openai.ts b/src/api/providers/openai.ts index d71a51f0a90..2164e0dc56d 100644 --- a/src/api/providers/openai.ts +++ b/src/api/providers/openai.ts @@ -17,8 +17,7 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler { constructor(options: ApiHandlerOptions) { this.options = options // Azure API shape slightly differs from the core API shape: https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai - const urlHost = new URL(this.options.openAiBaseUrl ?? "").host - if (urlHost === "azure.com" || urlHost.endsWith(".azure.com")) { + if (this.options.openAiBaseUrl?.toLowerCase().includes("azure.com")) { this.client = new AzureOpenAI({ baseURL: this.options.openAiBaseUrl, apiKey: this.options.openAiApiKey,