Skip to main content

openspective

openspective

Google's Perspective API shuts down on December 31, 2026. This is the drop-in replacement you run yourself.

CI PyPI Docker image OpenSSF Scorecard Apache-2.0 license

Docs · Getting started · Migrate a client · Compatibility


Comment sections, forums, Discord bots and LLM safety benchmarks score text with Perspective. Jigsaw is shutting it down at the end of 2026 and isn't offering a successor or migration support.

openspective answers the same requests with the same JSON. Change the URL your client calls, and keep the rest of your code.

docker run -p 8080:8080 ghcr.io/aryan-tah/openspective
curl -s localhost:8080/v1alpha1/comments:analyze \
  -H 'content-type: application/json' \
  -d '{"comment": {"text": "Thanks for the article. You are a clueless idiot though."},
       "requestedAttributes": {"TOXICITY": {}, "INSULT": {}},
       "spanAnnotations": true}'
{
  "attributeScores": {
    "TOXICITY": {
      "spanScores": [
        {"begin": 0,  "end": 23, "score": {"value": 0.0004, "type": "PROBABILITY"}},
        {"begin": 24, "end": 56, "score": {"value": 0.9966, "type": "PROBABILITY"}}
      ],
      "summaryScore": {"value": 0.9965, "type": "PROBABILITY"}
    },
    "INSULT": { … }
  },
  "languages": ["en"],
  "detectedLanguages": ["en"]
}

Why openspective

openspective Other open-source options Hosted moderation APIs
Perspective's request and response format ✅ Same paths, fields, spans, errors and discovery document ❌ Their own formats ❌ Different APIs and categories
Works with Google's own client library ✅ Tested in CI ❌ ❌
Languages English, plus TOXICITY in fr, es, it, pt, tr, ru English only Varies
Runs on your servers ✅ One container, CPU only, works offline ✅ ❌ Comments leave your network
Cost Your hardware Your hardware Per request
Model license Apache-2.0 Varies Closed

What it scores

Attribute Languages
TOXICITY en, fr, es, it, pt, tr, ru
SEVERE_TOXICITY, IDENTITY_ATTACK, INSULT, PROFANITY, THREAT, SEXUALLY_EXPLICIT en

Scores come from Detoxify's Apache-2.0 models, which were trained on Jigsaw's own Kaggle data. In published comparisons, Detoxify's scores correlate with Perspective's at r = 0.85 to 0.91. Perspective's _EXPERIMENTAL attribute names are accepted too.

Attributes no open model covers yet (FLIRTATION, the NYT and bridging attributes), and languages not listed above, return the same error Perspective returns for an unsupported language, so dropUnsupportedAttributes and your existing error handling keep working. More languages are the top item on the roadmap.

Switching your client

Client How to switch
Your own code calling the REST API Change https://commentanalyzer.googleapis.com to your server's URL
Python googleapiclient Pass discoveryServiceUrl="https://your-server/$discovery/rest?version=v1alpha1"
Coral Talk Change the endpoint in admin settings
Discourse, HELM, RealToxicityPrompts, lm-evaluation-harness, npm, R and Discord bot clients One-line patch; the URL is hard-coded

Scores come from different models, so re-check any thresholds on a sample of your own comments while Perspective still runs. The compatibility page lists every known difference.

Run it

# Docker: models included, starts offline, ~2.5 GB of memory
docker run -p 8080:8080 -e OPENSPECTIVE_API_KEYS=your-key ghcr.io/aryan-tah/openspective

# Python 3.11+
pip install openspective
openspective serve --host 0.0.0.0 --port 8080

# Score from the command line
openspective score "You are a clueless idiot"

A one-sentence comment takes about 20 ms on a laptop CPU. All settings are environment variables. Comments are never stored.

Contributing

The most useful contributions right now:

  • Scores from Perspective, while it still runs, for text you're allowed to share. They're how openspective's calibration gets checked. Use the wrong score form.
  • A client that breaks against openspective. That's a compatibility bug; report it.
  • Migration guides for clients not covered yet.

See CONTRIBUTING.md for development setup.

License

Apache-2.0 © Aryan Tah. Model licenses are listed in NOTICE.

openspective is an independent project. It is not affiliated with or endorsed by Google or Jigsaw. "Perspective API" is used only to describe the API it's compatible with.

Metadata

Release files for openspective 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openspective 0.1.0
File Size Uploaded Provenance Actions
openspective-0.1.0.tar.gz 24.1 kB With provenance Details for openspective-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openspective 0.1.0
File Interpreter ABI Platform Actions
openspective-0.1.0-py3-none-any.whl Python 3 none any Details for openspective-0.1.0-py3-none-any.whl

Total release size: 50.8 kB

Release files / openspective-0.1.0.tar.gz

Download URL openspective-0.1.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e22e5a2d8d0b41f88ff197db03a0eb78bc5610904e3fc9a2c2704b10abbc757a
BLAKE2b-256 checksum
How to use checksums
dfab392416ad22b733c9d26291cf117428d381201d5b43076265ab6080c8c0cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / openspective-0.1.0-py3-none-any.whl

Download URL openspective-0.1.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb518a209b5752c9f6cdcf8d9a1940abd1b3a4e695363ca02cf62600c922b2b4
BLAKE2b-256 checksum
How to use checksums
e2e61a4ff378334afc5e96356601324934c7bda0620179e606479f643f31e361
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for openspective 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openspective-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page