From 201aa389f24e7ce2d86fb9ed87ad29a45a424727 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 04:37:14 +0000 Subject: [PATCH] fix: handle direct get_config() calls without UserAPIKeyAuth When get_config() is called directly (not via FastAPI HTTP router), the user_api_key_dict parameter defaults to the Depends() marker object rather than a resolved UserAPIKeyAuth. Guard the role check with an isinstance check so internal/direct callers are treated as full admin. --- litellm/proxy/proxy_server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 653fee48591..e9f1feae9e3 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -14645,7 +14645,10 @@ async def get_config( _failure_callbacks = normalize_callback(_failure_callbacks) _success_and_failure_callbacks = normalize_callback(_success_and_failure_callbacks) - is_full_admin = user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN + is_full_admin = ( + not isinstance(user_api_key_dict, UserAPIKeyAuth) + or user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN + ) _all_callbacks = [ *((cb, "success") for cb in _success_callbacks),