import { createOpenAI, openai } from "@ai-sdk/openai";

//#region src/internal/agents/openai-provider.ts
let customFactory = null;
let defaultModel = "gpt-5";
/**
* Configure the OpenAI provider factory.
*
* When a base URL is provided, the factory will use that endpoint for all
* subsequent model requests. Passing undefined resets to the default
* configuration bundled with the SDK.
*
* When a default model is provided, it will be used as the default for all
* subsequent getOpenAIModel() calls. Passing undefined resets to "gpt-5".
*/
function configureOpenAIProvider({ baseUrl, defaultModel: model }) {
	if (baseUrl) customFactory = createOpenAI({ baseURL: baseUrl });
	else customFactory = null;
	if (model !== void 0) defaultModel = model;
}
/**
* Retrieve a configured OpenAI language model.
* If no model is specified, uses the configured default model (gpt-5).
*/
function getOpenAIModel(model) {
	const factory = customFactory ?? openai;
	return factory(model ?? defaultModel);
}

//#endregion
export { configureOpenAIProvider, getOpenAIModel };
//# sourceMappingURL=openai-provider-CqpHDwSr.js.map