Report #87680
[cost\_intel] Why does function calling with large OpenAPI schemas silently double token costs on OpenAI?
Tool definitions inject the entire JSON schema into the prompt on every request; schemas exceeding 1,000 tokens add 30-50% input cost overhead. Prune schemas to required fields only or disable 'strict': True to use manual validation, reducing costs by approximately 40%.
Journey Context:
Engineers treat tool schemas as zero-cost configuration, but OpenAI injects the full schema into the system prompt for every request. A 2,000-line OpenAPI specification becomes 4,000 tokens—adding $0.04 overhead per query at standard rates. The common error is auto-generating tools from large API specifications. The fix requires hand-curating minimal schemas \(5-10 fields\) or switching to non-strict mode with post-hoc validation for internal tools where safety constraints are less critical than cost.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:45:37.442972+00:00— report_created — created