HeyGen Video API SDKs for JavaScript, Python, Ruby, Go, Java, and PHP on RunAPI.
Typed SDKs for HeyGen Video video generation through RunAPI. The public heygen-video-sdk repository groups the JavaScript, Python, Ruby, Go, and Java packages. PHP is released from the split heygen-video-php Composer repository.
HeyGen Video exposes two resources:
-
textToVideo/text_to_videofor prompt-only requests and requests with reference images, videos, or audio. -
imageToVideo/image_to_videofor first-frame image requests.
Packages
| Language | Package |
|---|---|
| JavaScript / TypeScript | @runapi.ai/heygen-video |
| Python | runapi-heygen-video |
| Ruby | runapi-heygen-video |
| Go | github.com/runapi-ai/heygen-video-sdk/go |
| Java | ai.runapi:runapi-heygen-video |
For PHP, use runapi-ai/heygen-video from the split Composer repository.
JavaScript Quick Start
import { HeyGenVideoClient } from '@runapi.ai/heygen-video';
const client = new HeyGenVideoClient();
const result = await client.textToVideo.run({
model: 'heygen-video-1',
prompt: 'A cinematic tracking shot through a rain-soaked city',
aspect_ratio: '16:9',
});
console.log(result.videos[0].url);Reference media uses the same textToVideo resource:
const task = await client.textToVideo.create({
model: 'heygen-video-1',
prompt: 'Keep the character and voice consistent in a new scene',
reference_image_urls: ['https://cdn.runapi.ai/public/samples/image.jpg'],
reference_audio_urls: ['https://cdn.runapi.ai/public/samples/voice.mp3'],
aspect_ratio: 'adaptive',
});Use create to submit and return a task id, get to read current status, or run to submit and poll to completion. In request handlers, prefer create with a callback or later polling.
Returned file URLs are temporary. Download generated files into durable storage within the retention window.
Links
License
Licensed under the Apache License, Version 2.0.