How to Protect an AI Endpoint: Cap, Limit, Key
An AI endpoint is any door on your site or in your software that sends a request to a model: a chat box, a search field, an automation. Every use costs money. That makes every door a till. 🔐
This guide gives the order for protecting that door: first a spending cap, then a rate limit, then key discipline. After that come the bot itself, the logs and the moment something goes wrong. The seventeen articles of the Attack File all link back here.
This article covers the defender’s side only; it does not describe how to carry out an attack. Each article ends with a lock list: the settings to switch on, in order. We do not quote prices in this article; for the current figure, check your provider’s pricing page.
What is an endpoint, and why protect it?
BU BÖLÜMÜN ÖZETİ
- Every request is a payment
- Three separate routes
- Why a small business is in scope
A classic site that is attacked slows down or goes offline. A site with an AI box keeps working; the damage shows up on the bill.

Every request is a payment
Each question typed into the chat box on your site is a paid call to a provider behind the scenes. A longer question and a longer answer cost more. The visitor does not see this, and often neither do you until the end of the month. A site that does not limit who knocks, and how often, has opened its bill to strangers. OWASP names this risk unbounded consumption in the tenth item of its 2025 list for large language model applications: it arises when an application lets users make excessive and uncontrolled calls. This whole guide is about removing the word uncontrolled from that definition. 💸
Three separate routes
Harm reaches an endpoint by three routes. The first is the door itself: automated requests are poured into a box that is open to everyone. The second is the key: the secret code that gives access to your provider account leaks somewhere, and someone else works in your name. The third is the bot: an incoming message steers it outside your rules. Each route has a different defence. The door needs limits, the key needs storage and rotation, and the bot needs narrow permissions and testing. No single measure closes all three, which is why this guide speaks of three locks and of their order.
Why a small business is in scope
This is not a risk for large companies only. Automated scanning does not choose its targets; when it finds an open box or a leaked key it does not ask whose it is. On a small site, the absence of a cap makes the damage proportionally larger: an account that normally spends little can exceed its yearly budget in one night. Being small is not the same as being invisible. The good news is that most locks in this guide are free settings that take an afternoon. The reasoning is set out in why small sites become targets. 🎯
First lock: how is a spending cap set?
A cap fixes the bill of the worst night in advance. Even if the other locks fail, the damage has an upper limit.
The difference between an alert and a cap
An alert informs; a cap stops. The two are often confused. A setting that sends an email when spending passes an amount stops nothing if nobody reads the email. OpenAI’s page on key safety says so directly: spend alerts alone do not stop API traffic, and monthly spend limits with hard enforcement should be set to limit unexpected costs. An alert that arrives at three in the morning is a meter that runs until nine. Set both: the alert a little above a normal month, the cap at the largest loss you could accept. The detail is in what is a spending cap. 🚧
The setting on the provider side
The large providers offer a monthly spending limit at account level. According to Anthropic’s documentation, each usage tier carries a monthly spend cap, and once it is reached API usage pauses until the start of the next month. The account owner can also set a lower limit of their own on the billing page. The default cap is set by your tier, not by your budget. For a small business that default may be far too high. The first job is to open the console and bring the number down to your own reality. If you run several workflows, giving each its own workspace and limit stops a problem in one from shutting down the others.
Second lock: how is a rate limit set?
The cap limits the damage; the rate limit makes the damage harder to cause. One is the floor of the safe, the other the chain on the door.

A limit per person
A rate limit sets how many questions one visitor may ask in a given time. A real customer asks a few questions a minute; a script asks hundreds. The gap between them is where the limit goes. The rate limit your provider puts on your account does not do this job: it covers all your traffic together, and when an attacker fills it, real customers are shut out too. The per-person limit is built on your side, on your site. How it works and which numbers are reasonable is explained in what is a rate limit for AI. 🚦
Input and output length
A limit is not only a count of requests. A single request can reach the cost of a hundred normal ones by pasting ten thousand words and asking for a long answer. Two more limits are therefore needed: the longest text the box will accept and the longest answer the model may give. OWASP recommends limiting input size, throttling resource-heavy operations and setting timeouts against unbounded consumption. Two lines of configuration turn the most expensive request into an ordinary one. Nobody writes a ten-page question to a support box, and the box should not allow it.
Third lock: how are keys managed?
A key is the secret code that gives access to your provider account. Whoever holds it can spend in your name without ever visiting your site.
A separate key for each workflow
A business that runs on one key must stop everything at once when it leaks. Giving each workflow, each environment and each person a separate key brings three gains: a leaked key is revoked alone, the dashboard shows what each workflow spends, and each key carries only the permissions it needs. A separate key is both a security tool and an accounting tool. The test environment’s key must not be the same as the live one; test environments are less protected and leak more often. When someone leaves, the keys they knew are rotated. This arrangement is set up once and makes every later problem smaller.
What comes after the locks?
BU BÖLÜMÜN ÖZETİ
- The bot itself
- Logging and monitoring
- Lock list: this week’s settings
The three locks protect the bill. What remains is what the bot says, what is recorded and who does what when something happens.

