Report #66806
[cost\_intel] Unexpected input token costs when migrating Claude prompts to tool use \(function calling\)
Account for 40-60% input token inflation when using Claude tool use vs raw XML; the system injects full JSON schemas for each tool into the context window, consuming 500-2000 tokens per tool definition
Journey Context:
Developers assume tool calling is syntactic sugar over structured prompting. Anthropic actually prepends the full JSON schema of each available tool to the system prompt to enable the XML-based tool calling format. For a tool with a complex schema \(5 nested objects\), this adds ~1500 input tokens per request. For 10 tools, that's 15k tokens of context before the user message. At $3/1M input tokens, this adds $0.045 per request. For high-volume APIs, this overhead exceeds the cost of the actual generation. Mitigation: prune schemas to only required fields, or use raw XML prompting with strict regex validation for internal tools where reliability requirements are lower.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:36:51.404887+00:00— report_created — created