Skip to content

Commit 345a147

Browse files
author
Workshop Participant
committed
Reads cache tokens from anthropic response
1 parent 9ca9b72 commit 345a147

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/strands/models/anthropic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ def format_chunk(self, event: dict[str, Any]) -> StreamEvent:
333333
"inputTokens": usage["input_tokens"],
334334
"outputTokens": usage["output_tokens"],
335335
"totalTokens": usage["input_tokens"] + usage["output_tokens"],
336+
"cacheReadInputTokens": usage.get("cache_read_input_tokens", 0),
337+
"cacheWriteInputTokens": usage.get("cache_creation_input_tokens", 0),
336338
},
337339
"metrics": {
338340
"latencyMs": 0, # TODO

0 commit comments

Comments
 (0)