AI abuse protection
Ship secure agents. Not security incidents.
Stop bots and automated attacks from burning your AI budget, leaking data, or misusing tools.
Start with a prompt
1. Run: npx skills add arcjet/skills
2. Add Arcjet protection to my app
const aj = arcjet({
rules: [\
\
detectPromptInjection({ ... }), // Block prompt attacks\
\
detectBot({ ... }), // Block automated clients\
\
tokenBucket({ ... }), // Enforce budgets\
\
sensitiveInfo({ ... }), // Prevent data leaks\
\
],
});
export async function POST(req: Request) {
const decision = await aj.protect(req);
if (decision.isDenied()) {
if (decision.reason.isBot()) {
return new Response(
"Automated clients are not permitted", {
status: 403,
});
}
}
// Arcjet approved
// Now call your AI provider
}
Allow trusted traffic. Block AI abuse.
Enforce per-user and per-org AI budgets.
Prevent sensitive data from reaching models and tools.
Control AI spend and access
Set AI budgets and access policies
Control who can access AI endpoints and how much they can spend - using identity, route, and session at runtime.
Set AI budgets for users, tenants, and routes.
Treat paid users, admins, agents, and anonymous traffic differently.
Combine multiple limits to stop abusive accounts and cost spikes.
/api/collection
/admin/users
const aj = aj.withRules(
tokenBucket({
mode: "LIVE", // Blocks requests. Use "DRY_RUN" to log only
refillRate: 2_000, // Refill 2,000 tokens per hour
interval: "1h",
capacity: 5_000, // Maximum 5,000 tokens in the bucket
}),
);
export async function POST(req: Request) {
const userId = "user-123"; // Replace with actual user ID
const decision = await aj.protect(req, { userId });
if (decision.isDenied() && decision.isRateLimit()) {
return new Response("AI usage limit exceeded", {
status: 429
});
}
// Handle the request
}
detectPromptInjection({
threshold: 0.5,
mode: "DRY_RUN",
})
detectBot({
allow: [\
\
"GOOGLE_CRAWLER",\
\
"OPENAI_CRAWLER"\
\
],
mode: "LIVE",
}),
Allow trusted bots. Block abusive automation.
Protect expensive AI endpoints from automated traffic, prompt attacks, and cost overruns - without blocking legitimate crawlers, integrations, or users.
Classify well-known bots so you can allow trusted automation.
Protect AI endpoints from automation, prompt jailbreaking attacks, and cost overruns.
Policies live in code and run anywhere your app does. Test locally before deploying.
Block abuse. Control AI spend and access.
Protect expensive AI endpoints from automated traffic, cost attacks, and misuse - while allowing trusted bots, crawlers, and legitimate users.
Open source bot intelligence for AI abuse protection
Arcjet combines open source bot classifications with real-time detection signals, so you can distinguish legitimate automation from traffic that drives up spend or targets AI endpoints.