Skip to content

Automated clients - scrapers, data harvesters, and script-based attackers - treat AI features as free compute. Without bot protection, every request from a bot reaches your AI provider and inflates your costs.

Arcjet bot detection runs inside your application, before the AI call, so denied requests never reach your provider. It classifies known bots, verifies good bots, and detects emerging threats in real time so you can control access per route with full application context (identity, subscription level, session state).

allow: [] blocks all automated clients. This is the recommended default for AI routes where no bot traffic is legitimate.

To allow specific categories or named bots from our list of known bots, add them to the allow list:

detectBot({
mode: "LIVE",
allow: [
"CURL", // Allow curl-based scripts
"CATEGORY:MONITOR", // Uptime monitoring services
"CATEGORY:PREVIEW", // Link previewers (Slack, Discord, etc.)
],
})

Bot protection controls who can call your AI features. To also control how much each user can consume, combine it with AI budget control:

rules: [
detectBot({ mode: "LIVE", allow: [] }),
tokenBucket({ // Token bucket rate limiting is best for AI budget control
mode: "LIVE",
characteristics: ["userId"], // Link limits to users
refillRate: 2_000, // Refill 2000 tokens per interval
interval: "1h", // Refill interval
capacity: 5_000, // Max tokens
}),
]

The get started guide shows the combined pattern.