From 178f3e02e7c6e05ed925350d3175d0bee0bb9501 Mon Sep 17 00:00:00 2001 From: Harshit28j Date: Thu, 19 Mar 2026 17:57:27 +0530 Subject: [PATCH] Fix blank ServiceName rejection and add token counts to Tags - Fall back ServiceName to `model` when `model_group` is blank/null, fixing Vantage 422 errors on failed-request rows - Add `prompt_tokens` and `completion_tokens` to the Tags JSON so Vantage can use token-level granularity for cost allocation Co-Authored-By: Claude Opus 4.6 --- litellm/integrations/focus/transformer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/focus/transformer.py b/litellm/integrations/focus/transformer.py index b7d28e3dbb9..c22be2e66fc 100644 --- a/litellm/integrations/focus/transformer.py +++ b/litellm/integrations/focus/transformer.py @@ -19,6 +19,8 @@ _TAG_KEYS = ( "model", "model_group", "custom_llm_provider", + "prompt_tokens", + "completion_tokens", ) @@ -122,7 +124,13 @@ class FocusTransformer: pl.col("model").cast(pl.String).alias("ResourceType"), pl.lit("AI and Machine Learning").alias("ServiceCategory"), pl.lit("Generative AI").alias("ServiceSubcategory"), - pl.col("model_group").cast(pl.String).alias("ServiceName"), + pl.when( + pl.col("model_group").cast(pl.String).is_not_null() + & (pl.col("model_group").cast(pl.String) != "") + ) + .then(pl.col("model_group").cast(pl.String)) + .otherwise(pl.col("model").cast(pl.String)) + .alias("ServiceName"), pl.col("team_id").cast(pl.String).alias("SubAccountId"), pl.col("team_alias").cast(pl.String).alias("SubAccountName"), none_str.alias("SubAccountType"),