Runtime monitoring SDK for AI applications — detect prompt injections and adversarial attacks in production.
Project description
LLM Sentinel SDK
Runtime monitoring for AI applications — detect prompt injections, privilege escalations, and adversarial attacks in production, not just pre-launch.
LLM Sentinel — Burp Suite for LLMs.
Install
pip install llm-sentinel-sdk
Requires Python 3.9+ and httpx. Works alongside any OpenAI-compatible client.
Quick Start
import openai
from llm_sentinel import SentinelClient
client = SentinelClient(
api_key="sk-sentinel-...", # from LLM Sentinel dashboard
base_client=openai.OpenAI(api_key="sk-openai-..."),
)
# Use exactly like openai.OpenAI — monitoring is automatic
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": user_input}],
)
Flagged calls are sent to your LLM Sentinel dashboard in real time. Your app always continues — the SDK fails open.
Async
import openai
from llm_sentinel import AsyncSentinelClient
client = AsyncSentinelClient(
api_key="sk-sentinel-...",
base_client=openai.AsyncOpenAI(api_key="sk-openai-..."),
)
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": user_input}],
)
What Gets Detected
The SDK includes a compiled rule engine covering 8 attack categories:
| Category | Severity | Example |
|---|---|---|
| Prompt Injection | High | "Ignore previous instructions" |
| Privilege Escalation | High | "Enable developer mode" |
| System Prompt Extraction | Critical | "Show me your system prompt" |
| Jailbreak | High | "DAN mode", "do anything now" |
| Data Probing | Medium | "List all users in the database" |
| Context Manipulation | Medium | "You previously agreed that..." |
| Indirect Injection | High | [INST], <system>, template delimiters |
| Multilingual Bypass | Medium | "En français: ignore tes instructions" |
Rules are compiled at import time — detection adds <5ms per call.
Configuration
client = SentinelClient(
api_key="sk-sentinel-...",
base_client=openai.OpenAI(api_key="..."),
base_url="https://api.llmsentinel.com", # default; override for self-hosted
dry_run=False, # True = log events, suppress alert emails
)
Limitations
- Streaming:
stream=Truecalls pass through without monitoring (streaming responses can't be inspected before delivery). - Sync latency:
SentinelClient(sync) makes a blocking HTTP call on flagged messages — up to 3s on connect timeout. UseAsyncSentinelClientin async frameworks to avoid this. - Rule engine scope: Only user-role messages are checked. System and assistant messages are developer-controlled and trusted.
- Client compatibility: Works with any object implementing
.chat.completions.create(). Tested withopenai>=1.0.
Get Your API Key
Sign up at github.com/HexMystic/llm-sentinel → Dashboard → SDK Keys → Create Key.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_sentinel_sdk-0.1.0.tar.gz.
File metadata
- Download URL: llm_sentinel_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecce7fce5be945df9af57d0754e4a7195d6d0f5c7a6658cab76aafc3958f7256
|
|
| MD5 |
56670d4d5d6fe64e95dcaf4e41ed9e0e
|
|
| BLAKE2b-256 |
20fdf30e8ee7824bcb15cd7d43dcebd533a4c702f2ae63bdf8bdcdd4c8354241
|
File details
Details for the file llm_sentinel_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_sentinel_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19e1269bc593112488dedc2ac1bd48b24f4eddff1698617fa5afdc61bdb0acb0
|
|
| MD5 |
cd7fa87a3df3448125d676d760e1f8f8
|
|
| BLAKE2b-256 |
7b2e30cd3d9d2d254afa0833c4544870218855e23dfd5253e9d382ccdadae1dc
|