Report #90654
[cost\_intel] Underestimating Claude tool use costs due to hidden XML serialization overhead
Budget for 200-400 hidden tokens per tool call in Claude 3.5 Sonnet due to internal XML representation; a 10-turn agent conversation with 5 tool calls per turn incurs ~15k hidden tokens \($0.045\) in addition to visible tokens, effectively doubling the expected API cost.
Journey Context:
Anthropic converts function definitions and calls to XML tags like and behind the scenes. A tool definition with 10 parameters adds ~300-400 tokens to the context window per call, even if the user sees only 50 tokens of JSON. For agents making 100 tool calls/day, this is 30k extra tokens \($0.09 on Sonnet\), breaking cost models that assumed 50 tokens × 100 calls.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:45:23.596679+00:00— report_created — created