Cut my GPT-4 bill from $310 to $87 a month by hashing the easy prompts before they hit the API
My side project runs maybe 4,000 short classification calls a day and the bill kept creeping up. I tried trimming prompts and switching models but that broke stuff. What actually worked was putting a cache in front of the API keyed on a hash of the prompt plus input. Turns out like 60 percent of my traffic is repeat questions, so those never even leave the box now. Latency dropped too. Anyone else doing this, and did you bother with a TTL or just let it grow?