AI-MOD is an autonomous Twitch & YouTube live chat moderator. Open-source, self-hosted, and fully customizable. Swap your LLM preference (Ornith, GPT-4o, Claude 3.5) via config — no vendor lock-in. Ingests live chat, evaluates against platform community policies + your channel's unique rules, and executes timeouts, message deletions, warnings, or bans silently via MCP tools.
This isn't a one-size-fits-all SaaS bot. Every streamer gets their own isolated instance of AI-MOD, giving you complete code ownership and absolute data privacy. You specialize the mod to your channel's unique rules and culture using plain English, database parameters, or prompt tuning.
Write custom rules in plain English. We generate 384-dimensional vector embeddings via HuggingFace and store them in PostgreSQL. AI-MOD matches incoming chat messages semantically in real-time, catching slang and spelling variations.
rules = 'No backseating, delete game spoilers'
Choose the LLM plan you are already comfortable with. Run a local 9B model like Ornith for free, or connect to OpenAI or Anthropic using existing plans. Switch models with zero code changes.
OLLAMA_MODEL=gpt-4o
Map violations to standard Twitch/YouTube moderation actions. Delete specific messages for minor slip-ups, send private whispers for warnings, enforce timeouts for moderate rule breaking, or issue permanent bans.
actions: ignore | whisper | delete | timeout | ban
Fine-tune moderation severity. Edit the prompt in prompt/templates.py to favor warning first-time offenders, adjust timeout durations, or ignore specific inside jokes entirely.
default_timeout = 600
Skip evaluations entirely for specific users (streamers, regular moderators, friendly bots). They bypass the LLM and DB check, ensuring zero false-positive flags.
TRUSTED_USERS=streamer,moderator_bot
Run a single bot instance to moderate multiple channels. Each channel has its own independent rules, timeout configurations, auto-mod toggles, and logs isolated in PostgreSQL.
TWITCH_CHANNELS=chan1,chan2
Manage stream engagement dynamically. Trigger channel points betting and create or end polls via MCP tools (create_poll, create_prediction) if authorized via OAuth scopes.
scopes: channel:manage:polls | channel:manage:predictions
Enable the mic overlay in OBS. Saying "clip that [title]" triggers a clip on Twitch with that title, then backups the video clip directly to your mapped Google Drive folder.
triggers: "clip that" | "assistant"
AI-MOD is designed from the ground up to protect your stream, your credentials, and your channel’s integrity. We implement strict defense-in-depth security gates across the entire application stack.
All control endpoints are locked behind UUID token authentication (`X-API-Key`) with strict Origin/Referer verification. Disables wildcard credentials to prevent cross-origin (CSRF) hijacks.
Scans incoming chat logs and streamer console inputs against regex-based prompt injection patterns. Enforces a strict server-side whitelist for allowed LLM execution actions.
Runs inside Docker as a non-privileged `appuser` (non-root). Restricts the database and memory stores (Redis, Postgres) to password authentication on an isolated internal bridge network.
Protects hands-free voice controls by deduplicating audio command hashes within a sliding 30-second window, and auto-enforces a rate cooldown to block microphone replay attacks.
AI-MOD operates on two separate AI pipelines. Choose a pathway below and click on any step card to see the technical specifications and a comparison with standard platform capabilities.
Captures live chat events instantly. Bypasses standard LLM processing for pre-configured bypass lists.
🛡️ Trusted Bypass GatePushes messages to a rolling 50-message buffer in Redis to supply conversation context to the LLM.
Converts rules to vector embeddings and queries PostgreSQL using HNSW similarity lookup.
Evaluates context and rule vectors. Whitelists actions before generating execution commands.
🛡️ Action Whitelist ShieldSpawns the MCP subprocess to call the Helix API silently in a local, network-isolated workspace.
🛡️ Stdio SandboxLogs decision hashes, action details, and incoming client IPs securely in PostgreSQL.
🛡️ Encrypted Audit LogsStreamer enters a command on the OBS dashboard. Scans for prompt injection and applies strict length filters.
🛡️ Injection Scan GateBypasses LangChain; sends command to Ollama for structured action JSON.
Resolves Twitch username to ID, and looks up the target message ID in the Redis rolling buffer.
Saves proposed actions to an isolated pending database table. Prevents autonomous command execution.
🛡️ Approval GateBroadcaster reviews and clicks Approve/Deny. Dashboard validates origin and requires secure API key tokens.
🛡️ Token AuthorizationUpon approval, the MCP client spawns the tool subprocess silently with local stdio piping.
🛡️ Stdio SandboxMicrophone capture activates on threshold breach. Deduplicates audio hashes and limits command rates.
🛡️ Voice Replay GuardPOSTs audio internally. Routes to webhook with automated local fallback if the cloud network is offline.
🛡️ Local Fallback GateTranscribes audio inside the local Docker network via natively compiled whisper-server on port 8080 in ~1s.
Queries channel-specific triggers (e.g. "clip that") from Postgres and performs substring matching.
Extracts trailing speech following the trigger word to set as the custom Twitch clip title automatically.
Generates clip and uploads backup. Reads Google API key from mounted Docker secrets instead of env vars.
🛡️ Secret Vault Gate