The Unprotected LLM Endpoint Draining Your Prototype's Budget
AI-generated B2B apps routinely leave their most expensive feature open to the public web.
What You Need to Know
AI-coding platforms frequently build backend LLM endpoints without authentication or rate limits. Scraper bots scan new deployments for these open routes and use them as free proxies to process their own workloads, draining your API budget. You must enforce session authentication, apply rate limits, and set hard provider caps.
At a Glance
- The Vulnerability
- Unauthenticated API routes calling paid LLMs
- The Consequence
- Runaway billing from third-party bot exploitation
- Primary Fix
- Require valid JWT/session tokens on all backend routes
- Secondary Fix
- Implement user-level rate limiting via Redis/middleware
- Failsafe
- Set a hard monthly spend cap at the model provider
Best For
- Founders using AI generators to build MVP software
- B2B operators commissioning custom internal tools
- Technical leads managing outsourced prototype deployments
Not For
- ×Consumer app developers building free tools
- ×Teams running fully on-premise open-source AI models
Key Takeaways
- AI generators routinely build backend API routes without user authentication checks.
- Automated bots scan new deployments to find open LLM endpoints and use them as free proxies.
- An unauthenticated endpoint drains your budget faster than a leaked key because the traffic appears legitimate to the provider.
- Every AI endpoint requires strict session verification before the model is called.
- Hard spend caps in your OpenAI or Anthropic console are mandatory, not optional.
You commissioned a custom internal tool to speed up data extraction. You used an AI generation platform to build an MVP that reads commercial invoices, extracts the line items, and outputs a clean CSV for your operations team. It works perfectly on Friday afternoon.
On Monday morning, you log into your OpenAI or Anthropic console and see a £4,800 charge.
Your prototype only has three internal users. They did not process a million invoices over the weekend. Instead, your prototype fell victim to the most common, and financially destructive, flaw in AI-generated software: the unauthenticated LLM endpoint.
When you build applications quickly using generative platforms, the resulting code prioritises getting the feature working over locking the doors. The application successfully calls the AI model to do the work, but it fails to check who is asking for the work to be done.
Here is how this architectural flaw happens, why it is actively exploited within hours of deployment, and the exact steps required to stop the billing leak before your app hits production.
The Mechanics of an Exposed Proxy
To understand the vulnerability, you have to understand how modern AI applications are structured.
In a standard B2B application, you have a frontend (the interface your team clicks on) and a backend (the server that processes requests). When a user uploads a commercial invoice, the frontend sends a request to a specific URL on your backend—for example, your-app.com/api/process-invoice.
The code sitting at that backend URL takes the invoice data, attaches your private OpenAI API key, sends it to OpenAI for processing, and returns the result to the frontend.
When you use tools like Lovable, Bolt or Cursor to generate this setup, they invariably create this backend route. But by default, they skip the authentication step. They do not write the code required to ask: "Is the person calling this URL actually logged into our system?"
The result is a public, open door on the internet. Anyone who finds the URL your-app.com/api/process-invoice can send data to it. Your server will dutifully accept the request, attach your highly sensitive API key, pay OpenAI to process the data, and hand the result back to the stranger.
You have unintentionally built a free proxy for the world to use your paid AI account.
A Leaked Key vs An Open Door
There is a critical distinction between an exposed API key and an unauthenticated endpoint.
As we have covered previously, shipping a prototype that leaks live API keys in the frontend code is a common error. If you do this, an attacker scrapes the key and uses it directly. However, model providers are getting better at catching this. If OpenAI detects your key floating around in public GitHub repositories, they will often automatically revoke it and alert you.
An unauthenticated endpoint is far more insidious.
The API key never leaves your secure backend server. It is completely hidden from the public. But because your backend is perfectly willing to process requests from anyone, an attacker simply routes their traffic through your server.
To OpenAI or Anthropic, nothing looks suspicious. The requests are coming directly from your official, registered server IP. The API calls look entirely legitimate. The model provider has no way of knowing that your server forgot to check the user's ID at the door. They will simply process the tokens and bill your account until the attached credit card fails.
How Bots Find Your "Secret" Prototype
Operators often assume that because a prototype is only used internally, nobody knows the URL. This is not how the modern internet works. Relying on obscurity is not a security strategy.
When you push code to hosting providers like Vercel or Netlify, they generate a public URL. The moment that URL goes live, it is logged in public Certificate Transparency (CT) logs.
Automated scraper networks monitor these CT logs in real-time. When they see a new application deployed, they immediately scan it. They run automated scripts that test standard endpoint names commonly generated by AI coding tools: /api/chat, /api/generate, /api/ai, /api/process.
Once a bot gets a successful "200 OK" response from one of these endpoints, they know they have found an open proxy. They will immediately start routing their own workloads through your server. If your B2B tool uses a large context window—such as a feature designed to analyse 50-page PDF compliance documents for an AU freight forwarder—the financial drain is exponential. A bot piping large texts through your endpoint will chew through thousands of dollars in hours.
The Three Fixes You Must Apply
Before you move an AI-generated B2B tool from a local testing environment to a live web server, you must implement three non-negotiable fixes.
If you have exported code from a tool like Lovable or Bolt to host yourself, you need to manually intervene in the codebase to apply these controls.
1. Require Strict Session Authentication
The backend endpoint must verify the user before executing the expensive AI call.
When your frontend makes a request to /api/process-invoice, it must include a secure session token (like a JWT) provided by your authentication system (such as Supabase, Clerk, or NextAuth).
The very first lines of code in your backend route must validate that token. If the token is missing, expired, or invalid, the server must immediately reject the request with a 401 Unauthorized status. The AI model is never called, and you pay zero tokens.
(Note: This logic is entirely separate from database security. Even if you have properly configured your database rules, as outlined in our guide on Supabase security flaws, an open API route will still process the model call before it ever attempts to write to the database.)
2. Implement User-Level Rate Limiting
Authentication alone is not enough. What if a legitimate user’s account is compromised, or an internal user decides to run a massive, unapproved batch script that hits your endpoint 500 times a minute?
You must enforce rate limits on the endpoint. This requires adding middleware (often using a tool like Upstash Redis) that tracks how many times a specific user ID has called the route within a given timeframe.
For a B2B application processing complex documents, a sensible limit might be 10 requests per user per minute. If a user sends an 11th request, the server blocks it with a 429 Too Many Requests status, protecting your backend from being overwhelmed and your budget from spiking.
3. Set a Hard Spend Cap at the Provider
Code-level protections can fail. A developer might accidentally comment out the authentication check during debugging and push the change live.
Your final layer of defense exists entirely outside the codebase: the billing console of your model provider (OpenAI, Anthropic, Google).
Do not rely on budget alerts. An email telling you that you just hit £500 does not stop the system from hitting £5,000 ten minutes later while you are away from your desk. You must set a hard limit—a maximum monthly spend cap that automatically disables API access once reached. If your legitimate business usage genuinely requires more volume, you can manually raise the cap later.
Production Readiness Requires Human Review
Generative AI is exceptional at writing the logic required to make a feature function. It is currently very poor at anticipating the adversarial nature of the live internet.
If you are using these tools to build operational software for your business, you cannot skip the hardening phase. Taking a raw export from a vibe coding platform and deploying it directly to a live domain is the digital equivalent of leaving a company credit card taped to a park bench.
You do not necessarily need a six-month development cycle to secure an MVP, but you do need an experienced operator to review the architecture. It is vastly cheaper to patch an open endpoint than to pay for a botnet’s weekend processing run.
Useful tool
Try Samvara's Document Readiness Checklist — Export/import docs by mode.
Quick Comparison
| Feature | Default Vibe-Coded Endpoint | Hardened Production Endpoint |
|---|---|---|
| Access Control | Open to the public web | Requires valid session token |
| Call Volume | Unlimited (until budget dies) | Hard-capped per user/minute |
| Provider Limits | Auto-recharging or alert-only | Hard monthly spend cap applied |
| Bot Vulnerability | Highly exploitable proxy | Traffic blocked before model call |
Frequently Asked Questions
Will OpenAI or Anthropic refund me if my endpoint is exploited?
Does my hosting provider (like Vercel) protect against this?
How do I know if my endpoint is exposed?
Bottom line
Do not deploy an AI feature to a live domain without locking the API route behind user authentication and setting a hard stop on your provider billing console. Review and hardening starts at 199 GBP, which is a fraction of the cost of a compromised endpoint.
How Samvara researches this guide
We write for exhibition organisers and import/export operators in Australia, the UK, Europe, the US and India. Guides favour specific, verifiable operational advice over generic tips — grounded in systems we have shipped, client workflows, and current industry practice. We revisit articles as tooling and regulations change.
Written by
Shreyansh Doshi, Founder of Samvara
Shreyansh Doshi is the founder of Samvara Technologies, a product studio building operator software and SaaS products for exhibition, import/export, travel and fitness businesses in the UK and Australia. He writes about product delivery, operations systems, and where AI does and does not belong in a real workflow.
Keep Reading
More in Scope & Ship