One-line retry bug tripled LLM spend: a cost debugging postmortem
MaverikSh · reddit · 2026-09-21
A developer on Reddit shares a debugging postmortem after LLM spend jumped from $40/day to $130+.
- Triage: ruled out model changes, maxtokens bumps, new features and traffic growth (request count flat) — cost per request had risen.
- Localization: pulling per-request cost by endpoint showed a background job that calls an external API with timeout retries cost 3x per logical task while per-call cost stayed normal.
- Root cause: cost observability was keyed on raw calls, not tasks. The retry wrapper didn't share an identifier with the original request, so the budget counter saw 3 valid, normal-priced calls instead of one 3x task.
- Fix: attach a stable task ID to the retry wrapper and roll costs up by task ID; flakiness now surfaces as "this task cost 3x" instead of hiding in three normal line items.
The author asks what unit others key LLM cost observability on — raw call, task/trace ID, or something else.
More from coding & agent
- GitHub Copilot App uninstall leaves MCPs, plugins and old versions behind — PaulShellDev · 2026-09-21
- TypeSafe's Jev Cut Grok Build Costs 22-40% on the Same Tasks — Daniel_Farinax · 2026-09-21
- jev-skill-suggester: a lightweight pre-execution skill router stops agents picking wrong tools — udmrzn · 2026-09-21
- OpenClaw adds FaceTime: your agent can now call you, and answer your calls — steipete · 2026-09-21
- Reverse-engineering Instinct's memory: beautifully simple, replicable in 60 lines — julianweisser · 2026-09-21
- 3 Weeks of Logs Show 40% of Messages to Coding Agents Are Overhead — Lucky-Group9525 · 2026-09-21