File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -473,7 +473,11 @@ def new_iterator() -> "Iterator[MessageStreamEvent]":
473473
474474 # Anthropic's input_tokens excludes cached/cache_write tokens.
475475 # Normalize to total input tokens for correct cost calculations.
476- total_input = usage .input_tokens + (usage .cache_read_input_tokens or 0 ) + (usage .cache_write_input_tokens or 0 )
476+ total_input = (
477+ usage .input_tokens
478+ + (usage .cache_read_input_tokens or 0 )
479+ + (usage .cache_write_input_tokens or 0 )
480+ )
477481
478482 _set_output_data (
479483 span = span ,
@@ -507,7 +511,11 @@ async def new_iterator_async() -> "AsyncIterator[MessageStreamEvent]":
507511
508512 # Anthropic's input_tokens excludes cached/cache_write tokens.
509513 # Normalize to total input tokens for correct cost calculations.
510- total_input = usage .input_tokens + (usage .cache_read_input_tokens or 0 ) + (usage .cache_write_input_tokens or 0 )
514+ total_input = (
515+ usage .input_tokens
516+ + (usage .cache_read_input_tokens or 0 )
517+ + (usage .cache_write_input_tokens or 0 )
518+ )
511519
512520 _set_output_data (
513521 span = span ,
You can’t perform that action at this time.
0 commit comments