Python SDK

Python SDK

Official async + sync Python client for the Supervisor moderation API.

Install

pip install "git+https://github.com/Phosphor-gg/supervisor-sdk-python.git"

Or with uv:

uv pip install "git+https://github.com/Phosphor-gg/supervisor-sdk-python.git"

Requires Python 3.10+. Grab an API key from your dashboard under API Keys.

Moderate text

import asyncio
from supervisor import SupervisorClient

async def main():
    async with SupervisorClient(api_key="sk_prod_...") as client:
        result = await client.moderate("text to check")
        print(result.flagged, result.labels)

asyncio.run(main())

Prefer synchronous code? Use SyncSupervisorClient with the same methods, minus the await.

from supervisor import SyncSupervisorClient

with SyncSupervisorClient(api_key="sk_prod_...") as client:
    result = client.moderate("text to check")

Methods

Available on both SupervisorClient (async) and SyncSupervisorClient:

# Single text or image (base64). model: "auto" | "observer" | "sentinel" | "arbiter"
await client.moderate(text, image=None, model=None, enabled_labels=None, include_context=False)

# Many at once -> list[ModerationResponse]
await client.moderate_batch(texts, images=None, model=None, enabled_labels=None)

# A short video, by path -> VideoModerationResponse
await client.moderate_video("clip.mp4", model=None, enabled_labels=None)

# Username policy check -> UsernameCheckResponse(flagged, score)
await client.check_username("user123")

# All labels -> {key: description}
await client.get_labels()

A ModerationResponse has: flagged (bool), labels (list[str]), implicit_labels, model_version, and optional context fields.

A VideoModerationResponse has: flagged, labels (the union across frames), frames (each with timestamp_ms, flagged and labels), frames_analysed, duration_secs, codec and decoder. The 10 MB size limit is checked locally, so an oversized clip raises before it is uploaded.

Platform API

If you have a registered platform, use PlatformClient to moderate on behalf of your own users with your client_id / client_secret (created in the dashboard under Platform API).

from supervisor import PlatformClient

async with PlatformClient(client_id="...", client_secret="sk_platform_...") as p:
    user = await p.provision_user("user@example.com")
    result = await p.moderate("user@example.com", text="text to check")

Other methods: list_users(), get_user(id), create_checkout(...), get_connect_status(). See the Platform API guide for the full flow.