AI Gateway can now escalate a decision request to a fallback model when the primary model's answer trips a confidence condition you set .
Conditions can be combined, so an escalation can depend on more than one signal. The plain model names you already list in models keep catching outright errors, so existing fallbacks are unaffected. Confidence conditions cover Choice and Score questions. Boolean questions escalate on a probability range instead.
Set the fallback by adding one conditional object to providerOptions.gateway.models . Requests without it keep their existing behavior.
import { gateway } from '@ai-sdk/gateway' ;
import { experimental_decide as decide } from 'ai' ;
const result = await decide ( {
model : gateway .…