From 6afcebababe6e826b576272cecddf633dbbd1b2b Mon Sep 17 00:00:00 2001 From: nyatoru Date: Tue, 24 Feb 2026 17:05:23 +0700 Subject: [PATCH] feat: use provider node type for active provider resolution --- src/app/api/v1/models/route.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/api/v1/models/route.ts b/src/app/api/v1/models/route.ts index d607a1d0c7..4bf1dce795 100644 --- a/src/app/api/v1/models/route.ts +++ b/src/app/api/v1/models/route.ts @@ -183,12 +183,16 @@ export async function GET(request: Request) { console.log("Could not fetch provider nodes"); } - // Build map of provider ID to prefix for compatible providers + // Build map of provider node ID to prefix and type for compatible providers const providerIdToPrefix: Record = {}; + const nodeIdToProviderType: Record = {}; for (const node of providerNodes) { if (node.prefix) { providerIdToPrefix[node.id] = node.prefix; } + if (node.type) { + nodeIdToProviderType[node.id] = node.type; + } } // Get combos @@ -345,12 +349,14 @@ export async function GET(request: Request) { const alias = prefix || providerIdToAlias[providerId] || providerId; const canonicalProviderId = FALLBACK_ALIAS_TO_PROVIDER[alias] || providerId; - // Only include if provider is active — check alias, canonical ID, or raw providerId - // (raw check needed for OpenAI-compatible providers whose ID isn't in the alias map) + // Only include if provider is active — check alias, canonical ID, raw providerId, + // or the parent provider type (for compatible providers whose node ID is a UUID) + const parentProviderType = nodeIdToProviderType[providerId]; if ( !activeAliases.has(alias) && !activeAliases.has(canonicalProviderId) && - !activeAliases.has(providerId) + !activeAliases.has(providerId) && + !(parentProviderType && activeAliases.has(parentProviderType)) ) continue;