Skip to main content

Welcome to Guardian API

Guardian API is a production-ready content moderation service that combines multiple AI models and rule-based heuristics to provide comprehensive text analysis. Built with FastAPI, it offers a robust, scalable solution for detecting harmful content across multiple categories.

Get Started

Start moderating content in minutes with our quickstart guide.

Key Features

Multi-Model Architecture

Four coordinated models working together: Sexism classifier, toxicity transformer, rule engine, and ensemble aggregator.

Multi-Label Detection

Detects sexism, toxicity, threats, self-harm, profanity, and other harmful content categories.

Production-Ready

FastAPI backend with proper error handling, logging, rate limiting, and comprehensive testing.

Developer-Friendly

OpenAPI documentation, structured JSON responses, and SDKs for Python and JavaScript/TypeScript.

How It Works

Guardian API uses a sophisticated ensemble approach:
  1. Preprocessing: Text is cleaned and normalized
  2. Model Inference: Three models analyze the content in parallel:
    • Custom LASSO sexism classifier
    • HuggingFace toxicity transformer
    • Rule-based heuristics engine
  3. Ensemble: Results are aggregated using weighted fusion and conflict resolution
  4. Response: Structured JSON with scores, severity levels, and metadata
The ensemble model intelligently combines outputs from all models, with rule-based detections overriding low confidence scores for critical issues like threats and self-harm.

Quick Example

curl -X POST "http://localhost:8000/v1/moderate/text" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your text to moderate here"}'
Response:
{
  "text": "Your text to moderate here",
  "label": {
    "sexism": {"score": 0.12, "severity": "low"},
    "toxicity": {"overall": 0.08},
    "rules": {"slur_detected": false, "threat_detected": false}
  },
  "ensemble": {
    "summary": "likely_safe",
    "score": 0.10,
    "severity": "low"
  },
  "meta": {
    "processing_time_ms": 24,
    "models_used": ["sexism_lasso_v1", "toxic_roberta_v1", "rules_v1"]
  }
}

Next Steps

Use Cases

  • Social Media Platforms: Moderate user comments and posts
  • Chat Applications: Real-time message filtering
  • Content Platforms: Screen user-generated content
  • Community Forums: Maintain healthy discussions
  • Customer Support: Flag inappropriate messages

Author

Guardian API is developed and maintained by Kory Smith. Originally created as a CSC 380 (Machine Learning) sexism classification project at the University of Arizona.