mirror of
https://github.com/usestrix/strix.git
synced 2026-10-04 02:33:47 +00:00
fix(pricing): prefer the direct provider when resellers list the same price
LiteLLM's cost map now lists grok-4.5 under xai/, perplexity/xai/ and openrouter/x-ai/ at identical prices, so alphabetical order resolved the bare name to openrouter and failed test_resolves_common_bare_model_names. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f1fe458216
commit
76267dc97e
1 changed files with 6 additions and 1 deletions
|
|
@ -36,7 +36,12 @@ def resolve_litellm_model(model: str) -> str | None:
|
|||
if "/" in normalized:
|
||||
names.append(normalized.rsplit("/", 1)[-1])
|
||||
for name in names:
|
||||
matches = sorted(key for key in model_cost if key.endswith(f"/{name}"))
|
||||
# Prefer the direct provider (``xai/grok-4.5``) over resellers
|
||||
# listing the same model (``openrouter/x-ai/grok-4.5``).
|
||||
matches = sorted(
|
||||
(key for key in model_cost if key.endswith(f"/{name}")),
|
||||
key=lambda key: (key.count("/"), key),
|
||||
)
|
||||
if not matches:
|
||||
continue
|
||||
prices = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue