Golpo Node SDK

v1.0.2 — StableTypeScript / JavaScript

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

Terminal
npm install @golpoai/sdk

Requires Node.js ≥ 18.17.

Authentication

Initialize the SDK with your API key.

auth.ts
import Golpo from '@golpoai/sdk';

const golpo = new Golpo("api-key"); // Replace with your actual API key
ParameterTypeDefaultRequiredDescription
apiKeystringRequired
Your Golpo AI API key.

Method: createVideo

Stable

Creates a video, polls until completion, and returns a GenerationResult.

Signature

createVideo.d.ts
async createVideo(
  prompt: string,
  options?: CreateVideoOptions
): Promise<GenerationResult>  // { url, script, videoId }

Parameters

ParameterTypeDefaultRequiredDescription
promptstringRequired
The prompt describing what video to generate.
optionsCreateVideoOptionsOptional
Configuration options (see table below).

Options (CreateVideoOptions)

ParameterTypeDefaultRequiredDescription
uploadsstring | string[]Optional
File paths or URLs (local, HTTP/HTTPS, S3). Documents, audio, video, images.
audioClipstring | string[]Optional
Audio clip URL(s) or local file path(s). Backend uses the first URL.
newScriptstringOptional
Provide a custom script directly instead of generating from prompt.
inputImagesstring | string[]Optional
Input image URL(s) or local file path(s) for the video.
stylestring'solo-female-3'Optional
Voice style. Options: 'solo-female-3', 'solo-female-4', 'solo-male-3', 'solo-male-4'.
voiceInstructionsstringOptional
Custom instructions for voice characteristics (accent, tone, pace).
languagestringOptional
Language code (e.g. 'en', 'es', 'hindi'). 44+ languages supported.
bgMusicstring | null'engaging'Optional
Background music. Options: 'jazz', 'lofi', 'dramatic', 'whimsical', 'engaging', 'hyper', 'inspirational', 'documentary', or null.
userAudioInVideonumber[] | stringOptional
List of video numbers that should use AI-generated narration audio instead of their original audio (e.g., [1, 3] means videos 1 and 3 get AI narration; unlisted user videos keep their original audio). Defaults to '[]' when userVideos is provided.
useColorbooleantrueOptional
true = color video, false = black and white video.
useLineart2StylestringOptional
Golpo Sketch style. 'false' = classic, 'true' = improved, 'advanced' = formal.
use2StylebooleanOptional
Enable Golpo Canvas mode (use_2_0_style).
imageStylestringOptional
Canvas image style. Options: 'neon', 'whiteboard', 'modern_minimal', 'playful', 'technical', 'editorial'.
userImagesstring | string[]Optional
User image URL(s) or local file path(s) to embed in the video.
userImagesDescriptionsstring | string[]Optional
Descriptions for each user image (strongly recommended).
useAsIsstring | boolean[]Optional
JSON string or boolean array — use images as-is without modification.
skipAnimationstring | boolean[]Optional
JSON string or boolean array — skip animation for specific frames.
penStylestringOptional
Pen cursor style for Canvas. Options: 'stylus', 'marker', 'pen'.
showPencilCursorbooleanfalseOptional
Show pencil cursor. Auto-enabled when penStyle is set.
userVideosstring | string[]Optional
User video URL(s) or local file path(s) to embed in the video.
userVideosDescriptionstring | string[]Optional
Descriptions for each user video.
timingnumber1Optional
Duration in minutes. Options: 0.25, 0.5, 1, 2, 4, 8, 10.
videoType'short' | 'long''long'Optional
'short' = vertical, 'long' = horizontal.
pacing'normal' | 'fast'Optional
Animation pacing. 'normal' = 15s/frame, 'fast' = 10s/frame.
includeWatermarkbooleanfalseOptional
Include Golpo watermark in the video.
logostringOptional
Logo file path or URL. Uploaded and added to the video.
logoPlacementstringOptional
Logo placement position in the video.
displayLanguagestringOptional
Language for on-screen text in the video (e.g., 'English', 'Hindi', 'French'). Useful when the displayed text should differ from the narration language. Defaults to the value of language if omitted.
Example: language: "Hindi", displayLanguage: "English" — the narrator speaks in Hindi while all on-screen text, titles, and labels are shown in English.
videoInstructionsstringOptional
Instructions for video visual generation (scene composition, imagery style).
justReturnScriptbooleanOptional
If true, only generate the script without creating the video.
isPublicbooleanOptional
Whether the generated video is publicly accessible.
pollIntervalMsnumber2000Optional
Polling interval in milliseconds.

