mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-22 07:02:16 +03:00
fix(pricing): 3 dead entries in LITELLM_PROVIDER_MAP silently drop synced pricing (#10636)
Merged — locally validated (28/28 focused pricing-sync tests, gates green). Excellent systematic audit of the whole alias map, not just the one you hit. Thanks!
This commit is contained in:
@@ -105,10 +105,22 @@ const LITELLM_PROVIDER_MAP: Record<string, string[]> = {
|
||||
vertex_ai: ["gemini"],
|
||||
"vertex_ai-anthropic_models": ["anthropic"],
|
||||
google: ["gemini"],
|
||||
deepseek: ["if"],
|
||||
// Registry ALIAS, not registry id — pricingSync writes/reads are keyed by
|
||||
// alias everywhere else (see getPricingForModel(provider, model) callers).
|
||||
// Four of these previously used the provider's `id` string, which is not a
|
||||
// valid pricing-lookup key for that provider and, worse, for `deepseek` a
|
||||
// real (but wrong) alias existed under that string — silently routing
|
||||
// DeepSeek's synced pricing onto Qoder (open-sse/config/providers/registry/
|
||||
// qoder/index.ts, alias "if", an unrelated third-party API) instead of
|
||||
// DeepSeek (alias "ds"). `bedrock`/`bedrock_converse` and `cloudflare`
|
||||
// pointed at their provider's `id` ("kiro", "cloudflare-ai") rather than
|
||||
// its `alias` ("kr", "cf") — not wrong-provider, just a dead key nothing
|
||||
// downstream ever looks up, so those two providers silently never received
|
||||
// synced pricing at all.
|
||||
deepseek: ["ds"],
|
||||
groq: ["groq"],
|
||||
together_ai: ["openrouter"],
|
||||
bedrock: ["kiro"],
|
||||
bedrock: ["kr"],
|
||||
fireworks_ai: ["fireworks"],
|
||||
cerebras: ["cerebras"],
|
||||
nvidia_nim: ["nvidia"],
|
||||
@@ -116,8 +128,11 @@ const LITELLM_PROVIDER_MAP: Record<string, string[]> = {
|
||||
"vertex_ai-language_models": ["gemini"],
|
||||
"vertex_ai-mistral_models": ["mistral"],
|
||||
gemini: ["gemini"],
|
||||
bedrock_converse: ["kiro"],
|
||||
cloudflare: ["cloudflare-ai"],
|
||||
bedrock_converse: ["kr"],
|
||||
cloudflare: ["cf"],
|
||||
// stability-ai has no chat-completions registry entry (image-only:
|
||||
// open-sse/config/providers/registry/stability-ai/imageModels.ts) — left
|
||||
// as-is rather than guessed at; not the same bug shape as the three above.
|
||||
stability: ["stability-ai"],
|
||||
};
|
||||
|
||||
|
||||
@@ -138,9 +138,14 @@ describe("transformToOmniRoute", () => {
|
||||
|
||||
const result = transformToOmniRoute(raw);
|
||||
|
||||
// deepseek maps to "if" alias
|
||||
assert.ok(result.if, "Should map deepseek to if alias");
|
||||
assert.ok(result.if["deepseek-chat"]);
|
||||
// deepseek maps to "ds" (its real registry alias — open-sse/config/providers/
|
||||
// registry/deepseek/index.ts). Previously mapped to "if" (Qoder's alias, an
|
||||
// unrelated provider) — fixed alongside the other dead LITELLM_PROVIDER_MAP
|
||||
// entries (bedrock/bedrock_converse/cloudflare) that pointed at a provider's
|
||||
// `id` instead of its `alias`.
|
||||
assert.ok(result.ds, "Should map deepseek to its real ds alias");
|
||||
assert.ok(result.ds["deepseek-chat"]);
|
||||
assert.ok(!result.if, "Must not route deepseek pricing onto Qoder's if alias");
|
||||
});
|
||||
|
||||
test("skips entries without input cost", () => {
|
||||
|
||||
Reference in New Issue
Block a user