LAPLACE Rinnegan's local heuristic detector works out of the box without any external service. When you want to further reduce edge-case false positives or catch high-scoring borderline cases, you can enable the optional AI review layer to verify candidates before calling the ban API.
Review Modes
Select the review mode via --ai <mode> or the RINNEGAN_AI_MODE environment variable:
| Mode | Description |
|---|---|
off | Default. Never calls an external AI API and enforces policy purely from local detector verdicts. |
confirm | Confirmation mode. Every user judged spam by the local detector must be approved by the AI reviewer (probability at or above the threshold) before a ban is placed; if the AI vetoes the candidate, the ban is skipped. |
assist | Assist mode. In addition to confirming every spam verdict, also sends strong suspect users with partial automation proof (proof >= 0.5) and high score (score >= 75) to the AI reviewer. Users who only repeat messages without automation signals are never banned. |
Review Providers
Switch the underlying review engine with --ai-provider <jev|llm> (or RINNEGAN_AI_PROVIDER):
Typesafe Jev Decision Model (jev)
The default provider (--ai-provider jev) uses Typesafe's Jev decision model to evaluate a binary probability question (dulunche) directly in [0, 1], offering low latency without free-form text parsing:
- OpenRouter Protocol (
--ai-protocol openrouter, default): Callshttps://openrouter.ai/api/alpha/decisionswith default modeltypesafe/jev-1.13using your OpenRouter API key. - Typesafe Native Protocol (
--ai-protocol typesafe): Callshttps://api.typesafe.ai/v1/systemonewith default modeljev-latestusing your Typesafe API key. - Default Timeout:
8000ms.
RINNEGAN_AI_API_KEY=sk-or-... \
rinnegan live --room 21452505 --ai confirmOpenAI-Compatible Chat Models (llm)
Pass --ai-provider llm to use any service compatible with OpenAI's POST /chat/completions endpoint (such as OpenRouter, OpenAI, or a self-hosted inference server):
- Default Base URL:
https://openrouter.ai/api/v1(override with--ai-baseorRINNEGAN_AI_BASE). - Default Timeout:
30000ms, called withtemperature: 0andstream: false. - Automatic Structured-Output Fallback: Requests a strict
json_schema(dulunche_review) first; if the upstream model rejects that format, the process automatically falls back tojson_objectand then to plain-text JSON extraction (stripping<think>...</think>blocks and code fences).
RINNEGAN_AI_API_KEY=sk-or-... \
rinnegan live --room 21452505 \
--ai confirm --ai-provider llm --ai-model openai/gpt-5.1-miniPrivacy Boundaries and Quota Protection
- Minimal Context and Privacy: The payload sent to the reviewer contains only the user's messages inside the sliding window (with
offsetSecrelative to the first message) and the local detector's numeric features (score, pattern, automation signals, interval CV, and cluster summaries). User UIDs and display names are never sent to the AI provider. - Decision Threshold (
--ai-threshold): Defaults to0.8(range(0, 1]). A candidate is approved for banning only whenprobability >= threshold. - Hourly Budget (
ai.maxPerHour): Defaults to120review calls per rolling hour. Once the quota is reached, further reviews are skipped and logged to prevent unexpected costs during chat spikes. - Veto Cooldown and Error Backoff:
- When the AI reviewer vetoes (
veto) a candidate, that user is not reviewed again unless their local detector score climbs by at least10points on subsequent messages. - When a request times out or fails, Rinnegan skips the ban and waits for a
60-second backoff before retrying that user.
- When the AI reviewer vetoes (
AI Configuration Reference
Prop
Type
Last updated on November 29, 2026