Perspective Migration Guide

Perspective API Migration Guide

Migrate from Google Perspective API Before Shutdown

When does Perspective API shut down? Perspective API stays active until December 31, 2026 and stops after that. Google is not offering migration support. Source: perspectiveapi.com

This practical guide shows how to migrate from Perspective comments:analyze to Paxmod, with side-by-side request examples, attribute mapping, and threshold tuning. Paxmod is not a wire-compatible replacement, so you need a small code change (different endpoint, auth header, and body), but the switch is straightforward.

Perspective API is shutting down

Perspective API stays active until December 31, 2026 and stops after that. Google is not offering migration support. Leave enough time to test thresholds on live traffic before the cutoff. Source: perspectiveapi.com

What changes: Perspective vs. Paxmod

Paxmod is not wire-compatible with Perspective. The endpoint, auth, and request body differ. What you get in return is personal information detection, evasion-resistant normalization, custom plain-English policies, and player context (Studio plan). The core change is small: swap one API call.

WhatPerspectivePaxmod
EndpointPOST /v1alpha1/comments:analyze?key=KEYPOST /api/v1/text
AuthQuery parameter ?key=Header Authorization: Bearer
Requestcomment.text, requestedAttributesmessage, user_id, context_id (optional)
ResponseattributeScores.TOXICITY.summaryScore.valueresult === "flagged" or content_moderation.categories["Harassment"].score
Max length20 KB5,000 characters
AttributesSet per request in requestedAttributesSet per project in the Paxmod console
ThresholdsApplied in your code after getting scoresSet per category in the Paxmod console (default 0.5)

5-step migration plan

  1. 1

    Get a Paxmod API key

    Call POST https://www.paxmod.com/api/v1/agent-key (100 free text messages over 72 hours, no card) or start the 14-day full trial (10,000 messages, includes all features). Copy the API key.

  2. 2

    Map Perspective attributes to Paxmod categories

    In the Paxmod console, pick the categories that match the Perspective attributes you used. For game chat, the Gaming chat preset is a good start and includes personal information detection. See the full mapping table below.

  3. 3

    Change the API call

    Change your code to POST https://www.paxmod.com/api/v1/text with Authorization: Bearer YOUR_API_KEY. Send the text as message (not comment.text), add user_id and context_id if you have them. See the before/after code examples below.

  4. 4

    Shadow-test both APIs side by side

    Until Perspective shuts down, send the same messages to both APIs and compare decisions on your real traffic. Set each Paxmod category threshold in the console (default 0.5). Do not copy Perspective thresholds across blindly.

  5. 5

    Cut over to Paxmod

    Act on Paxmod's decision (result === "flagged"), then remove the Perspective API key and code before the shutdown.

Side-by-side request and response

JavaScript (fetch)

Before (Perspective)

const res = await fetch(
  `https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=${PERSPECTIVE_KEY}`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      comment: { text },
      languages: ["en"],
      requestedAttributes: { TOXICITY: {}, INSULT: {}, THREAT: {} }
    })
  }
);
const data = await res.json();
const toxic = data.attributeScores.TOXICITY.summaryScore.value > 0.8;

After (Paxmod)

const res = await fetch("https://www.paxmod.com/api/v1/text", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${PAXMOD_KEY}`
  },
  body: JSON.stringify({
    message: text,
    user_id: userId,
    context_id: channelId
  })
});
const data = await res.json();
const toxic = data.result === "flagged";
const harassment = data.content_moderation.categories["Harassment"]?.score ?? 0;

Python (requests)

Before (Perspective)

import os, requests

r = requests.post(
    "https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze",
    params={"key": os.environ["PERSPECTIVE_KEY"]},
    json={
        "comment": {"text": text},
        "languages": ["en"],
        "requestedAttributes": {"TOXICITY": {}, "INSULT": {}, "THREAT": {}}
    },
    timeout=5
)
data = r.json()
toxic = data["attributeScores"]["TOXICITY"]["summaryScore"]["value"] > 0.8

After (Paxmod)

import os, requests

r = requests.post(
    "https://www.paxmod.com/api/v1/text",
    headers={"Authorization": f"Bearer {os.environ['PAXMOD_KEY']}"},
    json={
        "message": text,
        "user_id": user_id,
        "context_id": channel_id
    },
    timeout=5
)
data = r.json()
toxic = data.get("result") == "flagged"
harassment = data.get("content_moderation", {}).get("categories", {}).get("Harassment", {}).get("score", 0)

Note: Paxmod accepts up to 5,000 characters per message. Perspective allowed 20 KB. Split longer text and check each part.

Perspective attribute to Paxmod category mapping

Perspective attributePaxmod categoryNotes
TOXICITYHarassment, Hate and Discrimination, ProfanitiesUse the highest of the three scores, or check the top-level result
SEVERE_TOXICITYThreatening, Violence, Hate and DiscriminationUse the highest score
IDENTITY_ATTACKHate and DiscriminationDirect match
INSULTHarassmentHarassment is a little broader
THREATThreatening, ViolenceUse the highest score
PROFANITYProfanitiesTest thresholds on real traffic, since Paxmod and Perspective use different scoring models
SEXUALLY_EXPLICITSexualDirect match
SPAMSpamDirect match (Paxmod Spam category uses Perspective under the hood)
FLIRTATIONNo direct categoryWrite it as an Advanced mode policy, e.g., "Flag romantic or sexual advances toward other players"

Paxmod scores are not Perspective scores. Each Paxmod category has its own threshold (default 0.5, flagged when the score exceeds it). Set thresholds per project in the console after shadow-testing on real traffic.

Transparent pricing (no sales call required)

  • Free test key: 100 text messages over 72 hours via POST /api/v1/agent-key (no account, no card).
  • 14-day free trial: 10,000 messages and every feature switched on (card required, cancel before day 14 and pay nothing).
  • Indie ($29/month): 50,000 message credits included (then $0.40 per 1,000). Standard mode, Advanced plain-English policies, word rules, user analysis.
  • Studio ($149/month): 500,000 message credits included (then $0.25 per 1,000). Adds conversation context, Image API + custom image checks, team seats, priority support.
  • Enterprise (from $1,500/month): Custom volume on an annual contract, EU or Canada data residency, SLA, invoicing, and COPPA-oriented setup.

(Standard text uses 1 credit. Advanced mode text uses 2 credits.)

Ready to test before the shutdown?

1-call test key (for developers and coding agents):

curl -X POST https://www.paxmod.com/api/v1/agent-key \
  -H "Content-Type: application/json" \
  -d '{"name": "Perspective migration test", "source": "migration-guide"}'

Related resources