Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

chore(proxy): clarify ownership-rebind error message (actor vs target)

userd5d73f1d6a00
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index c9cc770d459..1e7c4fce9ef 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -496,8 +496,8 @@ def _validate_caller_can_change_key_ownership(
raise HTTPException(
status_code=403,
detail=(
- f"User={incoming_user_id} is not allowed to update the key "
- f"to belong to user={existing_user_id}"
+ f"Non-admin caller is not allowed to rebind the key from "
+ f"user={existing_user_id} to user={incoming_user_id}"
),
)
diff --git a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py
index 33c1cefcf7e..b40079be8a7 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py
@@ -10644,7 +10644,7 @@ def _patch_regenerate_side_effects():
"incoming_user_id,expected_status,expected_substring",
[
# Cross-user rebind: the privesc primitive.
- ("default_user_id", 403, "not allowed to update the key"),
+ ("default_user_id", 403, "not allowed to rebind the key"),
# Empty-string removal: companion guard.
("", 403, "remove the user_id"),
# No-op rebind (caller sends their own user_id): must succeed.