From 5e32ace26029aefacb1877126142fb02671dad3c Mon Sep 17 00:00:00 2001 From: Cesar Garcia <128240629+Chesars@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:11:01 -0300 Subject: [PATCH] Update litellm/types/llms/openai.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/types/llms/openai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/types/llms/openai.py b/litellm/types/llms/openai.py index b09303b5774..27b9545a763 100644 --- a/litellm/types/llms/openai.py +++ b/litellm/types/llms/openai.py @@ -1202,7 +1202,7 @@ class ResponseAPIUsage(BaseLiteLLMOpenAIResponseObject): @field_validator("cost", mode="before") @classmethod def parse_cost(cls, v: Any) -> Optional[float]: - """Accept cost as a dict (e.g. Perplexity's {total_cost: 0.01}) and extract the float.""" + """Normalise cost: accept either a float or a dict with a ``total_cost`` key.""" if isinstance(v, dict): return v.get("total_cost") return v