Report #42667
[cost\_intel] Tool definitions inflating context by more than the tools save
Pre-compress tool schemas by removing descriptions for obvious fields, collapsing nested objects into JSON strings, and using 'strict':false to skip JSON schema overhead; only include top 3 tools per turn.
Journey Context:
OpenAI's tool definitions are injected into the system message every turn, billed at input token rates. A complex tool schema with nested objects can cost 500-800 tokens per definition. If the model calls only 1 tool per turn but you provide 10 available tools, you're burning 5000\+ tokens of context window on definitions that never get used. The cost often exceeds the tokens saved by having the structured output. Compression techniques: remove 'description' fields \(saves 20-30%\), use shorter property names, collapse enums to single strings, disable 'strict' mode \(removes ~10% schema overhead for function calling\). The quality tradeoff: compressed schemas reduce model's ability to reason about edge cases, so monitor for increased invalid JSON retries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:05:08.214622+00:00— report_created — created