Unprofane

Move raw HTTP calls off the Perspective API

Change the host. Everything else is the request you already send.

Tested with the request as printed, on every run of the snippet checks. How

cURL

What changes

Any HTTP client
Remove: curl -X POST "https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=YOUR_GOOGLE_KEY" \Add: curl -X POST "https://api.unprofane.com/v1alpha1/comments:analyze?key=up_test_YOUR_KEY" \-H "Content-Type: application/json" \-d '{"comment": {"text": "you are a clown"},"requestedAttributes": {"TOXICITY": {}, "INSULT": {}},"languages": ["en"],"doNotStore": true}'

1 line changes. The same POST body and the same response on the Unprofane host, with the key as ?key= or a bearer header.

Tested with the request as printed, on every run of the snippet checks.

  • Unchanged
  • The path
  • The request body
  • The response
  • The errors
  • The ?key= parameter

1. Make an Unprofane key for each environment

Sign in and make two keys on the keys page of the dashboard: a test key (up_test_…) for staging and a live key (up_live_…) for production. A test key is free and answers 100 checks a month across the account; a live key needs a plan. Keep your Google key: it is your way back until Google’s service ends on December 31, 2026.

2. The request

The path, the body and the key parameter are Google’s. A bearer header works too. Keep the host and the key in configuration, so staging (the test key) and production (the live key) differ only in values.

curl -X POST "https://api.unprofane.com/v1alpha1/comments:analyze?key=up_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "comment": {"text": "you are a clown"},
    "requestedAttributes": {"TOXICITY": {}, "INSULT": {}},
    "languages": ["en"],
    "doNotStore": true
  }'

3. The response

attributeScores with a summaryScore and spanScores per attribute, languages, detectedLanguages. Errors use Google’s envelope: code, message, status. The numbers below show the shape, not a score to expect.

{
  "attributeScores": {
    "TOXICITY": {
      "spanScores": [{ "begin": 0, "end": 15, "score": { "value": 0.71, "type": "PROBABILITY" } }],
      "summaryScore": { "value": 0.71, "type": "PROBABILITY" }
    },
    "INSULT": { "summaryScore": { "value": 0.78, "type": "PROBABILITY" }, "spanScores": [] }
  },
  "languages": ["en"],
  "detectedLanguages": ["en"]
}

4. Set the threshold on staging

Do not carry the old number over: the scores come from a different engine, so 0.8 there is not 0.8 here. The replay tool takes a CSV of recent texts with the scores Perspective gave them and shows, for each old threshold, the threshold here that flags the same share, and how often the two flags agree. A queue of the same size is not proof of the same accuracy: two thresholds can flag the same number of comments and disagree on which ones, and agreement with Perspective repeats its mistakes. Before production, run a sample your moderators have already decided (approved and removed) through staging, and for each candidate threshold count the removed items it catches and the approved items it flags. Read the disagreements, then choose.

What carries over, and what does not

Carries over

  • The path /v1alpha1/comments:analyze, the request body and the response shape: attributeScores with summaryScore and spanScores, languages, detectedLanguages.
  • The error envelope (code, message, status) and Google’s words for each refusal, with Google’s status.
  • The key as ?key=, the first one when a client sends two, or as an X-Goog-Api-Key header.
  • comments:suggestscore, answered with {} as Google answered it.

Not supported

  • The other New York Times attributes (LIKELY_TO_REJECT, SPAM, INFLAMMATORY and the rest) and the bridging attributes are not scored: a request for one is refused as Google refused an attribute it did not know, or left out with dropUnsupportedAttributes.
  • A moderator’s score sent to suggestscore is kept as a correction on your account, beside the score we gave, and read by a person; it changes no score until a later engine.
  • Google’s account errors (a key restricted to a referrer or an address, the API not enabled, billing) have no counterpart: a key here is valid or it is not.

Scored differently

  • The scores come from a different engine: the rules give each attribute a floor from the matched words and the model’s reading lifts the rest. Until the Civil Comments calibration ships, the scale is the engine’s own rather than a fit to Perspective’s.
  • A RAW score is the same number as the probability.
  • Some comments Google refused are scored: languages it did not score (Hebrew, Turkish and others), SEXUALLY_EXPLICIT outside English, and HTML comments read without their tags.
  • With spanAnnotations, each sentence’s span is scored by the rules on that sentence alone; the summary score is the whole engine’s.

Roll back

Put commentanalyzer.googleapis.com and your Google key back in configuration. This works until Google’s service ends on December 31, 2026.

PERSPECTIVE_HOST=https://commentanalyzer.googleapis.com
PERSPECTIVE_KEY=YOUR_GOOGLE_KEY

How it was tested

This request runs as printed on every run of the snippet checks, with a test key and a live key, and the errors we captured from Google before launch are replayed against the API on every change, each held to Google’s words and status. It passed against the real model on October 13, 2026, and its rollback against Google’s own API on October 13, 2026.

Then

Sources