Optional excludeProvider: stringProvider to omit from the chain (typically the
primary provider that already failed).
Every leg pins cache: false: failover hops are sporadic one-shots, so
prompt-cache writes on a rescue leg almost never earn their reads back
(see FallbackProviderEntry.cache). Callers wanting a cached hop
supply their own chain with a per-entry ttl.
An array of { provider, model?, cache } entries ready for use as
GenerateTextOptions.fallbackProviders.
// Primary is anthropic: build fallback chain from remaining providers
const chain = buildFallbackChain('anthropic');
// => [{ provider: 'openai', model: 'gpt-5.6-sol' }, { provider: 'openrouter', model: 'openai/gpt-5.6-sol' }, ...]
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 model suitable for fallback use. Providers are ordered by general availability; the OpenAI legs pin
gpt-5.6-sol— the platform's quality floor for failover traffic. A primary-provider outage must not silently downgrade user-facing output to a mini-tier model:gpt-5.6-sol)claude-sonnet-5-5at effortlow, with 1024 tokens of output headroom for thinking)openai/gpt-5.6-sol)gemini-3.1-pro-preview)