OpenAI returns a 503. Every LLM call in your app fails with it, and your users stare at a spinner while the status page catches up.
Model fallback is the fix everyone reaches for: if the primary model fails, send the call to a backup model on another provider. It sounds like a try/catch . In practice there are four details that decide whether it helps or makes things worse.
This post walks through those details and shows how to set up LLM fallback in TypeScript with VernLLM , using GPT-6.2 Sol as the primary and Gemini 4 Neon as the backup. No gateway, no proxy: it runs in your process.
Why a try/catch fallback is not enough
try { return await openai . chat . completions . create ( { model : 'gpt-6.2-sol' , messages } ) ; } catch { return await gemini . models . generateContent ( { model : 'gemini-4-neon' , contents } ) ; }
Enter fullscreen mode
Exit fullscreen mode
This is where most fallback code starts. It has four problems:
It gives up on the primary too early. A single 503 is often a blip.…