Blog/AI Security

Rate limiting and abuse prevention for public AI chatbots and APIs

Protect public AI features from scraping, cost abuse and misuse with layered limits, token budgets, bot controls and a clear response playbook.

By Sagar Makker · 6 min read · October 2026
Concrete Wall
In short
Public AI features cost money per request, so abuse hits your bill as well as your service.
Limit by user, IP, tenant and tokens, not just requests per minute.
Set spend alerts and a kill switch so a spike becomes a contained incident, not a surprise invoice.
The problem

This is for founders, product heads and platform engineers running AI chatbots on websites, WhatsApp, or public APIs. Unlike a normal web page, every AI request has a direct cost and can be used for things you never intended: scraping your knowledge base, running free general-purpose queries, or flooding the service until real users are blocked. This post sets out practical limits, monitoring and response steps you can put in place before launch, so abuse becomes visible and contained rather than discovered on the monthly invoice.

A real estate developer launches a website chatbot to answer project questions. Within weeks, model spend climbs sharply. Logs show a handful of sessions sending long, unrelated requests around the clock, using the bot as a free general assistant. Another script systematically asks about every project to copy the price list and brochure content.

The team had a simple requests-per-minute limit per IP, which scripts bypassed by rotating addresses. There was no per-session token budget, no topic restriction, and no spend alert, so the first sign of trouble was the bill. Turning the bot off entirely was the only option they had, which also cut off genuine buyers.

Why it happens
01Limits count requests only, ignoring long prompts and large token use
02Limits apply only per IP address, which rotating scripts easily bypass
03No topic scope, so the bot accepts unrelated general-purpose requests
04No spend alerts or budget caps at the provider or application level
05No graded response options between normal service and full shutdown
How to fix it
1
Set layered limits by identity
Platform engineers apply limits per session, per verified user, per IP range and per tenant, with tighter limits for anonymous visitors. Thresholds are values you choose based on genuine usage patterns observed in testing and pilot traffic.
2
Add token and length budgets
Engineering caps input length, output length and total tokens per session and per day. Requests above the cap get a polite message or a prompt to sign in, which protects cost without blocking normal questions.
3
Scope the bot to its job
The product owner defines allowed topics, and engineering adds a lightweight check that declines off-topic requests before the main model call. This cuts free general-purpose use and reduces the surface for misuse.
4
Add bot checks at the edge
The security owner puts the chatbot behind your web application firewall or edge protection, with challenge checks triggered by suspicious patterns such as high frequency, headless clients or repeated identical requests.
5
Create spend alerts and a playbook
Finance and platform owners set daily spend alerts and a hard budget cap. A short playbook defines graded responses: tighten anonymous limits, require sign-in, block ranges, then pause, with named people authorised for each.
Worked example
A hospital chain's appointment chatbot

A multi-specialty hospital group in Delhi NCR launched a website and WhatsApp chatbot for appointment and doctor queries. After a promotional campaign, usage jumped and part of it was automated traffic asking unrelated questions. The platform team added per-session token budgets, tighter limits for anonymous web visitors, a topic check that redirected off-topic requests, and edge bot challenges on the web widget. Finance set a daily spend alert with a named on-call owner. After the change, genuine patients continued booking without friction, automated sessions were throttled early, and when a later spike occurred the team followed the playbook and tightened anonymous limits within minutes instead of switching the bot off.

Common mistakes
×
Relying on per-IP request limits alone
Scripts rotate addresses and send long prompts within the limit. Combine identity, session and token-based limits so cost and volume are both controlled.
×
Having no spend alert or cap
Without alerts, abuse shows up only on the invoice. Set daily alerts and a budget cap, and make sure a named person receives and acts on them.
×
Shutting down instead of degrading
A full shutdown hurts genuine customers. Plan graded steps such as requiring sign-in or tightening anonymous limits so service continues for real users.
Where an AI agent helps
Input
Request logs, token usage, spend data and edge security events
Agent does
Detects abusive sessions and spend spikes, proposes limit changes and drafts incident notes
Human gate
Platform owner approves limit tightening, blocks and any pause of service
Outcome
Abuse alerts, recommended limit changes and a daily usage and spend summary
Checklist
Set limits per session, user, IP range and tenant
Cap input, output and daily tokens per session
Decline off-topic requests before the main model call
Put the chatbot behind edge bot protection
Configure daily spend alerts and a hard budget cap
Write a graded abuse response playbook
What to measure
Model spend per genuine conversation
Sessions throttled or challenged per day
Off-topic requests declined per day
Time from spend alert to action
Questions
What limits should we start with?

Base them on observed genuine usage during pilot testing, then add headroom. Anonymous visitors should get tighter limits than signed-in users or paying tenants. Review limits after launch and after each campaign, because normal patterns change.

Will a topic check annoy real users?

Not if it is tuned to your use case and replies helpfully, pointing users to what the bot can do or to a human contact. Test it with real questions from sales and support before launch.

Should WhatsApp chatbots have the same controls?

Yes, adapted to the channel. Phone numbers give you a stable identity for per-user limits and budgets, and the messaging platform's own policies apply. Watch for unusual volumes from new numbers or repeated identical messages.

Who should own abuse response for AI features?

The platform owner runs the playbook and adjusts limits, finance owns spend alerts and budgets, and security handles edge controls and investigation. Name a primary and backup person for each so alerts are never orphaned.

Keep reading
All posts →
Cctv CameraAI Security
Prompt injection explained for business leaders, and how to reduce risk
5 min readRead →
Concrete WallAI Security
How to keep API keys and secrets out of LLM prompts and context
6 min readRead →
Computer CodeAI Security
Tenant isolation for AI features in multi-tenant SaaS products
7 min readRead →
Next step

Want this fixed in your business?

Send the workflow. You get a scope and a fixed price within two working days — or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com