Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Fixed anthropic usage showing as 0

Dillon DuPonta1563c273b73
diff --git a/libs/python/agent/agent/providers/anthropic/utils.py b/libs/python/agent/agent/providers/anthropic/utils.py
index f57ea8291d..6a3f3bfa0b 100644
--- a/libs/python/agent/agent/providers/anthropic/utils.py
+++ b/libs/python/agent/agent/providers/anthropic/utils.py
@@ -350,6 +350,20 @@ async def to_agent_response_format(
},
}
+ if response.usage:
+ standard_response["usage"] = {
+ "input_tokens": response.usage.input_tokens,
+ "input_tokens_details": {
+ "cached_tokens": response.usage.cache_creation_input_tokens,
+ },
+ "output_tokens": response.usage.output_tokens,
+ "output_tokens_details": {
+ "reasoning_tokens": 0
+ },
+ "total_tokens": response.usage.input_tokens + response.usage.output_tokens,
+ **dict(response.usage),
+ }
+
# Add tool calls if present
tool_calls = []
for block in response.content: