Degraded Catalog Guard (sync-models/degradedLocalCatalog.ts)

omniroute-multiuser · src/app/api/providers/[id]/sync-models/degradedLocalCatalog.ts · typescript · MIT
ai, lang:typescript, tag:validation, tag:providers

Distinguishes genuinely failed model catalogs from intentionally standalone local providers. Reuse when handling AI provider model sync responses.

// Source: https://github.com/AiPharmasy/omniroute-multiuser | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * #5460 (Reka) + #5465 (t3.chat) — Distinguish a genuinely degraded
 * `local_catalog` models response (remote model discovery failed → the sync
 * route surfaces a 502) from a provider whose local catalog is its INTENDED and
 * only discovery source (reka, qwen-oauth, embedding/rerank providers like
 * voyage-ai/jina-ai, web-cookie providers like t3-web).
 *
 * The models route tags the latter with `intentional: true`. Before this guard,
 * model-sync 502'd on ANY `local_catalog` source, so the Import/Sync button
 * failed every single time for those providers even with a valid key/cookie.
 *
 * Dependency-free leaf

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key