hedra
v0.2.0
Published
Node.js client for the Hedra API
Downloads
181
Maintainers
Readme
Hedra API Client (Unofficial)
A Node.js client for the Hedra API, enabling character video generation using AI.
Installation
npm install hedra
Quick Start
import { HedraClient } from 'hedra';
import fs from 'fs';
const client = new HedraClient('your-api-key');
async function generateVideo() {
const audioUpload = await client.uploadAudio(fs.readFileSync('audio.wav'));
const imageUpload = await client.uploadImage(fs.readFileSync('image.jpg'), '16:9');
const generation = await client.generateCharacter({
aspectRatio: '16:9',
audioSource: 'audio',
voiceUrl: audioUpload.url,
avatarImage: imageUpload.url,
});
const completedProject = await client.waitForProjectCompletion(
generation.jobId,
(status) => console.log('Status:', status)
);
if (completedProject.videoUrl) {
await client.downloadVideo(completedProject.videoUrl, 'output.mp4');
console.log('Video downloaded to output.mp4');
}
}
generateVideo().catch(console.error);
Key Features
- Audio and image upload
- Character video generation
- Project status tracking
- Video download
- Project management (listing, sharing, deleting)
Basic Usage
Create a client instance:
const client = new HedraClient('your-api-key');
Upload audio and image:
const audioUpload = await client.uploadAudio(audioFile); const imageUpload = await client.uploadImage(imageFile, '16:9');
Generate a character video:
const generation = await client.generateCharacter({ aspectRatio: '16:9', audioSource: 'audio', voiceUrl: audioUpload.url, avatarImage: imageUpload.url, });
Wait for completion and download:
const project = await client.waitForProjectCompletion(generation.jobId); await client.downloadVideo(project.videoUrl, 'output.mp4');
Advanced Usage
For detailed API reference, type information, and advanced usage examples, please refer to the full documentation.
Contributions
As an unofficial client, contributions, issues, and feature requests are welcome. Please feel free to submit pull requests or open issues on the GitHub repository.
License
MIT
Note: This client is based on the public Hedra API documentation. For the most up-to-date and official information about the Hedra API, please refer to the official Hedra API documentation.