Returns

returns.ts
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

types.ts
interface CreateVideoOptions {
  uploads?:               string | Iterable<string>;
  voiceInstructions?:     string;
  language?:              string;
  style?:                 'solo-male-3' | 'solo-female-3' | 'solo-male-4' | 'solo-female-4';
  bgMusic?:               'jazz' | 'lofi' | 'dramatic' | 'whimsical' | 'engaging' | 'hyper' | 'inspirational' | 'documentary' | null;
  videoType?:             'short' | 'long';
  includeWatermark?:      boolean;
  logo?:                  string;
  timing?:                0.25 | 0.5 | 1 | 2 | 4 | 8 | 10;
  pollIntervalMs?:        number;

  // Color / background
  useColor?:              boolean;

  // Script
  newScript?:             string;

  // Visual styles
  useLineart2Style?:      string;
  use2Style?:             boolean;
  imageStyle?:            'neon' | 'whiteboard' | 'modern_minimal' | 'playful' | 'technical' | 'editorial';
  penStyle?:              'stylus' | 'marker' | 'pen';
  showPencilCursor?:      boolean;
  pacing?:                'normal' | 'fast';

  // Branding
  logoPlacement?:         string;
  videoInstructions?:     string;

  // Audio
  audioClip?:             string | string[];
  userAudioInVideo?:      number[] | string;

  // User assets
  userImages?:            string | string[];
  userImagesDescriptions?: string | string[];
  userVideos?:            string | string[];
  userVideosDescription?: string | string[];
  inputImages?:           string | string[];
  useAsIs?:               string | boolean[];
  skipAnimation?:         string | boolean[];

  // Workflow
  isPublic?:              boolean;
  justReturnScript?:      boolean;
}

Usage Examples

Basic prompt-only video

Basic
basic.ts
import 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 with custom script

Script
custom_script.ts
const result = await golpo.createVideo('Product overview', {
  newScript: `Welcome to our product overview. Today we'll explore
the three key features that make our platform unique...

First, our AI-powered analytics engine processes data in real-time.
Second, our intuitive dashboard makes insights accessible to everyone.
Third, our API lets you integrate seamlessly with your existing tools.`,
  style: 'solo-male-3',
  bgMusic: 'engaging',
  timing: 2,
});

Golpo Sketch (whiteboard animation)

Sketch
golpo_sketch.ts
const result = await golpo.createVideo('How photosynthesis works', {
  useLineart2Style: 'true',   // 'false' = classic, 'true' = improved, 'advanced' = formal
  pacing: 'normal',           // 'normal' = 15s/frame, 'fast' = 10s/frame
  style: 'solo-female-3',
  timing: 2,
  bgMusic: 'lofi',
});

Golpo Canvas (rich visual styles)

Canvas
golpo_canvas.ts
const result = await golpo.createVideo('Solar energy explained', {
  use2Style: true,
  imageStyle: 'modern_minimal',  // 'neon' | 'whiteboard' | 'modern_minimal' | 'playful' | 'technical' | 'editorial'
  penStyle: 'stylus',            // 'stylus' | 'marker' | 'pen'
  timing: 2,
  bgMusic: 'inspirational',
});

Video with user images and videos

