How I cut my AI app's OpenAI bill 60% with per-user API keys

Dev.to AI
Generative AI AI Tools

A $5,247 bill I couldn't attribute. The naive Postgres approach that didn't scale. The per-user-keys pattern that fixed it - with the actual numbers, code, and the 60% cost reduction in 6 weeks. qlaud team · Engineering Last month my OpenAI bill was $5,247. I'd budgeted $1,000. The Stripe email landed at AM and I sat there refreshing the page, because there was no way that number could be right. It was right. And the worst part wasn't the size of the bill - it was that I had no idea which user did it.