The change
client = discovery.build(
"commentanalyzer", "v1alpha1",
developerKey=LAYAHOST_API_KEY,
discoveryServiceUrl="https://layahost.com/$discovery/rest?version=v1alpha1",
static_discovery=False,
)
Plain HTTP clients change commentanalyzer.googleapis.com to layahost.com and nothing else. The key can stay in ?key=.
Perspective vs layahost
| Perspective API | layahost | |
|---|---|---|
| Status | Shuts down 31 December 2026; no new projects since February 2026 | Available now |
| API | comments:analyze, comments:suggestscore | Same methods and shapes, plus a discovery document for googleapiclient |
| Attributes | 6 production attributes plus experimental ones | TOXICITY, SEVERE_TOXICITY, IDENTITY_ATTACK, INSULT, PROFANITY, THREAT, SEXUALLY_EXPLICIT |
| Scores | Probability that a reader finds the comment toxic | The same meaning, calibrated on the Civil Comments rater labels |
| Price | Free | $15 per million attribute scores; $1 free credit on sign-up |
| Hosting | Google Cloud | EU (Helsinki, Finland); comment text is not stored |
| Model | Jigsaw’s proprietary models | Laya, open source (Apache-2.0) |
Be honest with yourself about accuracy
Perspective’s models were built for exactly this job. Ours is a general decision model, prompted and calibrated for each attribute. On held-out Civil Comments data, TOXICITY reaches a ROC AUC of 0.93; all attributes are listed in the docs. The same comment will get a different number than it did on Perspective, and your best threshold will move. Score a few hundred of your own comments, compare, and pick thresholds from our scores before switching production.
We also measured layahost against OpenAI’s free moderation endpoint on the same labelled comments: OpenAI Moderation API vs layahost.
When to choose something else
- Images or video. layahost scores text only.
- Many languages with equal quality. Laya is English-first; other languages are scored, but less accurately.
- A full moderation workflow with review queues, appeals and moderator seats. That is a different kind of product; layahost is the scoring API underneath.
What it costs
Each requested attribute is one decision. Scoring a million comments for TOXICITY is a million decisions; asking for all 7 attributes is 7 million. The Starter plan includes 1M decisions for $9 a month and Pro 10M for $49; without a plan, prepaid credit costs $15 per million. Failed requests are free. Verifying your email adds $1 to test with. See pricing.
Perspective shutdown timeline
| Date | What happens |
|---|---|
| February 2026 | Google stops accepting new Perspective API projects and quota increases. |
| 31 December 2026 | The API shuts down. Requests to commentanalyzer.googleapis.com stop working; Google offers no migration support. |
| Before then | Point your client at layahost, re-check your thresholds on a few hundred of your own comments with a test set, and switch. |
Using a tool rather than your own code? Coral has a custom endpoint setting. The Discourse plugin, Stanford HELM, lm-evaluation-harness and others have Google’s address built in and need one line changed in your copy; see integrations. If yours has the Google host hard-coded, ask its maintainer to make it configurable, or write to [email protected] and we will help.
FAQ
Is layahost affiliated with Google or Jigsaw?
No. layahost is an independent service. “Perspective API” is Google’s product name, used here only to describe API compatibility.
Do you store the comments?
No. Comments are processed in memory. Logs keep the scores and metadata for 7 days, and doNotStore is honoured. Details in Data & privacy.
What about suggestscore?
It is accepted and free, so your feedback code keeps running, but nothing is stored or used for training.
Can I test before paying?
Yes. Create an account, verify your email and you get $1 of credit. No card needed.