| Crates.io | heygen |
| lib.rs | heygen |
| version | 0.1.2 |
| created_at | 2025-01-10 14:28:37.835376+00 |
| updated_at | 2025-01-12 08:59:30.674408+00 |
| description | HeyGen API from Only Finance LTDA |
| homepage | |
| repository | https://github.com/OnlyCoiners/heygen_rust |
| max_upload_size | |
| id | 1511296 |
| size | 93,886 |
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!
reqwest for reliable HTTP communicationuse 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),
}
}
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.