mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-08 23:25:16 +00:00
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.
This commit is contained in:
parent
897005dac8
commit
e12b8e31d7
1 changed files with 7 additions and 2 deletions
|
|
@ -73,9 +73,14 @@ async function fetchAndCachePricing(): Promise<Map<string, ModelCosts>> {
|
|||
const pricing = new Map<string, ModelCosts>()
|
||||
|
||||
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 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue