Skip to main content

Python SDK for the Authenta API to detect deepfakes and manipulated media

Project description

Authenta Python SDK

Python client for the Authenta API to detect deepfakes and manipulated media using image and video models.

Installation

Follow the steps below to install the authenta package.

Install from PyPI

pip install authenta

(Optional) Local development

git clone https://github.com/phospheneai/authenta-python-sdk.git
cd authenta-python-sdk
pip install -e .

Basic functionalities and workflows

The package provides basic functionalities for:

  • Uploading images and videos to Authenta
  • Running deepfake / AI-generated content detection
  • Polling for results and retrieving detection outputs
  • Listing and deleting media records via the /media endpoints

1. Quick detection workflow

from authenta import AuthentaClient

client = AuthentaClient(
    base_url="https://platform.authenta.ai/api",  # platform base : https://platform.authenta.ai 
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

# Upload a file and wait for processing to finish
media = client.process("samples/nano_img.png", model_type="AC-1")
print("Status:", media["status"])
print("Fake:", media.get("fake"))
print("Result URL:", media.get("resultURL"))
print("Heatmap URL:", media.get("heatmapURL"))

2. Two-step upload and polling

from authenta import AuthentaClient

client = AuthentaClient(
    base_url="https://platform.authenta.ai/api",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

# 1) Upload only
upload_meta = client.upload_file("samples/nano_img.png", model_type="AC-1")
mid = upload_meta["mid"]

# 2) Poll later using the media id
final_media = client.wait_for_media(mid)
print(final_media["status"], final_media.get("fake"))

Model types and usage

Authenta exposes different detection models that you select via the model_type parameter.

Model type Modality Description
AC-1 Image Detects AI-generated or manipulated images.
DF-1 Video Detects deepfake or manipulated faces in video content.

Detect AI-generated images (AC-1)

from authenta import AuthentaClient

client = AuthentaClient(
    base_url="https://platform.authenta.ai/api",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

media = client.upload_file("samples/nano_img.png", model_type="AC-1")
print(media["mid"], media["status"])

Detect deepfake videos (DF-1)

from authenta import AuthentaClient

client = AuthentaClient(
    base_url="https://platform.authenta.ai/api",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)

media = client.upload_file("samples/video.mp4", model_type="DF-1")
print(media["mid"], media["status"])

Method reference

AuthentaClient

The main entrypoint for interacting with the Authenta API.

Initialization

from authenta import AuthentaClient

client = AuthentaClient(
    base_url="https://platform.authenta.ai/api",
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
)
  • base_url: str – Authenta API base URL (e.g. https://platform.authenta.ai/api).
  • client_id: str – Your Authenta client ID.
  • client_secret: str – Your Authenta client secret.

upload_file(path: str, model_type: str) -> Dict[str, Any]

  • Creates a media record via POST /media and uploads the file to the returned presigned URL.
  • Returns media JSON including fields such as mid, status, modelType, and timestamps.

wait_for_media(mid: str, interval: float = 5.0, timeout: float = 600.0) -> Dict[str, Any]

  • Polls GET /media/{mid} until the status is PROCESSED, FAILED, or ERROR.
  • Sleeps interval seconds between polls and raises TimeoutError if timeout is exceeded.

process(path: str, model_type: str, interval: float = 5.0, timeout: float = 600.0) -> Dict[str, Any]

  • High-level helper that runs upload_file followed by wait_for_media.
  • Returns the final processed media JSON, including detection outputs like fake, resultURL, heatmapURL, and scores (when available).

get_media(mid: str) -> Dict[str, Any]

  • Fetches the current state of a media record via GET /media/{mid}.
  • Returns the parsed JSON media object.

list_media(**params) -> Dict[str, Any]

  • Lists media records for the client using GET /media.
  • Supports optional query parameters such as page, pageSize, or status (depending on API support).

delete_media(mid: str) -> None

  • Deletes a media record via DELETE /media/{mid}.
  • Raises an HTTP error if the request fails.

View source on GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authenta-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authenta-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file authenta-0.1.0.tar.gz.

File metadata

  • Download URL: authenta-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for authenta-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c4193a16ce9ed77fc36aaa8090f26cf20b63512385f75c3b95120e447e53a76
MD5 2383057b638d70c43dd71d2e0fda8e30
BLAKE2b-256 d0066fd07ef12053cb2a6972a9ba60f474ffd97a503951395a11871bad53a8dc

See more details on using hashes here.

File details

Details for the file authenta-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: authenta-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for authenta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4afba9872e5ebbcabf53e0a62b000a5afe538914011681cf280092373094e9
MD5 b13377425197ed610c61fad8459abe5f
BLAKE2b-256 8affeeece8eb2e3633120a0342b86a0c937605ac6ecf0003b4ba5209a2bdd06c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page