Report #73543
[cost\_intel] Failed tool/function calls still bill the full token count of generated arguments JSON even when client-side validation fails and the function throws an error
Implement client-side JSON Schema validation of arguments before executing functions; for expensive tools, use a cheaper 'validation model' to pre-check arguments before the main model generates the full JSON
Journey Context:
When a model generates a function call, the tokens for the arguments \(often 100-500 tokens of JSON\) are billed as output tokens immediately upon generation, regardless of whether the client-side code validates the arguments, throws an error, or decides not to execute the function. In multi-step agents, 30-40% of tool calls may fail validation \(wrong types, missing required fields\), resulting in 'burned' tokens that paid for unusable JSON. Common error: catching validation exceptions after the LLM call without realizing the cost is already sunk. Alternatives: using 'tool\_choice': 'none' to exclude tools during validation steps, or using constrained generation \(guided decoding\) to ensure valid JSON upfront. Quality signature: High tool call volume but low successful execution rate \(<60%\) indicates burned token waste.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:02:23.034611+00:00— report_created — created