heygen is a Rust SDK for interacting with the HeyGen API, providing an ergonomic and type-safe way to create and manage AI-generated videos.
Join Heygen using this link and you will be rewarding our work! Thank you!
- Create AI-generated avatar videos with comprehensive configuration options
- Manage templates for premium HeyGen creators
- Handle webhook registrations and notifications
- List and retrieve video details and status
- Fully typed responses and error handling
- Built on top of
reqwestfor reliable HTTP communication
use heygen::HeyGenBot;
use serde_json::json;
#[tokio::main]
async fn main() {
// Create a new HeyGen client
let client = HeyGenBot::new("your-api-key".to_string(), Some("https://api.heygen.com/v2/")).unwrap();
// Create a video using an avatar
let payload = json!({
"video_inputs": [{
"character": {
"type": "avatar",
"avatar_id": "Angela-inTshirt-20220820",
"avatar_style": "normal"
},
"voice": {
"type": "text",
"input_text": "Hello from the HeyGen Rust SDK!",
"voice_id": "1bd001e7e50f421d891986aad5158bc8",
"speed": 1.1
}
}],
"dimension": {
"width": 1280,
"height": 720
}
});
// Generate the video
match client.create_avatar_video(payload).await {
Ok(response) => {
if let Some(data) = response.data {
println!("Video generated successfully! ID: {}", data.video_id);
}
}
Err(e) => eprintln!("Error generating video: {}", e),
}
}- Create avatar videos with customizable parameters
- Generate videos from templates (premium feature)
- Monitor video generation status
- List all generated videos
- List available templates
- Retrieve template details
- Generate videos from existing templates
- Register webhook endpoints
- List registered webhooks
- Update webhook configurations
- Delete webhook registrations
- List all available avatars
The examples directory contains various examples showcasing different features:
To run an example use cargo run --example <example_file_name>
Add this to your Cargo.toml:
[dependencies]
heygen = "0.1.2"For detailed documentation and API reference, check out heygen API.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in heygen by you shall be licensed as MIT, without any additional
terms or conditions.