AI Safety
How to Detect Prompt Injection
Block injection attempts before they reach your LLM.
Pre-screen prompts and post-screen completions with one API.
What it detects
- • Direct injection attempts
- • Indirect injection via retrieved content
- • Jailbreak prompts
- • Instruction override patterns
- • Data exfiltration probes
- • Custom rules
Why developers choose Vettly
- • Pre-built prompt-injection policy
- • Catches novel and known attacks
- • Same API for input and output checks
- • Audit trails for every blocked attempt
Example request
bashconst result = await vettly.check({
content: userPrompt,
contentType: 'text',
policyId: 'prompt-injection',
});
if (result.action === 'block') {
return { error: 'Prompt rejected', reasons: result.categories };
}
const completion = await llm.complete(userPrompt);
const safety = await vettly.check({
content: completion,
contentType: 'text',
policyId: 'llm-output',
});Example response
json{
"flagged": true,
"action": "block",
"categories": {
"harassment": 0.93,
"hate": 0.02
},
"policy": "default",
"latency_ms": 142
}Compared to regex-based detection
Regex misses semantic injection. AI evaluators score by intent, not exact wording.
See the AI chatbot patternKeep exploring
AI Chatbot Moderation API
Moderate inputs and LLM outputs in real time. Block prompt injection, NSFW content, and policy violations before users see them.
Vettly vs OpenAI Moderation
Multi-modal coverage, dashboards, and provider freedom vs text-only checks.
Content Moderation API
One endpoint for text, image, and video moderation.
Content Moderation in Next.js
Add content moderation to a Next.js App Router project in minutes. Route Handlers, Server Actions, edge runtime, policy setup, and safe error handling.