Python
Install
Create a client
The client reads from the VIDEOGEN_API_KEY environment variable when no api_key is provided.
Async client
Generate a video from a script
Workflows turn a script into a finished video asynchronously. Prefer script_to_video_and_wait when you can block:
Use project_id for export, remix, and other API calls. project_url (also on the response) is optional: a link to open the project in the VideoGen editor for manual review (team members and project collaborators only).
Request kwargs use snake_case (and nested dict keys); the client serializes body/query keys to camelCase for the API. Responses are plain dicts with snake_case keys.
For start-then-poll yourself, call script_to_video then poll_workflow_run(vg, workflow_run_id). For the async client, use script_to_video_and_wait on AsyncVideoGen (or async_poll_workflow_run):
Options
For the async client, pass asyncio.Event as cancel_event to *_and_wait methods and async poll helpers (async_poll_workflow_run, async_poll_executed_tool, async_poll_project_export, async_poll_public_preview).
Run a standalone tool
All tool endpoints are asynchronous. Prefer generate_image_and_wait (and the other tool *_and_wait methods). Use create_public_preview when you need a shareable preview URL: