Optional excludeProvider: stringProvider to omit from the chain (typically the primary provider that already failed).
An array of { provider, model? } entries ready for use as
GenerateTextOptions.fallbackProviders.
// Primary is anthropic — build fallback chain from remaining providers
const chain = buildFallbackChain('anthropic');
// => [{ provider: 'openai', model: 'gpt-4o-mini' }, { provider: 'openrouter' }, ...]
Auto-discovers available LLM providers from well-known environment variables and builds an ordered fallback chain.
Each entry in the returned array contains a provider identifier and an optional cheap model suitable for fallback use. Providers are ordered by general availability and cost-effectiveness:
gpt-4o-mini)claude-haiku-4-5-20251001)gemini-2.5-flash)