mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
Update litellm/types/llms/openai.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
parent
ff97b0584a
commit
5e32ace260
1 changed files with 1 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue