Introducing Nasca: Per-user AI cost limits in 10 lines of code
Building an AI-powered product is exciting — until you get your first OpenAI bill.
Most indie developers discover the hard way that AI APIs have no native concept of per-user spend limits. You get one account, one API key, and one invoice at the end of the month. If a single user in your app decides to go wild with your AI feature, there's nothing between them and your credit card.
We built Nasca to fix this.
The problem in concrete terms
Say you're building a writing assistant and your monthly OpenAI budget is $200. You have 500 users. On average, each user costs $0.40/month — totally sustainable. But one user discovers they can use your tool to generate entire books and submits 10,000 requests in a weekend. That's a $400 bill from a single user, and OpenAI will happily process every one of those requests.
OpenAI and Anthropic simply don't expose the primitives you'd need to prevent this: per-user token counters, configurable block thresholds, or upgrade prompts.
What Nasca does
Nasca sits between your app and your AI provider. It tracks spend per end-user in real-time using Redis, and intercepts each call before it reaches OpenAI or Anthropic. If a user has exceeded their monthly budget, the call is blocked and a NascaBlockedError is thrown — which you can catch and turn into an upgrade prompt.
The entire integration is three steps:
- Install the SDK and initialise it once with your account credentials
- Wrap your AI function — one line of code
- Catch
NascaBlockedErrorto show your upgrade prompt
Your existing AI calls don't change. The SDK has the same signature as the original function — it just adds a context argument for user identification.
Under the hood
Each call goes through a Redis check in under 50ms before hitting the AI provider. We use Upstash for global low-latency Redis, and the worker runs on Cloudflare's edge network. Your API calls never meaningfully slow down.
Spend is accumulated in real-time. The moment a user crosses their budget threshold, the next call is blocked — there's no lag, no cron job, no batch process.
Free to start
Nasca is free for up to 250 tracked users, with no credit card required. If you're an indie developer with a small user base, you may never need to pay. We think that's the right way to build developer tools.