import { d as readStringValue } from "./string-coerce-CIT1-v_a.js";
import { r as normalizeProviderId } from "./provider-id-Cy-cze0N.js";
import { t as resolveProviderEndpoint } from "./provider-attribution-MWFKwhzN.js";
import "./provider-tools-luqBigBK.js";
import { n as getModelProviderHint } from "./provider-model-shared-DkmyZ3nD.js";
import "./text-runtime-Drz6LusC.js";
import "./model-definitions-Be8dHIF5.js";
import "./provider-catalog-sYaB7iD3.js";
import "./onboard-DGWRDPcz.js";
import "./provider-models-GXApBU7c.js";
//#region extensions/xai/api.ts
function isXaiNativeEndpoint(baseUrl) {
	return typeof baseUrl === "string" && resolveProviderEndpoint(baseUrl).endpointClass === "xai-native";
}
function isXaiModelHint(modelId) {
	return getModelProviderHint(modelId) === "x-ai";
}
function shouldUseXaiResponsesTransport(params) {
	if (params.api !== "openai-completions") return false;
	if (isXaiNativeEndpoint(params.baseUrl)) return true;
	return normalizeProviderId(params.provider) === "xai" && !params.baseUrl;
}
function shouldContributeXaiCompat(params) {
	if (params.model.api !== "openai-completions") return false;
	return isXaiNativeEndpoint(params.model.baseUrl) || isXaiModelHint(params.modelId);
}
function resolveXaiTransport(params) {
	if (!shouldUseXaiResponsesTransport(params)) return;
	return {
		api: "openai-responses",
		baseUrl: readStringValue(params.baseUrl)
	};
}
//#endregion
export { resolveXaiTransport as n, shouldContributeXaiCompat as r, isXaiModelHint as t };
