2026-02-03 11:28:22 +09:00
|
|
|
import { z } from "zod"
|
|
|
|
|
|
|
|
|
|
export const RuntimeFallbackConfigSchema = z.object({
|
2026-02-11 16:59:26 -05:00
|
|
|
/** Enable runtime fallback (default: true) */
|
|
|
|
|
enabled: z.boolean().optional(),
|
|
|
|
|
/** HTTP status codes that trigger fallback (default: [429, 503, 529]) */
|
|
|
|
|
retry_on_errors: z.array(z.number()).optional(),
|
|
|
|
|
/** Maximum fallback attempts per session (default: 3) */
|
|
|
|
|
max_fallback_attempts: z.number().min(1).max(20).optional(),
|
|
|
|
|
/** Cooldown in seconds before retrying a failed model (default: 60) */
|
|
|
|
|
cooldown_seconds: z.number().min(0).optional(),
|
2026-02-12 18:12:38 -05:00
|
|
|
/** Session-level timeout in seconds to advance fallback when provider hangs (default: 30, 0 to disable) */
|
|
|
|
|
timeout_seconds: z.number().min(0).optional(),
|
2026-02-11 16:59:26 -05:00
|
|
|
/** Show toast notification when switching to fallback model (default: true) */
|
|
|
|
|
notify_on_fallback: z.boolean().optional(),
|
2026-02-03 11:28:22 +09:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export type RuntimeFallbackConfig = z.infer<typeof RuntimeFallbackConfigSchema>
|