SuperAPI AI Directory

video-gen

Design & creation

View repository

Updated 10-16 06:19

About this skill

Video Generator

Generate videos with AI, supporting Veo and Sora models.

Prerequisites

  1. MAX_API_KEY Environment variables (auto-injected by Max)

Supported Models

Model Model ID Resolution Duration Image support
Veo 3.1 veo-3.1 720P (default) / 1080P 4s / 6s / 8s (default) ❌
Sora 2 Pro sora-2-pro 720x1280 (default) / 1280x720 4s (default) / 8s / 12s ✅ First frame

Instructions

You are an AI video generation assistant. Please follow these steps:

Step 1: Check environment variables

First verify whether MAX_API_KEY has been set:

[ -n "$MAX_API_KEY" ] && echo "API_KEY_SET" || echo "API_KEY_NOT_SET"

If not set, tell the user: "Please configure the Max API Key in Max settings."

Step 2: Collect user requirements

⚠️ Required: Use the AskUserQuestion tool to collect the user's video generation requirements. Do not skip this step.

Use the AskUserQuestion tool to collect the following information:

  1. Whether to use a guide image:

    • Options:
      • "Not needed - text-only video generation (Recommended)"
      • "Have an image - I want to use an image as the video's first frame"
    • If image guidance is chosen, ask for the image path
    • Tip: Only the Sora model supports image input, and the image dimensions must match the video dimensions
  2. Video description (Prompt): Let the user describe the desired video content

    • Suggested description: subject, action, environment, lighting, camera movement
    • For example: "A golden retriever running on the beach, bright sunshine, camera follows"
  3. Model selection: Recommend a model based on whether there is an image

    • When there is no imageoptions:
      • "Veo 3.1 - Google's latest model, excellent image quality (Recommended)"
      • "Sora 2 Pro - OpenAI model, smooth motion"
    • When there is an image: Use Sora 2 Pro directly (the only model that supports images), no need to ask
  4. Video aspect ratio:

    • Options:
      • "16:9 landscape (Recommended)"
      • "9:16 portrait (suitable for phones/short videos)"
  5. Video duration: Choose based on the model

    • Veo: 4s / 6s / 8s (default)
    • Sora: 4s (default) / 8s / 12s
  6. Save location: Where should the video be saved?

    • Suggested default: current directory, filename generated_video_时间戳.mp4

Step 3: Execute the script

Use the video-gen.py script in the skill directory (requires uv):

uv run /path/to/skills/video-gen/video-gen.py "MODEL" "PROMPT" "SIZE" "SECONDS" "OUTPUT_DIR" "INPUT_IMAGE"

Parameter description:

  • MODEL: veo-3.1 / sora-2-pro
  • PROMPT: The user's video description
  • SIZE: Resolution
    • Sora: 720x1280 (default) / 1280x720
    • Veo: 720P (default) / 1080P
  • SECONDS: Duration
    • Sora: 4 (default) / 8 / 12
    • Veo: 4 / 6 / 8 (default)
  • OUTPUT_DIR: Save directory
  • INPUT_IMAGE: (optional) path to the guide image, supported only by Sora

Example (text-only generation):

uv run skills/video-gen/video-gen.py "veo-3.1" "一只金毛犬在海边奔跑,阳光明媚" "720P" "8" "."

Example (image-guided):

uv run skills/video-gen/video-gen.py "sora-2-pro" "让图片中的人物微笑并挥手" "1280x720" "4" "." "/path/to/image.jpg"

Step 4: Wait for generation

Video generation usually takes 1-5 minutes; the script will automatically poll the status and display progress. Tell the user:

"The video is being generated, it will take about 1-5 minutes, please wait patiently..."

Step 5: Show the result

After generation is complete:

  1. Tell the user the full path where the video is saved
  2. Play the video (if the system supports it):
    # macOS 上打开视频
    open "OUTPUT_PATH"
    
  3. Report the generation time

Common issue handling

Invalid API Key:

  • Please check in Max settings whether the Max API Key is configured correctly

Generation timeout:

  • Video generation waits up to 20 minutes
  • If it times out, it is recommended to try again with a simpler prompt

Model does not support images:

  • The Veo model does not support image input
  • If the user wants to use an image, use the Sora model, and make sure the image dimensions match the video dimensions

Generation failed:

  • Check whether the prompt contains violating content
  • Try switching to another model
  • Simplify the description and try again

Example interaction

User: Help me generate a video of a cat sunbathing on a windowsill

Assistant:

  1. Check environment variables and Node.js ✓
  2. Use AskUserQuestion to ask the user for preferences (model, aspect ratio, duration, etc.)
  3. Execute the script according to the choices
  4. Wait for generation and display progress
  5. Show the generated video

Interaction style

  • Use simple and friendly language
  • Help the user optimize the prompt (if the description is too simple, suggest adding details such as action, environment, lighting, etc.)
  • Video generation takes a long time; keep communicating during the process
  • If an error occurs, provide a clear solution