A security API that scans text for common prompt injection patterns and returns a risk score. Designed for AI agents that process untrusted text input from external sources.
bash
pip install fastapi uvicorn pydantic
Start the server:
bash
uvicorn promptguard.app:app --port 8000
Then send a POST request:
bash
curl -X POST http://localhost:8000/v1/scan \
-H "Content-Type: application/json" \
-d '{"text": "What is the weather in London today?"}'
Response (clean text):
json
{
"risk_score": "0",
"patterns_detected": [],
"input_length": 38
}
FieldTypeRequiredDescriptiontextstringyesText to scan (1-100,000 chars)
FieldTypeDescriptionrisk_scoredecimal0.0 (safe) to 1.0 (high risk)patterns_detectedlistNames of detected patternsinput_lengthintegerLength of input text