diff --git a/litellm/router.py b/litellm/router.py index 0b9f12c8da3..84ca5146216 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -9585,7 +9585,12 @@ class Router: if isinstance(v, str) and v.startswith("os.environ/") and not holds_secret_pointer(k): _litellm_params[k] = get_secret(v) - _model_info: dict = model.pop("model_info", {}) + _raw_model_info = model.pop("model_info", {}) + _model_info: dict = ( + _raw_model_info.model_dump(exclude_none=True) + if hasattr(_raw_model_info, "model_dump") + else (_raw_model_info or {}) + ) declared_id = None if _model_info.get("id") is None else str(_model_info["id"]) diff --git a/litellm/types/router.py b/litellm/types/router.py index e131a7184d4..f44537e10ee 100644 --- a/litellm/types/router.py +++ b/litellm/types/router.py @@ -705,8 +705,7 @@ class LiteLLMParamsTypedDict(TypedDict, total=False): class DeploymentTypedDict(TypedDict, total=False): model_name: Required[str] litellm_params: Required[LiteLLMParamsTypedDict] - model_info: dict - + model_info: dict | ModelInfo SPECIAL_MODEL_INFO_PARAMS = tuple(MirroredPricingParams.model_fields)