add-ai-protection
Add AI-Specific Security with Arcjet
Secure AI/LLM endpoints with layered protection: prompt injection detection, PII blocking, and token budget rate limiting. These protections work together to block abuse before it reaches your model, saving AI budget and protecting user data.
Reference
Read https://docs.arcjet.com/llms.txt for comprehensive SDK documentation covering all frameworks, rule types, and configuration options.
Arcjet rules run before the request reaches your AI model — blocking prompt injection, PII leakage, cost abuse, and bot scraping at the HTTP layer.
Step 1: Ensure Arcjet Is Set Up
Check for an existing shared Arcjet client (see the protect-route skill for full setup). If none exists, set one up first. The user will need to register for an Arcjet account at https://app.arcjet.com then use the ARCJET_KEY in their environment variables.
Step 2: Add AI Protection Rules
AI endpoints should combine these rules on the shared instance using withRule():