Skip to main content

Python SDK for agent-media — generate AI UGC videos with talking heads, B-roll, and subtitles programmatically.

Project description

agent-media

Python SDK for agent-media — UGC video generation for developers.

Generate AI videos with realistic talking heads, B-roll, voiceover, animated subtitles, and music. One function call, finished video.

PyPI version Python license

Install

pip install agent-media

Quick Start

from agent_media import AgentMedia

client = AgentMedia(api_key="ma_YOUR_KEY")

# Generate a video — blocks until complete, returns the URL
video = client.create_video(
    script="Have you tried building UGC content at scale? This API makes it trivial.",
    actor_slug="sofia",
    tone="energetic",
    style="hormozi",
    target_duration=10,
)
print(video["video_url"])
# → https://...mp4

Async

from agent_media.client import AsyncAgentMedia

async with AsyncAgentMedia(api_key="ma_YOUR_KEY") as client:
    video = await client.create_video(
        script="Your script here...",
        actor_slug="sofia",
        tone="confident",
    )
    print(video["video_url"])

API Reference

AgentMedia(api_key, base_url?, timeout?)

Parameter Type Required Default
api_key str Yes
base_url str No Production API
timeout float No 60.0

client.create_video(**params)

Generate a video and wait for completion. Returns { job_id, video_url, credits_deducted, duration }.

video = client.create_video(
    script="Your script (50-3000 chars)",
    actor_slug="sofia",           # use list_actors() to browse
    tone="energetic",             # energetic | calm | confident | dramatic
    music="chill",                # chill | energetic | corporate | dramatic | upbeat
    style="hormozi",              # 17 subtitle styles
    target_duration=10,           # 5 | 10 | 15 seconds
    aspect_ratio="9:16",          # 9:16 | 16:9 | 1:1
    allow_broll=True,             # include AI-generated B-roll
    template="product-review",    # optional template
    webhook_url="https://...",    # optional async callback
    timeout_seconds=600,          # max wait time (default 10 min)
)

client.submit_video(**params)

Submit without waiting. Returns { job_id, status, credits_deducted }.

client.submit_subtitle(**params)

Add subtitles to an existing video.

job = client.submit_subtitle(
    video_url="https://example.com/video.mp4",
    style="bold",
)

client.submit_product_review(**params)

Generate a product review video from a URL.

job = client.submit_product_review(
    product_url="https://example.com/product",
    angle="enthusiastic",
    actor_slug="sofia",
)

client.list_actors(limit?, offset?)

Browse available AI actors.

result = client.list_actors(limit=20)
for actor in result["actors"]:
    print(f"{actor['slug']}{actor['name']} ({actor['gender']}, {actor['nationality']})")

client.get_video_status(job_id)

Check job progress.

status = client.get_video_status("job_abc123")
if status["status"] == "completed":
    print(status["video_url"])

Error Handling

from agent_media import AgentMedia, AgentMediaError

try:
    video = client.create_video(script="...")
except AgentMediaError as e:
    print(f"{e.code}: {e} (HTTP {e.status})")

Batch Generation

from concurrent.futures import ThreadPoolExecutor

scripts = ["Script 1...", "Script 2...", "Script 3..."]

with ThreadPoolExecutor(max_workers=3) as pool:
    videos = list(pool.map(
        lambda s: client.create_video(script=s, actor_slug="sofia"),
        scripts,
    ))

for v in videos:
    print(v["video_url"])

Related Packages

Package Registry Description
@agentmedia/sdk npm TypeScript SDK
@agentmedia/mcp-server npm MCP server for Claude Code, Cursor, Windsurf
agent-media-cli npm CLI tool
@agentmedia/schema npm Shared schema, types, Zod validation

Links

License

Apache-2.0

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

agent_media-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

agent_media-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_media-0.1.1.tar.gz.

File metadata

  • Download URL: agent_media-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for agent_media-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fb9c25d1bca3a5e374dfd134e3cd2b6c2f382b32e3d0c724f0dad3538c6b47ae
MD5 7254c37ee5cbbd458c554744a3b03ebc
BLAKE2b-256 3b8e06098b7df14b3d2fe1e432339677a6574254fece7c7c66456e21bd29686b

See more details on using hashes here.

File details

Details for the file agent_media-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agent_media-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for agent_media-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa43297e4f7a340adf44d842d853b4273ff37eaa6bc32785bf4abdc88ecdd6c7
MD5 a2a61a9f883f7884fad017082449bed7
BLAKE2b-256 e2b01f558e27205379df88bbc4e9743c947d9885f8b6363781c8ec450e9cae3d

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