Put a spending limit on your AI APIs.
Add Spending limits to your OpenAI, Claude, and Gemini APIs Thskyshield blocks AI requests that exceed budget before the API call executes.
Works with OpenAI, Claude, Gemini, and any model. No app rewrites. Live in 10 minutes.
OpenAI has no per-user spending limits. One prompt loop or malicious user can drain thousands of dollars overnight — and you won't know until the invoice lands.
See a wallet-drain attack get blocked in real time — no account needed.
90 seconds. Pure simulation. Governed vs unprotected side by side.
AI APIs have no built-in spending limits.
Your OpenAI account will happily process 10,000 requests from one user overnight. A prompt loop, a runaway agent, or a single malicious actor is all it takes. By the time you see the invoice, the damage is done.
A bug in your agent retries the same call in a tight loop. 4,000 requests. $1,200. You find out when OpenAI emails you.
One bad actor discovers your chatbot endpoint and scripts it overnight. No rate limit. No budget ceiling. $3,000 gone.
Your AI agent hits an edge case and enters an infinite tool-use loop. Fully autonomous. Fully expensive. Fully your problem.
- → 4,200 GPT-4o requests executed
- → No limit hit. All calls processed.
- → You find out when the invoice arrives.
- → 3 requests processed under budget
- → Budget ceiling hit. Kill-switch fires.
- → 4,197 requests blocked before execution.
Based on the live demo simulation. See it run in real time.
Open live demoSits between your app and the LLM. Blocks over-budget calls before they fire.
Thskyshield wraps your existing LLM calls with two lightweight SDK calls. Before the request executes, it checks the user's budget and atomically reserves the estimated cost in Redis. If they're over the limit, the API call never happens — no tokens burned, no cost incurred.
Before your LLM call runs, the SDK checks the user's remaining budget via an edge endpoint. If they're under the limit, the estimated cost is atomically reserved in Redis. If over — blocked instantly. Under 15ms.
After the LLM responds, the SDK logs the real token cost. Redis is reconciled. Supabase gets a permanent audit record: model, cost, user, plan, outcome.
Why simple budget checks fail.
Most developers reach for a simple database read: if the user is under budget, let the request through. It looks correct. It isn't.
Under concurrent load, two requests can read the same balance at the same time, both pass the check, and both execute the LLM call — even if either one alone would have exceeded the budget. This is a classic read-modify-write race condition, and it means your budget ceiling isn't actually a ceiling.
What actually happens
- 1.Request A reads balance → $4.90 of $5.00 used → passes ✓
- 2.Request B reads balance → $4.90 of $5.00 used → passes ✓
- 3.Request A fires the LLM call → $0.20 cost
- 4.Request B fires the LLM call → $0.20 cost
- 5.Final spend: $5.30 — 6% over the limit nobody enforced.
At low traffic this is invisible. Under any real concurrent load — or a scripted attack — it compounds into serious overruns.
Observability tells you what happened.
Thskyshield stops it before it does.
Tools like Helicone and LangSmith log prompts, tokens, and latency. That's useful — but they only observe after the cost already happened.
- Request fires → tokens burn → cost occurs
- You see what happened in a dashboard
- Useful for debugging and analytics
- Does not prevent runaway costs
- Budget check runs before the request fires
- Over-limit calls blocked — zero tokens burned
- Spend visible in dashboard in real time
- Prevents runaway costs, not just records them
One npm install.
Zero app rewrites.
Thskyshield wraps your existing LLM calls — no refactoring, no new architecture. Add shield.check() before and shield.log() after. Done.
- Works with GPT-4o, Claude, Gemini, or any model
- Per-user and per-plan budget limits in the dashboard
- Fail-open: if our API is down, your app stays up
- Real-time spend dashboard + full audit log
- Free users at $5/day, pro users at $50/day — enforced automatically
// middleware.ts
import { shield } from "@thskyshield/next";
export default shield({
routes: ["/api/*", "/dashboard/*"],
policy: "strict"
});If you're shipping an AI feature, install this first.
Every product that makes LLM API calls on behalf of users is exposed. Recognize yourself below.
You need this if any of these are true:
Built on the right stack.
Upstash Redis for sub-15ms atomic reservations. Supabase for permanent audit records. Vercel Edge for global coverage.
Install it before you launch. Not after.
Sign up in 30 seconds. Add your first site, grab your API key, and your first governed call is live in under 10 minutes. No credit card. No waitlist.
Common questions.
Your next billing cycle starts soon.
Every day without a spending limit is a day one bad request — or one bad actor — can drain your OpenAI credits. Takes 60 seconds to install.
Start Free — No Credit CardFree · No credit card · Deploy in 60 seconds