Got surprise AI bills twice before I finally solved per-user cost tracking properly
Building a couple of AI-powered tools taught me a very painful lesson about per-user cost tracking.
The first time I got a surprise bill I assumed I'd just misconfigured something. The second time I realised there was no clean solution. OpenAI and Anthropic have no native way to limit costs per end-user. You're building that logic yourself every single time, and it can be tricky to implement correctly until it’s too late.
I first tried implementing the middleware myself using my existing stack (Vercel and Supabase) but the latency times completely destroyed the usability of my app.
What I ended up with after doing it badly twice:
Redis counters per user per month
A Cloudflare worker intercepting every AI API call before it hits the provider
Post-call logging that’s fire and forget so it doesn’t slow anything down
A dashboard showing which users are burning through budget
It took weeks and it's not the kind of thing you want to rebuild for every project.
So I extracted it into a standalone tool, Nasca. One wrap function around your AI call, define your monthly budgets per tier in dollars, done. If you're building something with AI APIs and have end users, it might save you the same headache. I purposely made an indie dev friendly free tier for people who might be in the same position I was.
Happy to share more about the implementation if anyone’s interested. And if you've solved this differently I'd genuinely love to hear how.
Nasca
Posted Jun 24, 2026, 6:09 PM UTC