> ## Documentation Index
> Fetch the complete documentation index at: https://docs.commentify.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# AI toxicity scoring

> Optional Google Perspective checker. Hold or deny by score with COMMENTIFY_PERSPECTIVE_KEY.

Toxicity is an **opt-in** spam checker. It is billed per call. The installer will not enable it unless you pass `--spam=toxicity` (and it reminds you to set the key).

```env theme={null}
COMMENTIFY_PERSPECTIVE_KEY=your-google-api-key
```

```php theme={null}
'spam' => [
    'checkers' => ['heuristic', 'toxicity'],
],

'toxicity' => [
    'key' => env('COMMENTIFY_PERSPECTIVE_KEY'),
    'hold_threshold' => 0.7,
    'deny_threshold' => 0.9,
    'attributes' => [
        'TOXICITY',
        'SEVERE_TOXICITY',
        'IDENTITY_ATTACK',
        'INSULT',
        'THREAT',
    ],
],
```

The checker POSTs to `https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze` with `languages: ['en']`. It takes the **max** `summaryScore.value` across requested attributes.

| Score                    | Verdict                                   |
| ------------------------ | ----------------------------------------- |
| ≥ `deny_threshold` (0.9) | **deny** `toxicity:{score}`               |
| ≥ `hold_threshold` (0.7) | **review** `toxicity:{score}`             |
| below hold, or blank key | **allow** (blank key skips the HTTP call) |

Timeouts and HTTP errors follow `spam.fail_mode` (`allow` or `review`). Put `heuristic` **before** `toxicity` so cheap local denies skip the paid API.

English-only in this version (`languages => ['en']`). Tune thresholds on a staging thread before you roll out to production guests.
