import { a as normalizeLowercaseStringOrEmpty } from "../../string-coerce-mnp54Vah.js";
import { t as applyModelCompatPatch } from "../../provider-model-compat-C5TQcf5S.js";
import "../../string-coerce-runtime-CEGJWkQ_.js";
import "../../provider-model-shared-7V5A7w8e.js";
import { t as defineSingleProviderPluginEntry } from "../../provider-entry-9Jv80C_J.js";
import { n as VENICE_DEFAULT_MODEL_REF } from "../../models-B7iq7qwK.js";
import { t as buildVeniceProvider } from "../../provider-catalog-B2uM4AEd.js";
import { t as applyVeniceConfig } from "../../onboard-DuX21vhU.js";
import { t as createVeniceDeepSeekV4Wrapper } from "../../stream-6V_46c-S.js";
//#region extensions/venice/index.ts
const PROVIDER_ID = "venice";
const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = [
	"minLength",
	"maxLength",
	"minItems",
	"maxItems",
	"minContains",
	"maxContains"
];
function applyXaiModelCompat(model) {
	return applyModelCompatPatch(model, {
		toolSchemaProfile: "xai",
		unsupportedToolSchemaKeywords: [...XAI_UNSUPPORTED_SCHEMA_KEYWORDS],
		nativeWebSearchTool: true,
		toolCallArgumentsEncoding: "html-entities"
	});
}
function isXaiBackedVeniceModel(modelId) {
	return normalizeLowercaseStringOrEmpty(modelId).includes("grok");
}
var venice_default = defineSingleProviderPluginEntry({
	id: PROVIDER_ID,
	name: "Venice Provider",
	description: "Bundled Venice provider plugin",
	provider: {
		label: "Venice",
		docsPath: "/providers/venice",
		auth: [{
			methodId: "api-key",
			label: "Venice AI API 密钥",
			hint: "隐私优先（无审查模型）",
			optionKey: "veniceApiKey",
			flagName: "--venice-api-key",
			envVar: "VENICE_API_KEY",
			promptMessage: "输入 Venice AI API 密钥",
			defaultModel: VENICE_DEFAULT_MODEL_REF,
			applyConfig: (cfg) => applyVeniceConfig(cfg),
			noteMessage: [
				"Venice AI 提供注重隐私的推理（使用无审查模型）。",
				"在此获取 API 密钥: https://venice.ai/settings/api",
				"支持 'private' (完全私有) 和 'anonymized' (代理) 模式。"
			].join("\n"),
			noteTitle: "Venice AI",
			wizard: { groupLabel: "Venice AI" }
		}],
		catalog: { buildProvider: buildVeniceProvider },
		normalizeResolvedModel: ({ modelId, model }) => isXaiBackedVeniceModel(modelId) ? applyXaiModelCompat(model) : void 0,
		wrapStreamFn: (ctx) => createVeniceDeepSeekV4Wrapper(ctx.streamFn, ctx.thinkingLevel)
	}
});
//#endregion
export { venice_default as default };
