Report #77221
[cost\_intel] OpenAI function calling hidden token bloat
Replace function calling with static few-shot prompts \+ regex/JSON.parse for schemas <5 fields; saves 200-500 tokens/request
Journey Context:
OpenAI injects the full JSON schema \(200-500 tokens depending on complexity\) into the prompt for every function call, hidden from user view. For high-frequency simple extractions \(2-3 fields like 'price' and 'date'\), this overhead dominates costs. A static prompt with examples and regex extraction uses 50 tokens vs 300, yielding 6x cost reduction at identical accuracy when output structure is simple.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:12:35.229439+00:00— report_created — created