refactor: keep the model info pricing helper out of the cleanup
Some checks failed
ai-gateway image / ai-gateway release image (push) Has been cancelled
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-09-13 08:36:03 +00:00
parent a84163f597
commit 1bc243893b
2 changed files with 3 additions and 5 deletions

View file

@ -2094,10 +2094,8 @@ async def add_new_model(
enforced=bool(general_settings.get(ENFORCE_RPM_TPM_ON_MODEL_ADD_SETTING, False)),
)
model_params.model_info = (
ModelInfo.model_validate( # rebind-ok: downstream team-model handling mutates this same object
dict(without_server_derived_pricing(model_params.model_info.model_dump(exclude_none=True)))
)
model_params.model_info = ModelInfo( # rebind-ok: downstream team-model handling mutates this same object
**without_server_derived_pricing(model_params.model_info.model_dump(exclude_none=True))
)
model_response: prisma_models.LiteLLM_ProxyModelTable | LiteLLM_ProxyModelTable | None = None

View file

@ -3667,7 +3667,7 @@ def is_server_derived_pricing_key(key: str) -> bool:
return key in SERVER_DERIVED_PRICING_FIELDS or ABOVE_THRESHOLD_COST_KEY_PATTERN.search(key) is not None
def without_server_derived_pricing(model_info: Mapping[str, object]) -> Mapping[str, object]:
def without_server_derived_pricing(model_info: Mapping[str, Any]) -> Mapping[str, Any]:
"""Drop the pricing ``/model/info`` derives for display, keeping everything else.
``/model/info`` fills a deployment's missing pricing in from the cost map so the