From e12b8e31d7cb9a8dc556ed4c38d30333c291aee4 Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Thu, 16 Apr 2026 01:25:15 -0700 Subject: [PATCH] fix: load all 2,659 LiteLLM models, not just 192 The pricing fetcher was filtering out every model name containing '/' or '.', which discarded provider-prefixed entries like 'anthropic/claude-opus-4-6' and version-suffixed ones like 'gemini-2.0-flash-001'. That dropped 93% of LiteLLM's catalog (2,467 of 2,659 models), leaving most non-Anthropic models priced at $0. Now we load every entry and additionally index each one under its stripped name so 'claude-opus-4-6' resolves whether or not the caller includes the provider prefix. --- src/models.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/models.ts b/src/models.ts index 1af8859..4a53112 100644 --- a/src/models.ts +++ b/src/models.ts @@ -73,9 +73,14 @@ async function fetchAndCachePricing(): Promise> { const pricing = new Map() for (const [name, entry] of Object.entries(data)) { - if (name.includes('/') || name.includes('.')) continue const costs = parseLiteLLMEntry(entry) - if (costs) pricing.set(name, costs) + if (!costs) continue + pricing.set(name, costs) + // Also index by stripped name so lookups work without provider prefix: + // 'anthropic/claude-opus-4-6' is also queryable as 'claude-opus-4-6'. + // First write wins so direct-provider entries take precedence over re-hosters. + const stripped = name.replace(/^[^/]+\//, '') + if (stripped !== name && !pricing.has(stripped)) pricing.set(stripped, costs) } await mkdir(getCacheDir(), { recursive: true })