Golpo Node SDK
Complete API reference for the Golpo AI TypeScript/JavaScript SDK for generating AI-powered videos. Covers installation, authentication, all methods, type definitions, error handling, and usage examples.
Installation
npm install @golpoai/sdkRequires Node.js ≥ 18.17.
Authentication
Initialize the SDK with your API key.
import Golpo from '@golpoai/sdk';
const golpo = new Golpo("api-key"); // Replace with your actual API key
// Optional: custom base URL
const golpoCustom = new Golpo("api-key", "https://custom-api.golpoai.com");| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| apiKey | string | — | Required | Your Golpo AI API key. |
| baseUrl | string | Provided when creating an API key | Optional | Override the API base URL. |
Method: createVideo
StableCreates a video, polls until completion, and returns a GenerationResult.
Signature
async createVideo(
prompt: string,
options?: CreateVideoOptions
): Promise<GenerationResult> // { url, script, videoId }Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| prompt | string | — | Required | The prompt describing what video to generate. |
| options | CreateVideoOptions | — | Optional | Configuration options (see table below). |
Options (CreateVideoOptions)
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| uploads | string | string[] | — | Optional | File paths or URLs (local, HTTP/HTTPS, S3). |
| voiceInstructions | string | — | Optional | Custom instructions for voice characteristics. |
| personality1 | string | — | Optional | Narrator personality. |
| doResearch | boolean | false | Optional | Enable web research for the prompt. |
| ttsModel | 'accurate' | 'fast' | 'accurate' | Optional | Text-to-speech model quality. |
| language | string | — | Optional | Language code (e.g. 'en', 'es'). |
| style | 'solo-male' | 'solo-female' | 'solo-female' | Optional | Voice style. |
| bgMusic | 'engaging' | 'lofi' | null | 'engaging' | Optional | Background music genre. |
| bgVolume | number | 1.4 | Optional | Background music volume. |
| outputVolume | number | 1.0 | Optional | Final audio gain. |
| videoType | 'short' | 'long' | 'long' | Optional | Video duration type. |
| includeWatermark | boolean | true | Optional | Include Golpo watermark. |
| logo | string | — | Optional | Path to local logo file (URLs not supported). |
| timing | '1' | '2' | '1' | Optional | Timing configuration. |
| pollIntervalMs | number | 2000 | Optional | Polling interval in milliseconds. |
| concurrency | number | 8 | Optional | Concurrent file uploads. |
Returns
interface GenerationResult {
url: string; // URL to download/stream the generated video
script: string; // Full transcript/script of the video
videoId: string; // Job ID for getFrameAnimations / editVideo
}CreateVideoOptions type
interface CreateVideoOptions {
uploads?: string | Iterable<string>;
voiceInstructions?: string;
personality1?: string;
doResearch?: boolean;
ttsModel?: 'accurate' | 'fast';
language?: string;
style?: 'solo-male' | 'solo-female';
bgMusic?: 'engaging' | 'lofi' | null;
bgVolume?: number;
outputVolume?: number;
videoType?: 'short' | 'long';
includeWatermark?: boolean;
logo?: string;
timing?: '1' | '2';
pollIntervalMs?: number;
concurrency?: number;
}Usage Examples
Basic prompt-only video
Basicimport Golpo from '@golpoai/sdk';
const golpo = new Golpo("api-key");
const result = await golpo.createVideo('Explain recent AI advances');
console.log(result.url);
console.log(result.script);
console.log(result.videoId);Video from local documents
Filesconst result = await golpo.createVideo('Summarize this research paper', {
uploads: ['./research-paper.pdf'],
style: 'solo-male',
videoType: 'short',
bgMusic: 'lofi',
includeWatermark: false,
logo: './company-logo.png',
});Mixed uploads + research
Advancedconst result = await golpo.createVideo('Analyze these sources', {
uploads: [
'./local-document.pdf',
'https://example.com/article.html',
's3://bucket/research.docx',
'./data.txt',
],
doResearch: true,
concurrency: 4,
});Comprehensive example
Completeconst result = await golpo.createVideo(
'Create an educational video about photosynthesis',
{
// Content
uploads: ['./biology-notes.pdf'],
doResearch: true,
// Voice
style: 'solo-female',
voiceInstructions: 'Professional educator, clear and engaging, moderate pace',
personality1: 'Enthusiastic biology teacher who makes science fun',
ttsModel: 'accurate',
language: 'en',
// Audio
bgMusic: 'engaging',
bgVolume: 1.2,
outputVolume: 1.0,
// Video
videoType: 'long',
timing: '2',
includeWatermark: false,
logo: './school-logo.png',
// Performance
concurrency: 8,
pollIntervalMs: 3000,
}
);Method: getFrameAnimations
Returns a map of frame IDs to MP4 animation URLs for a generated video.
Signature
async getFrameAnimations(videoId: string): Promise<Record<string, string>>Parameters
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| videoId | string | — | Required | The video/job ID returned from createVideo. |
Returns
An object mapping frame IDs (e.g. "0", "1") to MP4 animation URLs.
Example
const result = await golpo.createVideo('Explain AI in 2 minutes');
const animations = await golpo.getFrameAnimations(result.videoId);
for (const [frameId, url] of Object.entries(animations)
.sort(([a], [b]) => parseInt(a) - parseInt(b))) {
console.log(`Frame ${frameId}: ${url}`);
}Method: editVideo
Edits specific frames of a video using text prompts, then optionally combines them.
Signature
async editVideo(
videoId: string,
opts: EditVideoOptions
): Promise<VideoEditResult> // { videoUrl, jobId }EditVideoOptions
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| frameIds | string[] | — | Required | Frame indices to edit (e.g. ["0", "2"]). |
| editPrompts | string[] | — | Required | One prompt per frame (same length as frameIds). |
| videoUrl | string | — | Required | URL of the original video ( result.url from createVideo). |
| referenceImages | string[] | — | Optional | Reference image URLs for the edit. |
| userId | string | — | Optional | User ID for the edit job. |
| autoCombine | boolean | false | Optional | If true, combine edited frames into a final video with audio. |
| pollIntervalMs | number | 2000 | Optional | Polling interval in ms. |
Returns
VideoEditResult — videoUrl (string), jobId (string).
Example
const videoResult = await golpo.createVideo('Product demo in 3 scenes');
const editResult = await golpo.editVideo(videoResult.videoId, {
frameIds: ['1'],
editPrompts: ['Replace the background with a beach sunset'],
videoUrl: videoResult.url,
autoCombine: true,
});
console.log('Edited video URL:', editResult.videoUrl);Method: combineVideos
Merges multiple MP4 URLs into a single video with optional audio.
Signature
async combineVideos(opts: CombineVideosOptions): Promise<CombinedVideoResult> // { url }CombineVideosOptions
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
| mp4Urls | string[] | — | Required | At least one MP4 URL (e.g. from getFrameAnimations). |
| videoUrl | string | — | Optional | Optional original video URL to use for audio. |
| pollIntervalMs | number | 2000 | Optional | Polling interval in ms. |
Returns
CombinedVideoResult — url (string), the URL of the combined video.
Example
const animations = await golpo.getFrameAnimations(videoId);
const mp4Urls = Object.entries(animations)
.sort(([a], [b]) => parseInt(a) - parseInt(b))
.map(([, url]) => url);
const combined = await golpo.combineVideos({ mp4Urls, videoUrl: originalVideoUrl });
console.log('Combined video:', combined.url);Error Handling
Wrap all SDK calls in try/catch blocks to handle failures gracefully.
try {
const result = await golpo.createVideo('My prompt', options);
console.log(result.url);
} catch (error: any) {
if (error.response?.data?.detail) {
// API validation error
console.error('API Error:', error.response.data.detail);
} else {
// Network, file not found, etc.
console.error('Error:', error.message);
}
}Common error scenarios