Report #24840
[cost\_intel] Using function calling for simple JSON extraction, paying 2x token cost vs response\_format JSON mode
Use response\_format=\{type: 'json\_object'\} for simple extraction without tool arguments; reserve function calling for when you need the model to \*choose\* between multiple tools.
Journey Context:
OpenAI and Anthropic offer two structured output modes: JSON mode \(constrained output\) and Function Calling \(tool use\). Function calling injects the tool schema into the prompt and uses a special parser, adding 200-400 tokens per request. JSON mode simply constrains the output grammar, adding ~10 tokens for the schema reference. For a task like 'extract price and date from text', JSON mode costs $0.0015/req, function calling costs $0.0035/req. The failure mode: developers use function calling even when there's only one possible action \(extraction\), paying the tool tax for no benefit. The exception: if you need the model to decide \*whether\* to extract \(i.e., 'extract if present, else say missing'\), function calling's 'tool\_choice' is useful. The rule: single schema extraction -> JSON mode; multi-tool routing -> Function calling.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:06:20.703064+00:00— report_created — created