/**
 * Model fallback chain — when primary model fails, try alternatives.
 * Only falls back on 5xx/connection errors, never on 4xx.
 */
import type { OwlCodaConfig } from '../config.js';
export interface FallbackResult {
    response: Response;
    servedBy: string;
    fallbackUsed: boolean;
    attemptedModels: string[];
}
/**
 * Build an ordered fallback chain starting with the requested model,
 * followed by other configured models sorted by:
 *   1. Models on different backends first (cross-provider resilience)
 *   2. Tier priority within same-backend group
 */
export declare function buildFallbackChain(config: OwlCodaConfig, requestedModel: string): string[];
/**
 * Try each model in the chain until one succeeds.
 * fetchFn receives the model ID and should return a Response.
 */
export declare function withFallback(chain: string[], fetchFn: (modelId: string) => Promise<Response>, healthFilter?: (modelId: string) => boolean): Promise<FallbackResult>;
