LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Bills that explode
  4. · 4 minutes · Free

The open summarise button

Your app has a free 'summarise this PDF' button. Your AI bill says you made 2 million requests last night. You have 60 users.

This answers: How do I stop people abusing my app's AI endpoint? No coding needed. 3 quick decisions.

  • Costs and abuse
  • How a request travels

Step 1 of 3

Your logs show this. What happened?

02:14:07 POST /api/summarise 200 user=- ip=203.0.113.44 tokens=3,91202:14:07 POST /api/summarise 200 user=- ip=203.0.113.44 tokens=4,10402:14:08 POST /api/summarise 200 user=- ip=203.0.113.44 tokens=3,877
Choose an answer

Pick one. You will see what really happens, and why.

How do I stop people abusing my app's AI endpoint?

Require sign-in, limit requests per user and per IP address, and cap the size of each request's input and output. Hiding the on your server is necessary but not enough: the endpoint that uses the key is public, and a script can call it millions of times.

Trail of the bug
  1. Bot script
  2. Your server
  3. AI provider

Breaks at Your server: No sign-in, no limits, your bill

How it works

Requests per day: people vs bots
People Bots
MonTueWedThuFriSatSun
Fri: 14,800 bot requests
Requests per day
DayPeopleBots
Mon180260
Tue210300
Wed1609400
Thu19012100
Fri23014800
Sat12013300
Sun11011900
From Wednesday, crawlers send thousands of requests a day. On usage-based hosting each one is billed, whoever sent it.

Why AI tools write this bug

AI tools correctly move the key to a server route, then leave that route open to anyone, with no limits, because limits are invisible in a demo.

How to fix it

  1. Require a signed-in user for any endpoint that spends money.
  2. Add per-user and per-IP .
  3. Cap input size and output length per request.
  4. Keep the provider's spend limit as a last line, not the plan.

Check your own app

Paste this into Lovable, Cursor or Claude Code:

List every endpoint or server action in this project that calls a paid API (OpenAI, Anthropic, image or email services). For each, tell me: does it require sign-in, is there a per-user or per-IP rate limit, and is the input size capped? Do not change code.

Common questions

Isn't the provider's spending limit enough?
No. It applies to your whole account, can lag behind usage, and does nothing to stop one abuser using all of it.

Related scenarios

  • A quiet week, a loud billPro · 4 min
  • The 4 MB thumbnailPro · 5 min
  • The address box that cost $1,900Pro · 5 min

More on this trail

Bills that explode: Open AI endpoints, bot traffic, fake signups and functions that loop forever.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in