From 7ed22b9077eac3ed72108928891a2d81fdf92bdc Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Tue, 2 Jun 2026 12:27:53 -0400 Subject: [PATCH] fix(models): accept all models from 9router, remove claude-only filter --- server/services/model-discovery.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/server/services/model-discovery.js b/server/services/model-discovery.js index c7d6628..98ccb01 100644 --- a/server/services/model-discovery.js +++ b/server/services/model-discovery.js @@ -17,8 +17,8 @@ let cacheExpiry = 0; /** * Maps a raw /v1/models entry to the { value, label } shape used by the UI. - * Filters to models that are relevant for Claude routing (id contains 'claude' - * or starts with 'cc/'). + * Accepts all models returned by the endpoint — 9router surfaces only what it + * actually routes, so no client-side filtering is needed. * * @param {Object} entry - Raw model object from /v1/models * @returns {{ value: string, label: string } | null} @@ -27,14 +27,8 @@ function mapModelEntry(entry) { const id = typeof entry?.id === 'string' ? entry.id.trim() : null; if (!id) return null; - // Only surface Claude-family and cc/* (9router) models for the Claude provider. - // Extend this filter if you want to surface all models. - const isClaude = id.toLowerCase().includes('claude') || id.startsWith('cc/'); - if (!isClaude) return null; - - // Build a human-readable label from the id. - // e.g. "cc/claude-sonnet-4-6" → "claude-sonnet-4-6 (9router)" - // "claude-3-5-sonnet-20241022" → "claude-3-5-sonnet-20241022" + // Build a human-readable label: prefer server-supplied name, then id. + // cc/* entries strip the prefix and add a "(9router)" suffix for clarity. let label = entry.name ?? id; if (id.startsWith('cc/')) { label = `${id.slice(3)} (9router)`; @@ -80,7 +74,7 @@ async function fetchModelsFromApi() { const mapped = raw.map(mapModelEntry).filter(Boolean); if (mapped.length === 0) return null; - console.log(`[model-discovery] Loaded ${mapped.length} Claude models from ${url}`); + console.log(`[model-discovery] Loaded ${mapped.length} models from ${url}`); return mapped; } catch (err) { console.warn(`[model-discovery] Failed to fetch ${url}:`, err?.message ?? err);