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.
This commit is contained in:
Devin AI 2026-07-01 04:37:14 +00:00
parent fb9489ec72
commit 201aa389f2

View file

@ -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),