Skip to main content
POST

Overview

This endpoint generates a video script from a text prompt. It’s useful for getting an accurate cost estimate before committing to full video generation, and for reviewing/editing the script before proceeding.

Authentication

This endpoint requires API key authentication and consumes credits from your account.

Request Body

prompt
string
required
Text prompt describing the video content (max 10,000 characters).
duration
number
default:"60"
Target video duration in seconds (10-600).
urls
array
Array of web URLs to extract content from (max 10).
Enable web search to find additional relevant content.

Response

script
string
The generated video script.
cost
number
Credits consumed for script generation.
extractedImages
array
Array of image URLs extracted from web sources (strings).

Credit Costs

Script generation costs are based on:
  • Base cost: 0.1 credits every 60 seconds
  • Web search: +0.1 credits when enabled
  • URL processing: +0.1 credits per URL
Script generation costs are separate from video generation costs.

Usage Tips

1. Content Enhancement

  • Use webSearch: true to find relevant, up-to-date information
  • Provide specific URLs to extract content from predefined pages (like product page or article)
  • Review extracted images to see what visual content was found

2. Script Customization

  • Edit the generated script before using it in video generation
  • Adjust prompt to match your brand voice and pacing
  • Add specific product mentions or calls-to-action

Error Codes

  • MISSING_FIELD: Prompt is required
  • INVALID_TYPE: Invalid parameter type
  • INVALID_VALUE: Parameter value out of allowed range
  • INSUFFICIENT_CREDITS: Not enough credits for script generation
  • SCRIPT_GENERATION_FAILED: Failed to generate script

Next Steps

After generating a script:
  1. Review and Edit: Modify the script to match your needs
  2. Choose Resources: Use /voice/list and /avatar/list to select voice and avatar
  3. Generate Video: Use the script in /generation/start endpoint
  4. Monitor Progress: Check status with /generation/status/{job_id}
  5. Export Video: Use /export/start endpoint to export the video in the desired format
  6. Monitor Export Progress: Check status with /export/status/{job_id}