00:00 / 00:00

Rinnegan

AI Review

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:

ModeDescription
offDefault. Never calls an external AI API and enforces policy purely from local detector verdicts.
confirmConfirmation 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.
assistAssist 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): Calls https://openrouter.ai/api/alpha/decisions with default model typesafe/jev-1.13 using your OpenRouter API key.
  • Typesafe Native Protocol (--ai-protocol typesafe): Calls https://api.typesafe.ai/v1/systemone with default model jev-latest using your Typesafe API key.
  • Default Timeout: 8000 ms.
RINNEGAN_AI_API_KEY=sk-or-... \
  rinnegan live --room 21452505 --ai confirm

OpenAI-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-base or RINNEGAN_AI_BASE).
  • Default Timeout: 30000 ms, called with temperature: 0 and stream: 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 to json_object and 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-mini

Privacy 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 offsetSec relative 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 to 0.8 (range (0, 1]). A candidate is approved for banning only when probability >= threshold.
  • Hourly Budget (ai.maxPerHour): Defaults to 120 review 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 least 10 points 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.

AI Configuration Reference

Prop

Type

Last updated on November 29, 2026

Tech otakus destroy the world