feat: add OpenAI client wrapper

This commit is contained in:
2026-06-11 10:01:45 +01:00
parent 9d209d5a6b
commit ae61b4ce72
2 changed files with 56 additions and 0 deletions
+17
View File
@@ -1 +1,18 @@
// OpenAI API client wrapper.
import OpenAI from "openai";
/**
* Create an OpenAI SDK client from the loaded config.
* @param {object} config - Config object from loadConfig()
* @param {string} config.openaiApiKey - Required. The OpenAI API key.
* @returns {OpenAI} The configured OpenAI SDK client instance.
*/
export function createOpenAIClient(config) {
if (!config?.openaiApiKey) {
throw new Error("Missing config.openaiApiKey.");
}
return new OpenAI({
apiKey: config.openaiApiKey,
});
}