From 812f6c7024fd0c8b1626964bdbc581cf28ec390b Mon Sep 17 00:00:00 2001 From: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> Date: Wed, 30 Sep 2026 11:59:36 -0700 Subject: [PATCH] fix(proxy): make inference model selection exhaustive --- litellm/proxy/common_utils/http_parsing_utils.py | 3 ++- tests/test_litellm/proxy/auth/test_handle_jwt.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/common_utils/http_parsing_utils.py b/litellm/proxy/common_utils/http_parsing_utils.py index be62448e3ed..d327e1c1f45 100644 --- a/litellm/proxy/common_utils/http_parsing_utils.py +++ b/litellm/proxy/common_utils/http_parsing_utils.py @@ -6,7 +6,7 @@ from typing import Annotated, Any, Final, Literal, Union, get_args, get_origin import orjson from fastapi import Request, UploadFile, status -from typing_extensions import NotRequired, ReadOnly, Required +from typing_extensions import NotRequired, ReadOnly, Required, assert_never from litellm._logging import verbose_proxy_logger from litellm.constants import ( @@ -56,6 +56,7 @@ def resolve_inference_model( return endpoint_model case "completion": return settings.get("completion_model") or cli_model or endpoint_model or body_model + assert_never(kind) def _normalize_media_type(content_type: str) -> str: diff --git a/tests/test_litellm/proxy/auth/test_handle_jwt.py b/tests/test_litellm/proxy/auth/test_handle_jwt.py index df576fc27d0..640b3d8053d 100644 --- a/tests/test_litellm/proxy/auth/test_handle_jwt.py +++ b/tests/test_litellm/proxy/auth/test_handle_jwt.py @@ -7932,6 +7932,8 @@ async def test_managed_application_uses_persisted_identity_without_provisioning_ result: Final = await JWTAuthManager.auth_builder(**arguments) auth: Final = JWTAuthManager.user_api_key_auth_from_result(result) assert auth.agent_id == "stable-id" + assert auth.api_key is None + assert auth.token is None assert auth.user_id is None assert auth.team_id is None assert auth.managed_agent_context is not None