Skip to main content

VideoGen Python SDK

Official Python client for the VideoGen API.

Package: videogen (PyPI). Generate full videos from scripts, voiceovers, or slideshows, run media tools, manage files and projects, chat with the AI assistant, and verify webhooks.

Install

pip install videogen

Default base URL: https://api.videogen.io.

Quick start

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

me = vg.account.get_me()
print(me["email"])

run = vg.workflows.script_to_video_and_wait(
    script="Stay hydrated for better focus and energy.",
    visual_style={
        "type": "AI_IMAGE",
        "ai_style": "loose watercolor illustration with visible brushstrokes",
    },
    quality="HIGH",
    remix_actions=[
        {"type": "ENABLE_CAPTIONS"},
        {
            "type": "CONVERT_IMAGES_TO_VIDEOS",
            "motion_prompt": "slow cinematic push-in",
            "mute_output_videos": True,
            "quality": "HIGH",
        },
    ],
)
print(run["status"], run.get("project_id"))

Omit api_key to read VIDEOGEN_API_KEY from the environment.

Async client

import os
from videogen import AsyncVideoGen

vg = AsyncVideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

run = await vg.workflows.script_to_video_and_wait(
    script="Stay hydrated for better focus and energy.",
    visual_style={
        "type": "AI_IMAGE",
        "ai_style": "loose watercolor illustration with visible brushstrokes",
    },
    quality="HIGH",
    remix_actions=[
        {"type": "ENABLE_CAPTIONS"},
        {
            "type": "CONVERT_IMAGES_TO_VIDEOS",
            "motion_prompt": "slow cinematic push-in",
            "mute_output_videos": True,
            "quality": "HIGH",
        },
    ],
)
print(run["status"], run.get("project_id"))

What you can do

Area Client surface Typical entry points
Account vg.account get_me
Workflows vg.workflows script_to_video_and_wait, prompt_to_video_clip_and_wait, voiceover_to_video_and_wait, slideshow_to_video_and_wait
Tools vg.tools generate_image_and_wait, generate_video_clip_and_wait, text_to_speech_and_wait, …
Files helpers on vg upload_file, download_file, create_public_preview
Projects vg.projects export_and_wait, remix_and_wait, create_timeline_interchange_and_wait
Assistant vg.assistant start_assistant_chat_and_wait, send_assistant_message_and_wait
Entities vg.entities create_entity, list_entities, add_entity_reference
Text vg.text generate_text
Catalog vg.resources list_tts_voices, list_languages
Webhooks vg.webhooks + helper create_webhook_endpoint, verify_webhook_signature

Prefer *_and_wait (or the matching poll_* / async_poll_* helper) for anything asynchronous. Thin REST methods match OpenAPI operationIds (snake_case).

Naming and JSON

  • Methods: snake_case (script_to_video, get_tool_execution_info).
  • Requests: pass snake_case kwargs (and nested dict keys). The client serializes body/query keys to camelCase for the wire.
  • Responses: JSON objects are converted recursively to snake_case keys (tool_execution_id, workflow_run_id, has_more).

Workflows

Script to video (above) is the usual path. Prompt to video clip builds a single clip from a prompt:

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

run = vg.workflows.prompt_to_video_clip_and_wait(
    prompt="A glass of water catching morning light on a kitchen counter, slow push-in",
    quality="HIGH",
)
print(run["status"], run.get("project_id"))

Other workflow starters: voiceover_to_video_and_wait (uploaded audio file_id), slideshow_to_video_and_wait (deck file_id).

Tools

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

execution = vg.tools.generate_image_and_wait(
    prompt="A sunset over a calm ocean, cinematic lighting",
    quality="HIGH",
)

results = execution.get("results") or []
file_id = results[0]["file_id"] if results else None
if file_id is None:
    raise RuntimeError("Expected a generated file id")

preview = vg.create_public_preview(file_id)
print(execution["status"], preview)

The same *_and_wait pattern exists for video clips, motion graphics, TTS, music, sound effects, avatar, upscale, background removal, and more under vg.tools.

For avatar video, call generate_avatar_and_wait with audio_file_id and an ACTOR entity as actor_entity_id. You may set avatar_quality to LOW, STANDARD, HIGH, or MAX. Script-to-video, voiceover-to-video, slideshow-to-video, and CHANGE_NARRATOR accept the same optional actor fields.

Files

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

with open("input.mp4", "rb") as f:
    uploaded = vg.upload_file(f, display_name="input.mp4", type="VIDEO")

print(uploaded["file_id"])