Assets
user_assets.ts
const result = await golpo.createVideo('Company quarterly review', {
  userImages: [
    'https://example.com/chart1.png',
    './local-photo.jpg',
  ],
  userImagesDescriptions: [
    'Q3 revenue growth chart showing 25% increase',
    'Team photo from the annual retreat',
  ],
  userVideos: ['https://example.com/demo-clip.mp4'],
  userVideosDescription: ['Product demo walkthrough'],
  videoInstructions: 'Use clean corporate visuals with blue color palette',
  style: 'solo-female-4',
  bgMusic: 'engaging',
});

Hindi narration with English on-screen text (displayLanguage)

Advanced
display_language.ts
const result = await golpo.createVideo(
  'Flower Structure for Reproduction',
  {
    language: 'Hindi',          // narrator speaks in Hindi
    displayLanguage: 'English', // on-screen text, titles, and labels appear in English
    style: 'solo-female-4',
    useColor: true,
    videoType: 'long',
  }
);
console.log('Video URL:', result.videoUrl);

Comprehensive example

Complete
comprehensive.ts
const result = await golpo.createVideo(
  'Create an educational video about quantum computing',
  {
    // Content
    uploads: ['./research-paper.pdf'],
    inputImages: ['./diagram.png'],

    // Voice
    style: 'solo-female-3',
    voiceInstructions: 'Professional educator, clear and engaging, moderate pace',
    language: 'en',

    // Audio
    bgMusic: 'documentary',

    // Visual
    useColor: true,
    videoInstructions: 'Use futuristic visuals with circuit-board aesthetics',

    // Video
    videoType: 'long',
    timing: 4,
    pacing: 'normal',

    // Branding
    includeWatermark: false,
    logo: './company-logo.png',
    logoPlacement: 'bottom-right',

    // Workflow
    isPublic: false,
    pollIntervalMs: 3000,
  }
);

Method: createPodcast

Stable

Creates a podcast (audio-only), polls until completion, and returns a GenerationResult.

Signature

createPodcast.d.ts
async createPodcast(
  prompt: string,
  options?: CreatePodcastOptions
): Promise<GenerationResult>  // { url, script, videoId }

Parameters

ParameterTypeDefaultRequiredDescription
promptstringRequired
The prompt describing what podcast to generate.
optionsCreatePodcastOptionsOptional
Configuration options (see table below).

Options (CreatePodcastOptions)

ParameterTypeDefaultRequiredDescription
uploadsstring | string[]Optional
File paths or URLs for reference documents.
voiceInstructionsstringOptional
Custom instructions for voice characteristics.
languagestringOptional
Language code (e.g. 'en', 'es').
stylestring'solo-female-3'Optional
Voice style. Options: 'solo-male-4', 'solo-female-4', 'solo-male-3', 'solo-female-3'.
bgMusicstring | nullOptional
Background music genre.
newScriptstringOptional
Provide a custom script directly.
timingnumber1Optional
Duration in minutes. Options: 0.25, 0.5, 1, 2, 4, 8, 10.
pollIntervalMsnumber2000Optional
Polling interval in milliseconds.

Returns

Same GenerationResult as createVideo — url (podcast audio URL), script (transcript), videoId (job ID).

CreatePodcastOptions type

podcast_types.ts
interface CreatePodcastOptions {
  uploads?:           string | Iterable<string>;
  voiceInstructions?: string;
  language?:          string;
  style?:             'solo-male-4' | 'solo-female-4' | 'solo-male-3' | 'solo-female-3';
  bgMusic?:           'jazz' | 'lofi' | 'dramatic' | 'whimsical' | 'engaging' | 'hyper' | 'inspirational' | 'documentary' | null;
  pollIntervalMs?:    number;

  newScript?:         string;
  timing?:            0.25 | 0.5 | 1 | 2 | 4 | 8 | 10;
}

Podcast Examples

Basic podcast

Basic
basic_podcast.ts
import Golpo from '@golpoai/sdk';

