const require_logger = require("./logger-DuG3amVa.cjs");
require("./fetch-Hdu2Q-w3.cjs");
require("./cache-JYoIjHBA.cjs");
const require_chat = require("./chat-Bl2LfE5B.cjs");
const require_embedding = require("./embedding-B-5e24ct.cjs");
const require_completion = require("./completion-DJvHNUr_.cjs");
const require_image = require("./image-Bc0g2zbc.cjs");
//#region src/providers/cometapi.ts
/**
* CometAPI Image Provider - extends OpenAI Image Provider for CometAPI's image generation models
*/
var CometApiImageProvider = class extends require_image.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 require_logger.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 require_chat.OpenAiChatCompletionProvider(modelName, openaiOptions);
	else if (type === "completion") return new require_completion.OpenAiCompletionProvider(modelName, openaiOptions);
	else if (type === "embedding" || type === "embeddings") return new require_embedding.OpenAiEmbeddingProvider(modelName, openaiOptions);
	else if (type === "image") return new CometApiImageProvider(modelName, openaiOptions);
	return new require_chat.OpenAiChatCompletionProvider(splits.slice(1).join(":"), openaiOptions);
}
//#endregion
exports.createCometApiProvider = createCometApiProvider;

//# sourceMappingURL=cometapi-BA9SDdh1.cjs.map