Unprofane

Python (googleapiclient)

The Google client builds itself from a discovery document. Ours serves the same document, so the client keeps working.

1. Change the build call

Pass the Unprofane discovery URL and your key. Everything after this line is unchanged.

from googleapiclient import discovery

client = discovery.build(
    "commentanalyzer",
    "v1alpha1",
    developerKey="up_live_YOUR_KEY",
    discoveryServiceUrl="https://api.unprofane.com/$discovery/rest?version=v1alpha1",
    static_discovery=False,
)

response = client.comments().analyze(body={
    "comment": {"text": "you are a clown"},
    "requestedAttributes": {"TOXICITY": {}},
    "languages": ["en"],
    "doNotStore": True,
}).execute()

print(response["attributeScores"]["TOXICITY"]["summaryScore"]["value"])

2. Or skip the client

The endpoint is one POST; the raw HTTP guide shows it with httpx in six lines.

Then

Map your thresholds with the replay tool, and read what is different. The other guides are on the migration hub.