const golpo = new Golpo("api-key");

const result = await golpo.createPodcast('Explain the latest AI breakthroughs');
console.log(result.url);    // podcast audio URL
console.log(result.script); // full transcript

Podcast from documents

Files
podcast_docs.ts
const result = await golpo.createPodcast('Summarize this research', {
  uploads: ['./paper.pdf', 'https://example.com/article.html'],
  style: 'solo-male-4',
  language: 'en',
  bgMusic: 'jazz',
  timing: 2,
});

Podcast with custom script

Script
podcast_script.ts
const result = await golpo.createPodcast('Weekly tech digest', {
  newScript: `Welcome to this week's tech digest. Let's dive into
the top three stories shaping the industry...

Story one: The rise of edge computing...
Story two: New breakthroughs in quantum error correction...
Story three: The debate around AI regulation in the EU...`,
  voiceInstructions: 'Conversational and upbeat, like a morning radio host',
  style: 'solo-female-4',
  bgMusic: 'engaging',
  timing: 4,
});

Method: getFrameAnimations

Returns a map of frame IDs to MP4 animation URLs for a generated video.

Signature

getFrameAnimations.d.ts
async getFrameAnimations(videoId: string): Promise<Record<string, string>>

Parameters

ParameterTypeDefaultRequiredDescription
videoIdstringRequired
The video/job ID returned from createVideo.

Returns

An object mapping frame IDs (e.g. "0", "1") to MP4 animation URLs.

Example

example_get_frame_animations.ts
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

editVideo.d.ts
async editVideo(
  videoId: string,
  opts: EditVideoOptions
): Promise<VideoEditResult>  // { videoUrl, jobId }

EditVideoOptions

ParameterTypeDefaultRequiredDescription
frameIdsstring[]Required
Frame indices to edit (e.g. ["0", "2"]).
editPromptsstring[]Required
One prompt per frame (same length as frameIds).
videoUrlstringRequired
URL of the original video (result.url from createVideo).
referenceImagesstring[]Optional
Reference image URLs for the edit.
userIdstringOptional
User ID for the edit job.
autoCombinebooleanfalseOptional
If true, combine edited frames into a final video with audio.
pollIntervalMsnumber2000Optional
Polling interval in ms.

Returns

VideoEditResultvideoUrl (string), jobId (string).

Example

example_edit_video.ts
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

combineVideos.d.ts
async combineVideos(opts: CombineVideosOptions): Promise<CombinedVideoResult>  // { url }

CombineVideosOptions

ParameterTypeDefaultRequiredDescription
mp4Urlsstring[]Required
At least one MP4 URL (e.g. from getFrameAnimations).
videoUrlstringOptional
Optional original video URL to use for audio.
pollIntervalMsnumber2000Optional
Polling interval in ms.

Returns

CombinedVideoResulturl (string), the URL of the combined video.

Example

example_combine_videos.ts
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);

Timing

Timing parameter reference — provide duration in minutes as a number.

ValueDuration
0.2515 seconds
0.530 seconds
11 minute
22 minutes
44 minutes
88 minutesBeta
1010 minutesBeta
Supported values: 0.25, 0.5, 1, 2, 4, 8, 10.

Video Type

Controls the video aspect ratio and orientation.

ValueFormatUse Cases
"short"Vertical / PortraitTikTok, Instagram Reels, YouTube Shorts
"long"Horizontal / Landscape (Default)YouTube, standard video content
9:16

short

16:9

long (default)

Style & Voices

The style parameter controls voice selection for narration.

ValueVoice TypeDescription
"solo-female-3"Female 1Female narrator voice (Default)
"solo-female-4"Female 2Alternative female narrator voice
"solo-male-3"Male 1Male narrator voice
"solo-male-4"Male 2Alternative male narrator voice

Background Music

Set the bgMusic option using one of the following keys.

