The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Safeprompt MCP listing page.
Prompt injection detection API. One line of code blocks the attack before your AI reads it.
Protect AI apps, chatbots, and automations from prompt injection, jailbreaks, and data exfiltration. Built for developers who ship fast.
Quick Start · Why SafePrompt · Benchmarks · How It Works · Detection · LangChain · Tests · Uninstall
That's it. One API call between your user input and your LLM. Get a free key at safeprompt.dev.
[!IMPORTANT] Scope. SafePrompt is integration-boundary security: it blocks the instructions that would hijack the AI reading them. That means prompt injection and jailbreaks (instruction override, DAN-style impersonation), system-prompt extraction, exfiltration imperatives, and indirect injection or RAG poisoning. It does not police what your users are allowed to ask: harmful-topic knowledge questions ("what is a keylogger", "how do firewalls work"), harmful-artifact generation with no exfiltration target, and code payloads carried as data (SQL, XSS, shell, template) pass through, because they attack your database or your browser, not the reading AI. Pair it with your LLM provider's moderation layer for content policy. The benchmark numbers are scored under this scope.
Real incidents of the attack class SafePrompt is designed to detect:
| Incident | What Happened | Cost |
|---|---|---|
| Chevrolet (Dec 2023) | Chatbot agreed to sell a new Tahoe for $1 | Viral PR disaster |
| Air Canada (Feb 2024) | A tribunal held the airline to what its chatbot said (an accuracy failure rather than an injection; the lesson is the same) | CA$812 in damages plus fees |
| DPD (Jan 2024) | Support bot wrote hate poems about the company | Viral embarrassment |
These attacks use plain language. A reworded attack walks past a regex and still works on the model, so SafePrompt reads the meaning of the message, not its spelling.
Reproducible detection benchmark on the public API (benchmarks/):
| Metric | Where to find it |
|---|---|
| Attack catch rate and false-positive rate | Rendered on safeprompt.dev at every deploy from the continuous production eval (trailing 30 days, current suite version) |
| Latency | AI-path median and p95 from production api_logs, same page |
| Cadence | Every 6 hours against the production API; runs and failing cases in benchmarks/results/ |
| Suite in this repo | v2.2, 165 cases (85 safe + 80 attack). The production eval moved to suite v3 on 2026-09-04; see benchmarks/README.md |
The runner POSTs every prompt in benchmarks/prompts.json to the live API and prints per-category confusion + writes raw results to benchmarks/results/<timestamp>.json. The API requires an X-User-IP header on every call and answers HTTP 400 without it; run.js sends one by default (override with --user-ip or the SAFEPROMPT_USER_IP env var). See benchmarks/README.md for methodology.
3-layer defense system:
Layer 1: Pattern Detection
Layer 2: AI Validation
Layer 3: Network Intelligence
Result: the suite runs against the production API every 6 hours; current detection and false-positive rates are published on safeprompt.dev and in benchmarks/README.md. We do not measure accuracy on production traffic and do not claim to. (An earlier version of this README reported a single perfect run; continuous measurement since has never reproduced it, and that run was an earlier 100-prompt suite, not the larger current one; see benchmarks/README.md for the full history.)
session_token on the raw call and the verdict sees the earlier turns of the same session (sessions expire after 2 hours idle, 24 hours at most)| Package | Source | Registry |
|---|---|---|
safeprompt (JS / TS) | packages/safeprompt-js | npm |
safeprompt (Python) | packages/safeprompt-python | PyPI |
@safeprompt.dev/langchain | packages/safeprompt-langchain | npm |
safeprompt-langchain (Python) | packages/safeprompt-langchain-python | PyPI |
Validates every prompt flowing through a LangChain chain before it reaches the LLM. See packages/safeprompt-langchain/README.md.
Both headers are required. X-User-IP is the end user's address, not your server's. sensitivity is lenient, balanced (the API default) or strict.
More examples: examples/: n8n, Zapier, multi-turn, custom lists, IP reputation, session tokens.
| Category | Examples |
|---|---|
| Jailbreaks | "Ignore previous instructions", DAN, STAN, DevMode |
| Role Manipulation | "You are now in developer mode", "As your supervisor..." |
| Data Exfiltration | "Send all data to this URL", "Extract user emails" |
| System Prompt Extraction | "Repeat your instructions", "Show me your prompt" |
| External References | Suspicious URLs, IPs, file paths, encoded variants |
| Multi-Turn Context | With a session token, earlier turns of the same session inform the verdict |
| Multi-Language | Attacks in Spanish, French, Japanese, Chinese, and more |
| Indirect Injection | Hidden text in web pages, emails, documents |
What it doesn't flag (by design; those are content-policy or downstream concerns, not attacks on the reading AI):
Pair SafePrompt with your LLM provider's moderation layer if you need both.
Each SDK is tested independently. CI runs Node 18/20/22 + Python 3.9-3.12 on every push and PR (.github/workflows/ci.yml).
SafePrompt is a hosted API. Your text goes to our servers, comes back scored, and blocked prompts are deleted within 24 hours.
If your data can never leave your own machines, run LLM Guard self-hosted. If your stack already lives in Azure, Azure Prompt Shields is one checkbox away. If your buyer needs signed compliance paperwork, Lakera Guard sells that. Everyone else: one line of code, free to start.
Browser extension that checks the page you are reading for hidden prompt-injection text while you use ChatGPT, Claude, and Gemini. It needs a SafePrompt API key and sends page text to the API.
| Resource | Link |
|---|---|
| API Docs | docs.safeprompt.dev |
| Quick Start | docs.safeprompt.dev/quick-start |
| API Reference | docs.safeprompt.dev/api-reference |
| Live Playground | safeprompt.dev/playground |
| Benchmarks | benchmarks/ |
| Blog | safeprompt.dev/blog |
We describe the practice rather than claim a badge:
Full terms: safeprompt.dev/privacy and safeprompt.dev/security.
If you also want to delete your account and all retained data, email privacy@safeprompt.dev from the address on the account. We delete the account and the personal data we hold, including the hashes if you ask for them, within 30 days, and confirm when it is done.
Built by Ian Ho (former eBay technical architect) after discovering prompt injection vulnerabilities while building AI systems for clients. After spending 20+ hours on DIY regex-based protection and watching simple rewrites of known attacks walk right past it, the realization: security shouldn't require enterprise budgets.
SafePrompt gives indie developers and small teams a security layer they would otherwise have to build themselves, at indie prices.
Company: Reboot, Inc. (Las Vegas, Nevada)
Found a bug? Have a suggestion? Open an issue.
PRs welcome. Please use conventional commits (feat:, fix:, docs:, …); the commitlint workflow will reject non-conforming messages on PR.
Security issues: Email security@safeprompt.dev (do not open public issues).
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
This SDK is MIT licensed. The SafePrompt API service is proprietary; see Terms of Service.
Website · Playground · Docs · Dashboard · Chrome Extension · Twitter