Quickstart
Getting started with the Hedra API is easy.
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 hedra.com/app/subcription
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
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:
Use uv
to install the required Python packages listed in pyproject.toml
:
Run the example
Run the main.py
script using uv run
, providing the necessary arguments:
Command-Line 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:
The script will:
- 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.
Check the console output for progress and the final video file location.
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:
Use uv
to install the required Python packages listed in pyproject.toml
:
Run the example
Run the main.py
script using uv run
, providing the necessary arguments:
Command-Line 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:
The script will:
- 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.
Check the console output for progress and the final video file location.