The bot itself
A bot can read anything typed to it as an instruction. A message may try to push it outside its rules; OWASP puts this risk first on its list and says it is unclear whether fool-proof methods of prevention exist. The defence is not to make the bot impossible to trick, but to narrow what it can do when tricked. A bot that can only read will, on its worst day, say something wrong; a bot that can write and send can do harm. Testing it with provoking questions before launch is how you find the problems before a customer does. The concept is explained in what is prompt injection. 🤖
Logging and monitoring
Without a record, an incident cannot be understood. Keep at least this: the time of each request, the workflow it came from, the tokens it used and the requests that were refused. These show why the bill grew, whether the limits work and when an attack began. Five minutes a week catches most problems on their first day. It should also be written down who looks at the logs; a record nobody reads is the same as no record. Customer messages may contain personal data, so how long they are kept and who may see them is a separate decision.
Lock list: this week’s settings
Every article ends with a lock list. This guide’s list has five lines, in order. One: in the provider console, bring the monthly spending limit down to your own budget and switch on the alert. Two: give the box a per-person rate limit and input and output length limits. Three: confirm that no key sits in the page source or in a repository. Four: give each workflow its own key. Five: write on one page who does what, in which order, when a key leaks. Forecast: within two years these five settings will be switched on by default in most ready-made tools that offer an AI box. Update log. 30 November 2026: first publication. Forecasts on this page are re-read when they fall due; one that proves wrong is corrected here, not deleted.
How does Adapte Digital review endpoints?
BU BÖLÜMÜN ÖZETİ
- A single delivery package
- What is reviewed
- Where to start
The Attack File is the most concrete part of the audit: doors are counted, limits are tested and missing settings are written down.
A single delivery package
Adapte Digital does not charge a monthly management fee. Work starts with a single delivery package whose scope is written down in advance: 36,000 TRY + VAT. If the work grows, the new need is defined as a separate add-on package, priced by what will be delivered rather than by the hours spent. 📦
What is reviewed
The AI boxes on the site, the places where keys are stored and the limits in the provider console are checked one by one; each gap is recorded with the setting that closes it.
Where to start
Our current packages and capacity are listed on our campaign pages; scope and price are written there before any work starts. 🧭
Quick Summary
- An AI endpoint is a door where every use costs money.
- Protection rests on three locks: spending cap, rate limit and key discipline.
- An alert informs and a cap stops; set both.
- The per-person rate limit is built on your site, not at the provider.
- A key lives on the server, is separate per workflow and is rotated at once if it leaks.
Short Glossary
- Endpoint
- An endpoint is a point at which software accepts requests from outside and performs an operation in return.
- Spending cap
- A spending cap is a setting that limits the highest amount an account can spend in a given period.
- API key
- An API key is a secret code that lets software access a provider account.
Frequently Asked Questions
Next Step
Open your provider console today and look at the monthly spending limit. If the number is not one you chose, your first lock is not yet on.
Sources: OWASP Gen AI Security Project — LLM10:2025 Unbounded Consumption · Claude Docs — Rate limits · OpenAI Help Center — Best practices for API key safety · GitGuardian — The State of Secrets Sprawl 2026
Updated: November 2026
Sık Sorulan Sorular
A cap has a price: once it is hit, legitimate customers get no answer either. So before setting it, decide what the box will show while it is closed. A plain message saying that answers are unavailable and where to reach you is better than an empty error. OpenAI also notes that hard enforcement can block legitimate requests and that spend may slightly exceed the limit because enforcement is not instantaneous. A cap is a seat belt, not a perfect brake. A short outage is always cheaper than an unlimited bill, but the outage plan has to be written beforehand. 🧾
The strongest limit is a door in front of the box. The risk gap between a box open to everyone and one open only to logged-in customers is wide: behind a login every request has an owner, and an abusive account can be closed. This has a price, because asking for a login turns some visitors away. The decision depends on what the box does. A box that answers pre-sales questions can stay open, with narrow limits. A box that shows order details must require a login. The middle ground is covered in when an AI box should require login. 🚪
The only right place for a key is the server: an environment variable or a secrets vault. The wrong places are many: the page source, a code repository, a shared document, a chat message. OpenAI’s advice is clear: never deploy a key in client-side environments such as browsers or mobile apps, never commit it to a repository, and keep it in an environment variable. Everything that reaches the browser is public. According to GitGuardian’s 2026 report, 28.65 million new secrets were written into public GitHub commits in 2025, and those belonging to AI services rose 81 per cent. The steps are in how to store an AI API key. 🔑
There is one right move for a leaked key: revoke it at once and issue a new one. Investigating, finding who did it and reading the bill come afterwards. OpenAI gives the same order: if you believe your key has been leaked, rotate it immediately, then review usage. The first ten minutes decide the size of the damage. In one attack documented by Sysdig, use through stolen credentials was estimated to cost more than 46,000 dollars a day if unnoticed. The rotation steps should therefore be written down before any incident, and at least two people should know how to carry them out. The sequence is in how to rotate a leaked API key. ⏱️
Yes, if you run an automation or a plugin that uses AI. Keys and caps matter even without a box.
The spending cap. It is a five-minute setting and limits the damage even if everything else fails.
Not the cap and alert; they are set in the console. The rate limit and key arrangement usually need a few hours of a developer’s time.
