Skip to main content

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

Project description

Authenta SDK Documentation

Welcome to the official documentation for the Authenta Python SDK. This library allows you to integrate state-of-the-art deepfake and manipulated media detection into your Python applications.


1. Getting Started

Installation

You can install the SDK via pip for production use or install from source for local development.

Option A: Install from PyPI (Recommended)

pip install authenta

Option B: Local Development If you want to modify the SDK source code:

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

Authentication & Initialization

To use the SDK, you must initialize the AuthentaClient with your API credentials.

from authenta import AuthentaClient

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

2. Models & Capabilities

Authenta provides specialized models for different media types. You select the model using the model_type parameter in SDK methods.

Model Type Modality Capability
AC-1 Image AI-Generated Image Detection: Identifies images created by Generative AI (e.g., Midjourney, Stable Diffusion) or manipulated via editing tools.
DF-1 Video Deepfake Video Detection: Detects face swaps, reenactments, and other facial manipulations in video content.

3. Workflows

Quick Detection (Synchronous)

Use the .process() method to handle uploading and waiting for results in a single blocking call. This is ideal for scripts or simple integrations.

# Example: Detect AI-generated image
media = client.process("samples/nano_img.png", model_type="AC-1")

print(f"Media ID: {media['mid']}")
print(f"Status: {media['status']}")
print(f"Is Fake?: {media.get('fake')}")

Async Upload & Polling

For non-blocking workflows (e.g., web servers), use a two-step process: upload first, then poll for status using the Media ID (mid).

# 1. Initiate Upload
upload_meta = client.upload_file("samples/video.mp4", model_type="DF-1")
mid = upload_meta["mid"]
print(f"Upload started. Media ID: {mid}")

# ... perform other tasks ...

# 2. Check Status Later
final_media = client.wait_for_media(mid)
if final_media["status"] == "PROCESSED":
    print(f"Result: {final_media.get('fake')}")

Visualizing Results

The SDK includes a visualization module to generate visual overlays (heatmaps and bounding boxes) to help you interpret detection results.

1. Heatmaps (Images & Video) Generate a visual heatmap indicating manipulated regions.

from authenta.visualization import save_heatmap
media = client.process("data_samples/nano_img2.png", model_type="AC-1")
# simply pass the media and output dir 
save_heatmap(
    media=media,
    out_path="results/image_heatmap.jpg",
    model_type="AC-1",
)

Generate an activation heatmap indicating manipulated regions for faceswap detection .

from authenta.visualization import *
media = client.process("data_samples/test_00000121.mp4", model_type="DF-1")
save_heatmap(
    media,
    out_path="results/deepfake_heatmap.mp4",
    model_type="DF-1",
)

2. Bounding Box Video (DF-1 Only) Draw detection boxes around faces in a deepfake video.

from authenta.visualization import *

media = client.process("data_samples/test_00000121.mp4", model_type="DF-1")

save_bounding_box_video(
    media,
    src_video_path="data_samples/test_00000121.mp4",
    out_video_path="results/analyzed_video.mp4",
)

4. API Reference

Class: AuthentaClient

__init__(base_url, client_id, client_secret)

Initializes the client session.

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

A high-level wrapper that combines upload and polling.

  • Returns: A dictionary containing the final processed media state.
  • Raises: TimeoutError if processing exceeds timeout.

upload_file(path: str, model_type: str) -> Dict

Uploads a file to the Authenta platform.

  • path: Local path to the image or video file.
  • model_type: AC-1 (Image) or DF-1 (Video).
  • Returns: Dictionary with initial metadata (including mid).

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

Blocks execution until the media status becomes PROCESSED or FAILED.

  • mid: The Media ID returned from upload_file.

get_media(mid: str) -> Dict

Retrieves the current status and details of a specific media record.

list_media(**params) -> Dict

Lists historical media records.

  • params: Query parameters like page, pageSize.

delete_media(mid: str) -> None

Permanently removes a media record and its associated data from the platform.

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.2.1.tar.gz (10.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.2.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for authenta-0.2.1.tar.gz
Algorithm Hash digest
SHA256 237ee577975a563430b75d8efd01ee5bc92110b5c24577e47827306753c9bc9f
MD5 d00ac430ed726a2b9ece4b2eac762417
BLAKE2b-256 fefd659dbfeedeb4b6d52f02a9b98f13af161fd5bbe1f58293974a429cba7ec5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for authenta-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7bf28a34eed30943375170c8a443d510142aaecd060a9f6dfa3bb286959521c
MD5 40f6cf8ac191490df85e0b0bba273450
BLAKE2b-256 ddbbbf81ca583e4230ca2a06fe9c209320f1857989552dad90a048854a164a56

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