//#region src/pricing.ts
/**
* Compute cost from raw token usage and a host rate table.
* Returns null when the rate table is missing or non-finite.
*/
function computeCost(usage, hostRateTable) {
	if (!Number.isFinite(hostRateTable.promptUsdPerMillion) || !Number.isFinite(hostRateTable.completionUsdPerMillion)) return null;
	const promptTokens = usage.promptTokens ?? 0;
	const completionTokens = usage.completionTokens ?? 0;
	return promptTokens / 1e6 * hostRateTable.promptUsdPerMillion + completionTokens / 1e6 * hostRateTable.completionUsdPerMillion;
}
//#endregion
export { computeCost };
