Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/anil-matcha/open-generative-ai/llms.txt

Use this file to discover all available pages before exploring further.

The generateVideo and generateI2V functions power video generation in Open Generative AI. Both follow the same submit-and-poll pattern as image generation, but with a higher polling timeout — video generation typically takes between 30 seconds and several minutes depending on the model and duration, so the polling loop runs up to 900 attempts at 2-second intervals (30 minutes total). Use generateVideo for text-to-video generation and generateI2V to animate a start-frame image.

generateVideo(apiKey, params)

Generates a video from a text prompt using any of the 40+ text-to-video models. Supports aspect ratio, duration, quality, and optional mode selection (e.g., for Grok Imagine’s fun/normal/spicy modes).
apiKey
string
required
Your Muapi.ai API key. Passed as the x-api-key header.
params.model
string
required
Text-to-video model ID. Examples: kling-v3, sora-2, veo-3, wan-2.6, seedance-2.0, hailuo-2.3, runway-gen3.
params.prompt
string
Text prompt describing the video to generate. Required for most models.
params.aspect_ratio
string
Output aspect ratio. Common values: 16:9, 9:16, 4:3, 3:4, 1:1. Model-dependent.
params.duration
string
Video duration. Common values: 5, 10, 15 (seconds). Model-dependent — check model capabilities.
params.resolution
string
Output resolution (model-dependent). E.g., 480p, 720p, 1080p.
params.quality
string
Quality preset: basic or high. Supported by Seedance 2.0 and similar ByteDance models.
params.mode
string
Generation mode for models that support it. E.g., Grok Imagine modes: fun, normal, spicy.
params.image_url
string
Optional start-frame image URL. Some T2V models accept an initial frame for style guidance.
params.onRequestId
(requestId: string) => void
Optional callback invoked after submission with the request_id.
Returns: Promise<{ url: string, outputs: string[], status: string, request_id: string }> The url field is the generated video URL.
import { generateVideo } from 'studio';

const result = await generateVideo('your-api-key', {
  model: 'kling-v3',
  prompt: 'a dragon soaring over snow-capped mountains, cinematic 4K, slow motion',
  aspect_ratio: '16:9',
  duration: '5',
  onRequestId: (id) => console.log('Request ID:', id)
});

console.log(result.url); // URL of the generated video
Seedance 2.0 with quality control:
const result = await generateVideo('your-api-key', {
  model: 'seedance-2.0',
  prompt: 'timelapse of a blooming flower, macro photography',
  aspect_ratio: '16:9',
  duration: '10',
  quality: 'high'
});

generateI2V(apiKey, params)

Generates a video from a start-frame image using any of the 60+ image-to-video models. The model animates the provided image into a video clip.
generateI2V uses the i2v model registry. Some models accept multiple reference images via images_list and also support a last_image parameter to specify the final frame of the animation.
apiKey
string
required
Your Muapi.ai API key.
params.model
string
required
Image-to-video model ID. Examples: kling-v2.1-i2v, veo3-i2v, runway-i2v, seedance-2.0-i2v, midjourney-v7-i2v, wan2.2-i2v.
params.prompt
string
Optional prompt to guide the animation style and motion.
params.image_url
string
URL of the start-frame image to animate.
params.images_list
string[]
Array of reference image URLs for models that support multiple inputs (e.g., Seedance 2.0 I2V supports up to 9 reference images).
params.last_image
string
URL of the desired end frame for models that support first-to-last frame interpolation.
params.aspect_ratio
string
Output aspect ratio (model-dependent).
params.duration
string
Video duration in seconds. Common values: 5, 10.
params.resolution
string
Output resolution (model-dependent).
params.quality
string
Quality preset (model-dependent).
params.mode
string
Generation mode (model-dependent).
params.name
string
Name value for models that define a name input field in their model info. Falls back to the model’s default name if not provided.
params.onRequestId
(requestId: string) => void
Optional callback with request_id after submission.
Returns: Promise<{ url: string, outputs: string[], status: string }>
import { generateI2V } from 'studio';

const result = await generateI2V('your-api-key', {
  model: 'kling-v2.1-i2v',
  image_url: 'https://example.com/start-frame.jpg',
  prompt: 'camera slowly pans right, dramatic lighting, cinematic',
  duration: '5',
  aspect_ratio: '16:9'
});

console.log(result.url);
Multi-reference with Seedance 2.0 I2V:
const result = await generateI2V('your-api-key', {
  model: 'seedance-2.0-i2v',
  images_list: [
    'https://example.com/ref1.jpg',
    'https://example.com/ref2.jpg'
  ],
  prompt: 'smooth camera motion, studio lighting',
  aspect_ratio: '16:9',
  duration: '5',
  quality: 'high'
});

Polling Timeout

Video generation uses a maximum of 900 poll attempts at 2-second intervals, giving a 30-minute window before the call times out with "Generation timed out after polling.". For long-form video models (e.g., Veo 3, Sora 2), ensure your calling environment does not time out the connection before the polling completes.
Use the onRequestId callback to save the request_id. If your process crashes before polling completes, you can manually call GET /api/v1/predictions/{request_id}/result to retrieve the output.

Build docs developers (and LLMs) love