Skip to main content

Official Python SDK for ActorHub.ai - Verify AI-generated content against protected identities

Project description

ActorHub Python SDK

Official Python SDK for ActorHub.ai - Verify AI-generated content against protected identities.

Installation

pip install actorhub

Quick Start

from actorhub import ActorHub

# Initialize the client
client = ActorHub(api_key="your-api-key")

# Verify if an image contains protected identities
result = client.verify(image_url="https://example.com/image.jpg")

if result.protected:
    print(f"Protected identity detected!")
    for identity in result.identities:
        print(f"  - {identity.display_name} (similarity: {identity.similarity_score})")

Features

  • Identity Verification: Check if images contain protected identities
  • Consent Checking: Verify consent before AI generation
  • Marketplace Access: Browse and license identities
  • Actor Pack Training: Train custom Actor Packs
  • Async Support: Full async/await support with AsyncActorHub
  • Automatic Retries: Built-in retry logic with exponential backoff
  • Type Hints: Full type annotations for IDE support

Usage Examples

Verify Image

from actorhub import ActorHub

client = ActorHub(api_key="your-api-key")

# From URL
result = client.verify(image_url="https://example.com/image.jpg")

# From file
result = client.verify(image_file="/path/to/image.jpg")

# From base64
result = client.verify(image_base64="base64-encoded-data...")

print(f"Protected: {result.protected}")
print(f"Faces detected: {result.faces_detected}")

Check Consent (for AI Platforms)

result = client.check_consent(
    image_url="https://example.com/face.jpg",
    platform="runway",
    intended_use="video",
    region="US"
)

if result.protected:
    for face in result.faces:
        print(f"Consent for video: {face.consent.video_generation}")
        print(f"License available: {face.license.available}")

Browse Marketplace

# Search listings
listings = client.list_marketplace(
    query="actor",
    category="ACTOR",
    sort_by="popular",
    limit=10
)

for listing in listings:
    print(f"{listing.title} - ${listing.base_price_usd}")

Purchase License

from actorhub import LicenseType, UsageType

purchase = client.purchase_license(
    identity_id="uuid-here",
    license_type=LicenseType.STANDARD,
    usage_type=UsageType.COMMERCIAL,
    project_name="My AI Project",
    project_description="Creating promotional content",
    duration_days=30,
)

# Redirect user to Stripe checkout
print(f"Checkout URL: {purchase.checkout_url}")

Get My Licenses

licenses = client.get_my_licenses(status="active")

for lic in licenses:
    print(f"{lic.identity_name} - {lic.license_type} - Expires: {lic.expires_at}")

Async Usage

import asyncio
from actorhub import AsyncActorHub

async def main():
    async with AsyncActorHub(api_key="your-api-key") as client:
        result = await client.verify(image_url="https://example.com/image.jpg")
        print(f"Protected: {result.protected}")

asyncio.run(main())

Error Handling

from actorhub import (
    ActorHub,
    AuthenticationError,
    RateLimitError,
    ValidationError,
    NotFoundError,
)

client = ActorHub(api_key="your-api-key")

try:
    result = client.verify(image_url="https://example.com/image.jpg")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limit exceeded. Retry after: {e.retry_after} seconds")
except ValidationError as e:
    print(f"Validation error: {e.message}")
except NotFoundError:
    print("Resource not found")

Configuration

client = ActorHub(
    api_key="your-api-key",
    base_url="https://api.actorhub.ai",  # Custom base URL
    timeout=30.0,                         # Request timeout in seconds
    max_retries=3,                        # Max retry attempts
)

API Reference

ActorHub Client

Method Description
verify() Verify if image contains protected identities
get_identity() Get identity details by ID
check_consent() Check consent status for AI generation
list_marketplace() Search marketplace listings
get_my_licenses() Get user's purchased licenses
purchase_license() Purchase a license
train_actor_pack() Initiate Actor Pack training
get_actor_pack() Get Actor Pack status

Requirements

  • Python 3.8+
  • httpx
  • pydantic
  • tenacity

License

MIT License - see LICENSE for details.

Links

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

actorhub-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

actorhub-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for actorhub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 83d2b25bbe468e46460ff55e82432606396744e697ac3d277d53fc67f2ff7f4a
MD5 ac5199e4bb8ddb766fed854ef711e4ea
BLAKE2b-256 24542e3ae62624d6244aa219edad6b5785ac72e11a22f20669d772d0c77cecb8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for actorhub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f65c8fe8b767f38f25cd6f8baac0e256b14b59f50c612373d81fb8d7e07ce161
MD5 d79f4117241c52a464a68520ae1712bf
BLAKE2b-256 c247aa708874759ededb968f2181429b164f2eb7bce20869c3cd1282448672cd

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