DEV Community

SOLRICKS
SOLRICKS

Posted on AI-assisted

Building an Open-Source Safety Checker for Public AI Generation

At SOLRICKS, we have been working on self-hosted AI generation systems, custom models, and GPU-optimized workflows.

One of the challenges of making AI generation publicly accessible is handling user prompts before they reach the generation pipeline.

To address this, we developed Safety Checker, a lightweight, open-source custom node for ComfyUI.

Key Features

  • Multilingual: Prompt filtering across 15 languages.
  • Rule-based: Content safety checks without an additional AI model.
  • SHA-256: Hashed keyword and phrase definitions.
  • CPU-only: No additional VRAM requirements.
  • Lightweight: No external dependencies.
  • Model-free: No model downloads or API keys required.
  • Compatibility: Designed for public AI image and video generation workflows.

How It Works

Safety Checker sits between the user's text input and the text encoder.

Prompt → Safety Checker → CLIP Text Encode → Generation

If a prompt violates the configured content rules, workflow execution stops before image or video generation.

This approach provides a lightweight filtering layer without loading an additional AI model.

Real-World Integration

We have integrated Safety Checker into our public AI generation services using ComfyUI, Node.js, and Next.js.

Our backend handles restricted prompts with:

  • HTTP 422 responses.
  • Localized error messages.
  • Server-side execution logging.
  • Generation request timing.
  • Prompt validation before generation.

Safety Checker is a rule-based prompt filter, not an image moderation model. It is designed to serve as one layer of a broader content safety system.

Installation

Install the SOLRICKS Optimization Pack through ComfyUI Manager by searching for SOLRICKS, or visit our GitHub repository.


Open-Source Repository

The Safety Checker is available as part of the SOLRICKS ComfyUI Optimization Pack.

Feedback, contributions, and suggestions from the open-source community are welcome.

Top comments (0)