go: do not respect disabled zen models

This commit is contained in:
Frank
2026-03-26 00:47:23 -04:00
parent 2ad190e482
commit 2d502d6ffe
@@ -132,7 +132,7 @@ export async function handler(
retry, retry,
stickyProvider, stickyProvider,
) )
validateModelSettings(authInfo) validateModelSettings(billingSource, authInfo)
updateProviderKey(authInfo, providerInfo) updateProviderKey(authInfo, providerInfo)
logger.metric({ provider: providerInfo.id }) logger.metric({ provider: providerInfo.id })
@@ -768,9 +768,10 @@ export async function handler(
return "balance" return "balance"
} }
function validateModelSettings(authInfo: AuthInfo) { function validateModelSettings(billingSource: BillingSource, authInfo: AuthInfo) {
if (!authInfo) return if (billingSource === "lite") return
if (authInfo.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled")) if (billingSource === "anonymous") return
if (authInfo!.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled"))
} }
function updateProviderKey(authInfo: AuthInfo, providerInfo: ProviderInfo) { function updateProviderKey(authInfo: AuthInfo, providerInfo: ProviderInfo) {