[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-05-22 17:42:02 +00:00 committed by danielhanchen
commit 8d8bb1dc77

View file

@ -240,9 +240,7 @@ def calculate_cost(
for key in ("input_tokens_details", "prompt_tokens_details"):
details = usage.get(key) or {}
if isinstance(details, dict):
cache_read = max(
cache_read, int(details.get("cached_tokens") or 0)
)
cache_read = max(cache_read, int(details.get("cached_tokens") or 0))
# OpenAI: cache_read already counted inside input_tokens.
out["billable_input_tokens"] = input_tokens + cache_creation
else: