Allow configuring OpenAI base URL

This commit is contained in:
Remi
2025-10-16 11:15:31 +02:00
parent d9ca19404a
commit 18f25998f5
5 changed files with 17 additions and 3 deletions

View File

@@ -4,11 +4,14 @@ import fs from "node:fs";
import { normalizeRadioPhrase } from "../../shared/utils/radioSpeech";
import { getServerRuntimeConfig } from "./runtimeConfig";
const { openaiKey, openaiProject, llmModel, ttsModel } = getServerRuntimeConfig();
const { openaiKey, openaiProject, openaiBaseUrl, llmModel, ttsModel } = getServerRuntimeConfig();
const normalizeClientOptions: ConstructorParameters<typeof OpenAI>[0] = { apiKey: openaiKey };
if (openaiProject) {
normalizeClientOptions.project = openaiProject;
}
if (openaiBaseUrl) {
normalizeClientOptions.baseURL = openaiBaseUrl;
}
export const normalize = new OpenAI(normalizeClientOptions);