From d4fb8e9a1b7ca9eb12db5a542763510e0e4ecc79 Mon Sep 17 00:00:00 2001 From: todayim <809634488@qq.com> Date: Thu, 6 Aug 2026 01:07:18 +0800 Subject: [PATCH] fix(proxy): include tag budgets in the idempotent booking transaction --- litellm/proxy/spend_tracking/usage_ingestion_endpoints.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/spend_tracking/usage_ingestion_endpoints.py b/litellm/proxy/spend_tracking/usage_ingestion_endpoints.py index 9a49268fdae..63e0f20a395 100644 --- a/litellm/proxy/spend_tracking/usage_ingestion_endpoints.py +++ b/litellm/proxy/spend_tracking/usage_ingestion_endpoints.py @@ -237,7 +237,9 @@ async def reserve_spend_log_atomic( if ProxyUpdateSpend.disable_spend_updates() is True: return "disabled" - payload: Final = prisma_client.jsonify_object(build_spend_log_payload(record, request_id, hashed_token, key, cost)) + spend_payload: Final = build_spend_log_payload(record, request_id, hashed_token, key, cost) + payload: Final = prisma_client.jsonify_object(spend_payload) + request_tags: Final = spend_payload.get("request_tags") from prisma.errors import UniqueViolationError writer: Final = proxy_logging_obj.db_spend_update_writer @@ -258,6 +260,7 @@ async def reserve_spend_log_atomic( response_cost=cost, team_id=key.team_id, user_id=key.user_id, prisma_client=shim ) await writer._update_org_db(response_cost=cost, org_id=key.organization_id, prisma_client=shim) + await writer._update_tag_db(response_cost=cost, request_tags=request_tags, prisma_client=shim) except UniqueViolationError: return "duplicate" return "reserved"