perspective api
**Perspective API** is a free, ML-powered API developed by **Google's Jigsaw** team that analyzes text and scores it for various **toxicity attributes** — including toxicity, insults, threats, profanity, and identity attacks. It is one of the most widely used tools for **content moderation** and **online safety**.
**How It Works**
- **Input**: Send any text string to the API.
- **Output**: Probability scores (0 to 1) for multiple toxicity attributes:
- **TOXICITY**: Overall likelihood of being perceived as rude, disrespectful, or unreasonable.
- **SEVERE_TOXICITY**: High-confidence toxicity — very hateful or aggressive.
- **INSULT**: Insulting, inflammatory, or negative comment directed at a person.
- **PROFANITY**: Swear words, curse words, or other obscene language.
- **THREAT**: Language expressing intention of harm.
- **IDENTITY_ATTACK**: Negative or hateful targeting of an identity group.
**Use Cases**
- **Comment Moderation**: News sites and forums use Perspective API to flag or filter toxic comments before publication.
- **LLM Safety**: Evaluate LLM outputs for toxicity as part of a safety pipeline — score responses before showing them to users.
- **Research Benchmarking**: Used as a metric in AI safety research to measure toxicity reduction in detoxification experiments.
- **User Feedback**: Show users real-time feedback about the tone of their message before posting.
**Strengths and Limitations**
- **Strengths**: Free to use, supports **multiple languages**, well-maintained, easy API integration, widely validated.
- **Limitations**: Can produce **false positives** on reclaimed language, quotes, and discussions about toxicity. May exhibit **biases** against certain dialects or identity-related terms. Works best on English content.
Perspective API is a foundational tool in the **AI safety** ecosystem, used by organizations like the **New York Times**, **Wikipedia**, and **Reddit** for online content moderation.