#!/usr/bin/env node
import "./chunk-DHDDz29n.js";
import { C as getEnvString } from "./logger-Bzi5o47S.js";
import "./fetch-CruohpfF.js";
import "./cloud-CZHXB86j.js";
import "./types-BjfZC_QB.js";
import "./cache-_erPRF2X.js";
import "./util-DhvhJDlT.js";
import "./esm-Bwuh5HXW.js";
import "./pythonUtils-mprm8p4h.js";
import "./genaiTracer-CqNnnXrE.js";
import { t as OpenAiChatCompletionProvider } from "./chat-Bvvgb30H.js";
import "./transform-DFkyOjQ7.js";
import "./openai-D_5h8sBa.js";
import "./util-ImmJ_Dxe.js";
import { n as OpenAiEmbeddingProvider, t as OpenAiCompletionProvider } from "./completion-2IaHHyEe.js";
import { t as OpenAiImageProvider } from "./image-CKdRHN-J.js";

//#region src/providers/cometapi.ts
/**
* CometAPI Image Provider - extends OpenAI Image Provider for CometAPI's image generation models
*/
var CometApiImageProvider = class extends OpenAiImageProvider {
	constructor(modelName, options = {}) {
		super(modelName, {
			...options,
			config: {
				...options.config,
				apiKeyEnvar: "COMETAPI_KEY",
				apiBaseUrl: "https://api.cometapi.com/v1"
			}
		});
	}
	getApiKey() {
		if (this.config?.apiKey) return this.config.apiKey;
		return getEnvString("COMETAPI_KEY");
	}
	getApiUrlDefault() {
		return "https://api.cometapi.com/v1";
	}
};
/**
* Factory for creating CometAPI providers using OpenAI-compatible endpoints.
*/
function createCometApiProvider(providerPath, options = {}) {
	const splits = providerPath.split(":");
	const type = splits[1];
	const modelName = splits.slice(2).join(":");
	const openaiOptions = {
		...options,
		config: {
			...options.config || {},
			apiBaseUrl: "https://api.cometapi.com/v1",
			apiKeyEnvar: "COMETAPI_KEY"
		}
	};
	if (type === "chat") return new OpenAiChatCompletionProvider(modelName, openaiOptions);
	else if (type === "completion") return new OpenAiCompletionProvider(modelName, openaiOptions);
	else if (type === "embedding" || type === "embeddings") return new OpenAiEmbeddingProvider(modelName, openaiOptions);
	else if (type === "image") return new CometApiImageProvider(modelName, openaiOptions);
	return new OpenAiChatCompletionProvider(splits.slice(1).join(":"), openaiOptions);
}

//#endregion
export { createCometApiProvider };
//# sourceMappingURL=cometapi-CHlpzlEb.js.map