Step 1: Purchase a paid account
In order to use our API, you’ll need a paid subscription account. You can purchase your plans at https://www.hedra.com/plans.Step 2: Register an API key
Go to your profile, click to generate an API key, and purchase API credits.[Optional] Step 3: Purchase an enterprise subscription
We offer on-demand purchase packs and metered billing on the profile page, with low rate limits and without volume discount. For configurable rate limits, rates, and more, please submit a ticket via our enterpise sales form.Step 4: Run the quickstart code
- Character-3
- Character-2 Legacy
Prerequisites
- Python 3.10+
- Git LFS (needs to be installed before cloning starter code
- uv: A fast Python package installer and resolver. If you don’t have it, install it following the instructions
Clone the repository:
Set up your API Key:
Create a file named.env
in the project’s root directory and add the following line:Install Dependencies:
Useuv
to install the required Python packages listed in pyproject.toml
:Run the example
Run themain.py
script using uv run
, providing the necessary arguments:--aspect_ratio
(Required): Aspect ratio for the video. Choices: 16:9
, 9:16
, 1:1
.* --resolution
(Required): Resolution for the video. Choices: 540p
, 720p
.* --text_prompt
(Required): Text prompt describing the desired video content (enclose in quotes if it contains spaces).* --audio_file
(Required): Path to the input audio file (e.g., .mp3
, .wav
).* --image
(Required): Path to the input image file (e.g., .png
, .jpg
).* --duration
(Optional): Desired duration for the video in seconds (float). Defaults to the length of the audio if not specified.* --seed
(Optional): Seed for the generation process (integer). Allows for reproducible results if the model and other parameters are the same.Example:- Upload the image and audio assets.
- Submit the generation request to the Hedra API.
- Poll the API for the status of the generation job.
- Once complete, download the generated video file (e.g.,
asset_id.mp4
) to the project directory.