Prompt Inspector is an open-source prompt injection detection platform that protects LLM applications and AI agents from prompt injection attacks, jailbreak attempts, and sensitive content leaks using a 5-layer detection funnel architecture. It acts as a guardrail layer between untrusted user input and the language model, catching threats before they reach the LLM with sub-50ms response times. It is listed in the AI security category.
Instead of relying on a single model or a simple keyword list, Prompt Inspector passes each input through five progressive filtering stages — from a near-instant hash cache for known threats to semantic vector analysis and AI-powered review for novel attacks. This keeps latency low (most requests resolve in under 50ms) while still catching edge cases.
What is Prompt Inspector?
Prompt Inspector sits between your application and your LLM, inspecting every user input before it reaches the model. The 5-layer detection funnel acts as progressively finer filters — fast, cheap layers catch obvious threats early, while slower, more sophisticated layers handle ambiguous inputs that slip through.
The funnel approach means the platform does not need to invoke expensive AI review for every request. Known threats get caught by hash matching in microseconds, common attack patterns by keyword matching in milliseconds. Only genuinely ambiguous inputs escalate to the semantic and AI review layers.
Key Features
| Feature | Details |
|---|---|
| Detection Approach | 5-layer funnel: hash cache, keyword matching, semantic analysis, AI review, arbitration |
| Response Time | 10-42ms for most requests; near-zero for cached threats |
| Cost Efficiency | 60-95% lower cost, 2-7x faster than LLM-only detection |
| Payload Library | Million-scale, auto-enriched from production traffic |
| Threat Types | Prompt injection, jailbreaks, sensitive content, system prompt leaks |
| Tenant Isolation | Per-app API keys, configuration, rate limits, and logs |
| Custom Word Lists | Per-tenant sensitive word and regex pattern filtering |
| Integration | REST API, Python SDK, Node.js SDK, MCP server, Anthropic Agent Skills |
| Self-Hosting | Python 3.11+, FastAPI, PostgreSQL + pgvector, Redis |
| License | AGPL-3.0 (open-source); commercial enterprise edition available |
Detection Architecture
The 5-layer funnel processes each input through progressively deeper analysis:
| Layer | Method | Speed | Purpose |
|---|---|---|---|
| 1. Hash Cache | SHA-256 lookup | Near-zero latency | Instantly blocks previously seen malicious inputs |
| 2. Keyword Matching | Aho-Corasick pattern matching | Microseconds | Catches known attack patterns and sensitive words |
| 3. Semantic Analysis | Vector embeddings via pgvector | Milliseconds | Detects meaning-level similarities to known attacks |
| 4. AI Review | LLM-based assessment | Slower, higher cost | Evaluates ambiguous edge cases that other layers cannot classify |
| 5. Arbitration | Score aggregation | Fast | Combines signals from all layers into a final confidence score and decision |
Most malicious inputs are caught by layers 1-3, which are fast and cheap. The AI review layer (layer 4) only fires for inputs where the earlier layers produce ambiguous signals, keeping overall cost low.
Tenant Isolation
Prompt Inspector supports multi-tenant deployments where each application gets its own isolated environment. Each tenant has dedicated API keys, custom configuration (including sensitive word lists), independent rate limits, and separate logging. This makes it practical for organizations running multiple LLM applications with different threat profiles.
Custom Sensitive Word Lists
Beyond the built-in detection layers, each tenant can define custom sensitive word and regex pattern lists. These are matched in layer 2 (keyword matching) using high-performance Aho-Corasick automaton algorithms, adding organization-specific filtering without impacting detection speed.
Getting Started
pip install prompt-inspector), Node.js SDK (npm install prompt-inspector), or MCP server for IDE integration with Cursor, VS Code, or Claude Desktop.When to Use Prompt Inspector
Prompt Inspector works well for development teams building LLM-powered applications that need prompt injection protection without adding significant latency or cost. The multi-layer funnel is particularly effective when you need real-time detection (the hash cache and keyword layers respond in microseconds), cost efficiency (most threats get caught before reaching the expensive AI review layer), and self-hosted control (the open-source version runs on your infrastructure with no external dependencies).
How Prompt Inspector Compares
Prompt Inspector focuses on input-side detection — catching malicious prompts before they reach the model. For a commercial prompt injection API with large-scale training data, see Lakera Guard. For output-side guardrails that also validate LLM responses, consider LLM Guard or NeMo Guardrails. For full inference-layer security with policy-based access controls, look at CalypsoAI or Prompt Security.
For pre-deployment vulnerability scanning rather than runtime detection, see Augustus, Garak, or FuzzyAI.
For a broader overview of AI security tools, see the AI security tools category page.