Per-user budgets.
No wallet-drain.
Wrap your LLM calls with two SDK methods. Before the request executes, we atomically check and reserve the user's budget in Redis. If they're over the limit, the API call never happens — no tokens burned, no cost incurred.
Before the call fires. Every time.
Most spend-tracking tools log after the fact — they can't prevent an overrun. Thskyshield checks and reserves budget atomically before the LLM API call is made.
Before the request executes, 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 10ms.
After the LLM responds, the SDK logs the real token cost. Redis is reconciled atomically. Supabase gets a permanent record: model, cost, user, plan, outcome.
Deep dive into two-phase enforcement, the Lua atomic reservation, and per-plan budget isolation.
Watch a Denial-of-Wallet attack drain an unprotected endpoint in real time — then see it stopped.
Next.js SDK quickstart, HTTP API reference, reason codes, and multi-language examples.
One npm install.
Zero app rewrites.
Add shield.check() before and shield.log() after. Everything else stays the same.
- 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
// npm install @thsky-21/thskyshield
import { Thskyshield } from '@thsky-21/thskyshield'
const shield = new Thskyshield({
siteId: process.env.THSKYSHIELD_SITE_ID!,
apiKey: process.env.THSKYSHIELD_KEY!,
})
// Before the LLM call
const { allowed, requestId } = await shield.check({
externalUserId: userId,
model: 'gpt-4o',
})
if (!allowed) return res.status(429).json({ error: 'Budget exceeded' })
// After the LLM call
await shield.log({ requestId, externalUserId: userId, model: 'gpt-4o', tokens })Start protecting your LLM app.
Free tier. No credit card. Deploy in 60 seconds.