vg.download_file(uploaded["file_id"], output_path="output.mp4")

Projects

Export a finished workflow project, or apply remix actions later:

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

project_id = "vg_proj_..."

exported = vg.projects.export_and_wait(project_id=project_id, quality="HIGH")
print(exported["status"], exported.get("export_file_id"))

remix = vg.projects.remix_and_wait(
    project_id=project_id,
    remix_actions=[
        {"type": "ENABLE_CAPTIONS"},
        {"type": "ADD_TRANSITIONS"},
    ],
)
print(remix)

Assistant

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

started = vg.assistant.start_assistant_chat(
    message="Draft a 20-second script about morning hydration.",
)
message = vg.poll_assistant_message(started["message_id"])

print(message["status"], started.get("assistant_id"), started.get("project_id"))

Or use start_assistant_chat_and_wait when you only need the terminal message. Continue with send_assistant_message_and_wait / act_on_assistant_action_and_wait on the same assistant_id.

Entities

Reusable actors, products, and visual styles for consistent generation:

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

entity = vg.entities.create_entity(
    entity_type="ACTOR",
    name="Alex",
    description="Friendly narrator in casual clothes",
)
print(entity["entity_id"])

Attach reference images with add_entity_reference, then pass entity ids into workflows.

Text

import os
from videogen import VideoGen

vg = VideoGen(api_key=os.environ["VIDEOGEN_API_KEY"])

result = vg.text.generate_text(
    prompt="Write a one-sentence hook for a hydration tip video.",
)
print(result["text"])

Webhooks

import os
from videogen import verify_webhook_signature

event = verify_webhook_signature(
    raw_body="...",  # raw request body string
    headers={
        "webhook-id": "...",
        "webhook-timestamp": "...",
        "webhook-signature": "...",
    },
    secret=os.environ.get("VIDEOGEN_WEBHOOK_SECRET", ""),
)
print(event)

Register endpoints with vg.webhooks.create_webhook_endpoint. Signatures follow the Standard Webhooks scheme.

Helpers

Exported as module functions and bound on the client:

Helper Purpose
poll_assistant_message / async_poll_assistant_message Poll an assistant message to a terminal status
poll_executed_tool / async_poll_executed_tool Poll a tool execution to a terminal status
poll_workflow_run / async_poll_workflow_run Poll a workflow run
poll_project_export / async_poll_project_export Poll a project export
poll_timeline_interchange / async_poll_timeline_interchange Poll a timeline interchange job
poll_remix_actions / async_poll_remix_actions Poll remix actions until all are terminal
poll_public_preview / async_poll_public_preview Poll until a public preview URL is ready
upload_file / async_upload_file Presign, PUT bytes, poll until the file is ready
get_hydrated_file / async_get_hydrated_file Hydrate signed source URLs
download_file / async_download_file Hydrate then download bytes (optional path)
create_public_preview / async_create_public_preview Enable + poll public preview
verify_webhook_signature Verify Standard Webhooks and return the event dict

Cancellation: pass cancel_event=threading.Event() (sync) or asyncio.Event() (async) to poll helpers and thin request methods. Setting the event raises PollCancelledError.

Errors

VideoGenError exposes status, body, and request_id (from x-request-id when present).

Docs

Metadata

Release files for videogen 2.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for videogen 2.1.8
File Size Uploaded
videogen-2.1.8.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for videogen 2.1.8
File Interpreter ABI Platform
videogen-2.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 67.3 kB

Release files / videogen-2.1.8.tar.gz

Download URL videogen-2.1.8.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ac8957f669dad37852e30b956b537612281082d83e2be93c0173d9c41c845e
BLAKE2b-256 checksum
How to use checksums
c5ced13cb562f2907fb7729ae6e0e91178ab13d1ff04acc65a97a97fae2328e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release files / videogen-2.1.8-py3-none-any.whl

Download URL videogen-2.1.8-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca3667e1f396cb89abb5f070d5eac9ae412f0eaa4aa5f4e3ed5df141c81d607e
BLAKE2b-256 checksum
How to use checksums
445db8ea48b3d7058f7aff647d5ead6942e8dcc34632a9537e0a739790c74c31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release history Release notifications | RSS feed

2.2.1

2 release files

2.2.0

2 release files

2.1.13

2 release files

2.1.12

2 release files

2.1.11

2 release files

2.1.10

2 release files

2.1.9

2 release files

This release

2.1.8 This release

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.18

2 release files

2.0.9

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

1.1.8

2 release files

1.1.6

2 release files

1.1.4

2 release files

1.0.0

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.19

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page