From af8d479482d8c41e8abc17e144c68b92e0d82d64 Mon Sep 17 00:00:00 2001 From: user <70670632+stuxf@users.noreply.github.com> Date: Thu, 16 Apr 2026 22:42:14 +0000 Subject: [PATCH] chore(proxy): emit warning when caller-supplied tags are stripped Silent strip is the worst debug UX: admin's client sends routing tags, they disappear, admin can't figure out why. Emit a warning naming the metadata key the tags came from and telling the admin exactly which flag to set if this is intentional. --- litellm/proxy/litellm_pre_call_utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py index f7b66a55b8e..b1dae22c9fe 100644 --- a/litellm/proxy/litellm_pre_call_utils.py +++ b/litellm/proxy/litellm_pre_call_utils.py @@ -1006,10 +1006,19 @@ async def add_litellm_data_to_request( # noqa: PLR0915 _admin_allow_client_tags = True break if not _admin_allow_client_tags: + _stripped_from: List[str] = [] for _meta_key in ("metadata", "litellm_metadata"): _user_meta = data.get(_meta_key) - if isinstance(_user_meta, dict): + if isinstance(_user_meta, dict) and "tags" in _user_meta: _user_meta.pop("tags", None) + _stripped_from.append(_meta_key) + if _stripped_from: + verbose_proxy_logger.warning( + "Stripped caller-supplied tags from %s: this key/team does " + "not have `allow_client_tags: true` in its metadata. Set it " + "to opt into client-supplied routing/budget tags.", + ", ".join(_stripped_from), + ) ########################################################## # Init - Proxy Server Request