Links
- GitHub: https://github.com/Resk-Security/Resk-LLM
- PyPI: https://pypi.org/project/resk-llm
- Website: https://resk.fr
If you deploy an LLM in production you need layered security. System prompts help but they are not enough. Jailbreaks, prompt injections and exfiltration attempts can bypass instruction-based filters entirely.
Resk-LLM is an open source Python security toolkit that detects 11 categories of threats and integrates as FastAPI middleware. Lets see how easy it is to add.
Installation
pip install resk-llm
Quick Start
Add the security middleware to any FastAPI app:
from fastapi import FastAPI
from resk_llm import SecurityMiddleware
app = FastAPI()
# Enable all 11 detectors with default settings
app.add_middleware(SecurityMiddleware)
@app.post("/chat")
async def chat(prompt: str):
# Your LLM call here
# SecurityMiddleware handles detection automatically
return {"response": await call_llm(prompt)}
What gets detected:
- Prompt injection and jailbreak attempts
- PII and sensitive data leaks
- Code exfiltration and system prompt extraction
- Token smuggling and adversarial suffix attacks
- And 7 more categories covering the OWASP LLM Top 10
Threat Response
Each detection can be configured to:
- Block: Reject the request entirely
- Flag: Log the attempt and let it pass
- Replace: Sanitise the offending content
resk-logits Integration
For token-level blocking pair Resk-LLM with resk-logits. Dangerous tokens are shadow-banned at the logits layer via GPU accelerated Aho-Corasick matching. The model never even generates the first token of a forbidden phrase.
Why Use It
- Single pip install covers your entire threat surface
- Production-ready FastAPI middleware drops in with one line
- Open source under MIT licensed
- Active development and community contributions on GitHub
get started today: pip install resk-llm
https://github.com/Resk-Security/Resk-LLM
https://pypi.org/project/resk-llm
https://resk.fr
Top comments (0)