# Perspective API Alternative: Profanity & Toxicity Check (`unprofane/perspective-api-alternative`) Actor

Check comments, usernames and chat in bulk for profanity, slurs, insults and threats, with the reason for each. Unprofane, the drop-in Perspective API alternative.

- **URL**: https://apify.com/unprofane/perspective-api-alternative.md
- **Developed by:** [Unprofane](https://apify.com/unprofane) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Perspective API alternative: profanity and toxicity check in bulk

Check comments, usernames, reviews and chat messages for profanity, slurs, insults, threats and sexual language, thousands at a time, with the reason for every decision. The Actor runs on [Unprofane](https://unprofane.com/), a profanity and toxicity API built to be hard to fool, and a drop-in replacement for Google's Perspective API, which stops answering after December 31, 2026.

Feed it a list of texts, or point it at the dataset of another Actor (scraped comments, reviews, usernames) and it returns one row per text: allow, review or block, the words it matched, the disguise each one wore, and a censored copy you can show instead.

### What it catches

- **Disguised words.** Leetspeak (`sh1t`), look-alike letters from other alphabets, invisible characters, spaced and dotted letters (`f.u.c.k`), stretched words (`fuuuuck`), reversed words and 17 kinds of disguise in all, each undone before the words are read and named in the answer.
- **Insults and threats with no swear word in them**, read by a model in balanced mode.
- **17 languages**, detected per text.

### What it lets through

Innocent words that hold a profane string: Scunthorpe, the surname Dickinson, the cockatoo. On the [Scunthorpe Test](https://unprofane.com/bench/scunthorpe/), an open benchmark of 549 innocent words and sentences like these, Unprofane's rules flagged 0.0% of them.

### Measured against Perspective

On the same private test set of blind-labeled texts, at the same share of clean text flagged (7.0%), Unprofane caught **89.0%** of toxic text, the Perspective API 58.4% and OpenAI moderation 40.8% (read once on 2026-09-28). [How it was measured](https://unprofane.com/bench/head-to-head/).

### Moving off the Perspective API

This Actor is for bulk jobs: a backlog of comments, a scraped dataset, a one-off audit. For live traffic you do not need Apify at all: point your Perspective client at `api.unprofane.com` and keep the rest. The request, the JSON and the errors are Google's, at the same path. [The migration guides](https://unprofane.com/perspective/) cover Google's Python and Node clients, Coral and Discourse.

Choose **Perspective API scores** as the output and the rows carry `TOXICITY`, `INSULT`, `PROFANITY`, `THREAT` and the rest as columns, read from the same Perspective-compatible endpoint, so code built on Perspective's scores can read them as they are.

### Input

| Field | What it is |
|---|---|
| Unprofane API key | Yours, from the [dashboard](https://unprofane.com/signin/). `up_test_…` is free with no card; `up_live_…` comes with a plan. |
| Texts | The texts to check, one per item. |
| Dataset, text field | Or read the texts from a dataset: each item's text from the field you name (`text`, or a path such as `comment.body`). The item's other fields come along under `source`. |
| Output | Unprofane's decision with its evidence, or Perspective API scores. |
| What the texts are | Comments, chat, usernames, display names, reviews, game chat. A username is read with its words run together. |
| Audience | Kids, teens, standard, strict or casual: one text can pass for adults and be held for children. |
| Mode | Fast (the rules alone) or balanced (a model reads what the rules cannot settle). |

### Output

One row per text, in input order. With the Unprofane output:

```json
{
  "index": 1,
  "text": "shut up you sh1thead",
  "action": "block",
  "allowed": false,
  "severity": "strong",
  "score": 0.88,
  "matched_terms": "shut up, shithead",
  "evasion": "leetspeak",
  "censored": "******* you ********",
  "reason": "Blocked under the standard policy for an insult: \"shut up\" and \"sh1thead\" (shithead), typed with leetspeak and swearing in the wording.",
  "language": "und",
  "categories": {
    "mild_profanity": 0,
    "profanity": 0.882,
    "sexual": 0,
    "insult": 0.882,
    "slur": 0,
    "threat": 0,
    "rude": 0,
    "sexual_minors": 0,
    "self_harm": 0,
    "reserved": 0
  },
  "engine": "2026-10-18",
  "check_id": "chk_…"
}
```

Download it as JSON, CSV or Excel, or read it from the API like any dataset. A text the API could not check carries an `error` instead of an action.

### Cost

The Actor is free; Apify bills only its usual compute, a few cents for thousands of texts. The checks count against your Unprofane key, and plans start at $9 a month. [Pricing](https://unprofane.com/pricing/).

### Your texts

The Actor keeps nothing: the rows live in your Apify dataset. Unprofane keeps a text for 90 days only when its model reads it, then deletes it; Growth, Scale and Enterprise can turn that off. [What the API keeps](https://unprofane.com/docs/privacy/).

### Questions

**Is this made by Google?** No. Unprofane is independent. It answers the Perspective API's requests in Google's format so that code written for Perspective keeps working.

**Can I call it from my own code instead?** Yes: the same API answers directly at `api.unprofane.com`, with SDKs for [JavaScript and Python](https://unprofane.com/docs/sdks/). Use the Actor when the texts are already on Apify or you want a spreadsheet out.

**What if a word is wrong?** Send a [correction](https://unprofane.com/docs/feedback/) with the check id; a person reads each one.

# Actor input Schema

## `apiKey` (type: `string`):

A server key from your Unprofane dashboard: up_test\_… (free, no card) or up_live\_… (a plan). Get one at https://unprofane.com/signin/. Checks count against that key's plan.

## `texts` (type: `array`):

The comments, usernames or messages to check, one per item.

## `datasetId` (type: `string`):

The ID of a dataset, such as another Actor's scraped comments or reviews. Each item's text is read from the field named below; its other fields are copied to the output as `source`.

## `textField` (type: `string`):

The field holding the text in each dataset item. Dots reach into an object: `comment.body`.

## `format` (type: `string`):

Unprofane: allow, review or block, with the words matched, the disguise each wore and a censored copy. Perspective: TOXICITY, INSULT, PROFANITY and the other scores in Perspective API's shape, for code that already reads them.

## `context` (type: `string`):

A username is read as one with its words run together; a comment as a sentence.

## `policy` (type: `string`):

Who reads the texts: the same text can pass for adults and be held for children.

## `mode` (type: `string`):

Fast: the rules alone, every disguise undone. Balanced: a model reads what the rules cannot settle (insults and threats with no swear word).

## `attributes` (type: `array`):

For the Perspective output only: which scores to return. Empty returns TOXICITY.

## Actor input object example

```json
{
  "texts": [
    "Thanks, that fixed my build.",
    "shut up you sh1thead",
    "xXsh1tXx",
    "Greetings from Scunthorpe!"
  ],
  "textField": "text",
  "format": "unprofane",
  "context": "comment",
  "policy": "standard",
  "mode": "balanced",
  "attributes": [
    "TOXICITY",
    "INSULT",
    "PROFANITY",
    "THREAT"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

Every checked text, in the Decisions view.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "texts": [
        "Thanks, that fixed my build.",
        "shut up you sh1thead",
        "xXsh1tXx",
        "Greetings from Scunthorpe!"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("unprofane/perspective-api-alternative").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "texts": [
        "Thanks, that fixed my build.",
        "shut up you sh1thead",
        "xXsh1tXx",
        "Greetings from Scunthorpe!",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("unprofane/perspective-api-alternative").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "texts": [
    "Thanks, that fixed my build.",
    "shut up you sh1thead",
    "xXsh1tXx",
    "Greetings from Scunthorpe!"
  ]
}' |
apify call unprofane/perspective-api-alternative --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,unprofane/perspective-api-alternative"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/72i8rAhCn9yZRApRM/builds/jx2KDvuOwtjcndKXk/openapi.json
