#!/usr/bin/env node
import { C as getEnvString } from "./logger-BHK-IvoX.js";

//#region src/providers/openai/index.ts
var OpenAiGenericProvider = class {
	modelName;
	config;
	env;
	constructor(modelName, options = {}) {
		const { config, id, env } = options;
		this.env = env;
		this.modelName = modelName;
		this.config = config || {};
		this.id = id ? () => id : this.id;
	}
	id() {
		return this.config.apiHost || this.config.apiBaseUrl ? this.modelName : `openai:${this.modelName}`;
	}
	toString() {
		return `[OpenAI Provider ${this.modelName}]`;
	}
	getOrganization() {
		return this.config.organization || this.env?.OPENAI_ORGANIZATION || getEnvString("OPENAI_ORGANIZATION");
	}
	getApiUrlDefault() {
		return "https://api.openai.com/v1";
	}
	getApiUrl() {
		const apiHost = this.config.apiHost || this.env?.OPENAI_API_HOST || getEnvString("OPENAI_API_HOST");
		if (apiHost) return `https://${apiHost}/v1`;
		return this.config.apiBaseUrl || this.env?.OPENAI_API_BASE_URL || this.env?.OPENAI_BASE_URL || getEnvString("OPENAI_API_BASE_URL") || getEnvString("OPENAI_BASE_URL") || this.getApiUrlDefault();
	}
	getApiKey() {
		return this.config.apiKey || (this.config?.apiKeyEnvar ? getEnvString(this.config.apiKeyEnvar) || this.env?.[this.config.apiKeyEnvar] : void 0) || this.env?.OPENAI_API_KEY || getEnvString("OPENAI_API_KEY");
	}
	requiresApiKey() {
		return this.config.apiKeyRequired ?? true;
	}
	async callApi(_prompt, _context, _callApiOptions) {
		throw new Error("Not implemented");
	}
};

//#endregion
export { OpenAiGenericProvider as t };
//# sourceMappingURL=openai-D86NWRzF.js.map