
How I accidentally built a cost tracking tool for LLMs
Last month I got an API bill that made me physically flinch. $2,847. I had no idea where it came from. I was building a side project — a fairly standard app with OpenAI for chat, Anthropic for summarization, Stripe for payments, Supabase for the database, and SendGrid for emails. Five services, each with their own dashboard, their own billing page, their own definition of "usage." I found myself opening five tabs every morning just to check if something had spiked overnight. It was miserable. So I wrote a quick script to intercept outgoing API calls and log the cost next to each one. Just a console.log with a dollar amount. Nothing fancy. But then something interesting happened. I saw that my onboarding flow was making 14 LLM calls per new user. Fourteen. I'd built a multi-step wizard where each step called GPT-4o separately, when a single call could have handled it. That one fix cut my daily OpenAI spend by 60%. I started showing the script to friends who were building with LLMs. They
Continue reading on Dev.to Webdev
Opens in a new tab




