Most developers assume moderation is expensive because large companies make it look that way. You don't need a 6-figure "Trust & Safety" budget or an expensive enterprise SaaS subscription (like Hive) to automate content moderation using AI.
It's possible to develop your own automated content moderation system that is reliable and robust and it costs next to nothing. A key part of the pipeline are LLM prompts that act as the moderation engine.
Developing and debugging the moderation prompts is now easier than ever using moder8.net
Using a cost effective model such as Google's gemini-2.5-flash-lite it costs less than $0.50 to moderate 5,000 submissions.
Of course you can integrate your moderation prompt with any stack and model including those that are free. I use Gemini because I've found it performs its moderation task reliably.
Broadly the process is:
Starting with base case definitions for each safety category and brand protective, iteratively apply adversarial tetsing to refine and debug the prompts to catch elusive edge cases.
After rigorous testing incorporate the full compiled systemInstructions into your own moderation pipeline.
- export const runModeration = async (req, res, next) => {
- try {
- // systemInstructions designed at https://moder8.net
- const startDate = new Date();
- if (!ai) ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
- const contents = `Analyze the following content:\n<CONTENT>\n${userInput}\n</CONTENT>`;
- const maxModerationInputTokens = parseInt(process.env.MAX_MODERATION_INPUT_TOKENS);
- const maxModerationOutputTokens = parseInt(process.env.MAX_MODERATION_OUTPUT_TOKENS);
- const tokensResponse = await ai.models.countTokens({
- model: "gemini-2.5-flash-lite",
- contents: systemInstructions + '\n' + contents,
- config: {
- //systemInstruction: systemInstructions,
- // Force JSON output so it's easy to parse in your code
- responseMimeType: 'application/json',
- temperature: 0.1 // Keep it consistent and strictly following rules
- }
- });
- if (tokensResponse.totalTokens > maxModerationInputTokens) {
- const error = new Error('Maximum tokens exceeded.');
- return next(error);
- }
- const response = await ai.models.generateContent({
- model: "gemini-2.5-flash-lite",
- contents: contents,
- config: {
- systemInstruction: systemInstructions,
- // Force JSON output so it's easy to parse in your code
- responseMimeType: 'application/json',
- temperature: 0.1, // Keep it consistent and strictly following rules
- maxOutputTokens: maxModerationOutputTokens
- }
- });
- res.status(200).send(response);
- } catch (e) {
- const newError = new Error(`Error attempting moderation call:\n${e.toString()}`);
- return next(newError);
- }
- }
I offer an initial prototype or technical assessment for qualified projects. Contact me
for more information.