bgMusic keyMood / Usage
"jazz"Warm, neutral bed
"lofi"Calm, study vibes
"whimsical"Playful, upbeat
"dramatic"Cinematic tension
"engaging"Subtle corporate pulse
"hyper"High-energy electronic
"inspirational"Uplifting orchestral
"documentary"Serious factual tone

Voice Instructions

Describe how the voice should sound — accent, tone, or pronunciation style.

Pass instructions in the voiceInstructions option to guide voice generation. The AI will adjust accent, tone, pace, and delivery accordingly.

voice-instructions-example.ts
const result = await golpo.createVideo('Explain quantum computing basics', {
  voiceInstructions: 'Speak in a warm British accent with a calm, professorial tone. Pause slightly between key concepts for emphasis.',
  style: 'solo-male-3',
});

More examples

Talk in a French accent
Use an enthusiastic, energetic tone
Talk like a professor — measured and articulate
Speak slowly and clearly, like a meditation guide
Fast-paced sports commentator style
Friendly and casual, like chatting with a friend

Video Instructions

Describe how the video should look — visuals, style, and scene direction.

Pass instructions in the videoInstructions option to guide visual generation. The AI will adjust scene composition, imagery, and visual style accordingly.

video-instructions-example.ts
const result = await golpo.createVideo('Company quarterly results overview', {
  videoInstructions: 'Use clean corporate visuals with data charts and graphs. Include stock footage of modern office environments. Prefer blue and white color palette.',
  style: 'solo-female-3',
});

More examples

Show more graphs and charts
Include more stock footage
Use cinematic transitions
Female presenter in an office setting
Urban background with modern architecture
Dark moody aesthetic with neon accents

Golpo Sketch Styles

The useLineart2Style option controls the whiteboard sketch animation style.

ValueStyle NameDescription
"false"Classic (Default)Original Golpo Sketch — classic whiteboard line-art animation
"true"Improved BetaImproved line-art with cleaner strokes and a more polished look
"advanced"FormalAdvanced sketch generation with higher detail and refined aesthetics
NOTE:Do not combine useLineart2Style with use2Style. Use one or the other.

Golpo Canvas Styles

Enable Golpo Canvas with use2Style and configure imageStyle and penStyle.

Set use2Style: true to enable Golpo Canvas. Then use imageStyle to set the visual look and optionally penStyle to add a drawing cursor effect.

Pen Style

ValueDescription
"none"No pen cursor (Default)
"stylus"Thin stylus pen cursor
"marker"Thick marker cursor
"pen"Classic pen cursor
NOTE:penStyle and imageStyle are only applicable for Golpo Canvas (use2Style: true). Do not use with Golpo Sketch.

Image Style

Controls the visual style of Golpo Canvas videos. Only applicable when use2Style is true.

ValueLabelDescription
"chalkboard_white"Chalkboard (B/W)Black & white chalkboard style (Default)
"neon"Chalkboard ColorColorful neon chalkboard style
"whiteboard"WhiteboardClean whiteboard illustrations
"modern_minimal"Modern MinimalSleek, minimal modern aesthetic
"playful"PlayfulFun, colorful playful illustrations
"technical"TechnicalTechnical diagram style
"editorial"EditorialMagazine/editorial illustration style
"marker"SharpieBold marker/sharpie drawn style
golpo-canvas-example.ts
const result = await golpo.createVideo('How solar panels convert sunlight to electricity', {
  use2Style: true,
  imageStyle: 'modern_minimal',
  penStyle: 'stylus',
  timing: 2,
});

Error Handling

Wrap all SDK calls in try/catch blocks to handle failures gracefully.

error-handling.ts
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

Invalid API KeyStatus 401 Unauthorized. Verify the constructor key.
File Not FoundLocal uploads missing. Confirm file paths exist.
Invalid ParametersAPI validation errors. Ensure option values are supported.
Network ErrorsConnection failures/timeouts. SDK automatically retries status checks.
Job FailedGeneration failed on backend. Check error message for details.